|
|
@ -22,13 +22,11 @@ namespace kaleidoscope {
|
|
|
|
namespace plugin {
|
|
|
|
namespace plugin {
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t IdleLEDs::idle_time_limit = 600; // 10 minutes
|
|
|
|
uint16_t IdleLEDs::idle_time_limit = 600; // 10 minutes
|
|
|
|
uint32_t IdleLEDs::last_keypress_time_;
|
|
|
|
uint32_t IdleLEDs::end_time_;
|
|
|
|
|
|
|
|
|
|
|
|
EventHandlerResult IdleLEDs::beforeEachCycle() {
|
|
|
|
EventHandlerResult IdleLEDs::beforeEachCycle() {
|
|
|
|
uint32_t idle_limit = idle_time_limit * 1000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!::LEDControl.paused &&
|
|
|
|
if (!::LEDControl.paused &&
|
|
|
|
Kaleidoscope.millisAtCycleStart() - last_keypress_time_ >= idle_limit) {
|
|
|
|
(Kaleidoscope.millisAtCycleStart() >= end_time_)) {
|
|
|
|
::LEDControl.set_all_leds_to(CRGB(0, 0, 0));
|
|
|
|
::LEDControl.set_all_leds_to(CRGB(0, 0, 0));
|
|
|
|
::LEDControl.syncLeds();
|
|
|
|
::LEDControl.syncLeds();
|
|
|
|
|
|
|
|
|
|
|
@ -45,7 +43,7 @@ EventHandlerResult IdleLEDs::onKeyswitchEvent(Key &mapped_key, byte row, byte co
|
|
|
|
::LEDControl.refreshAll();
|
|
|
|
::LEDControl.refreshAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
last_keypress_time_ = Kaleidoscope.millisAtCycleStart();
|
|
|
|
end_time_ = Kaleidoscope.millisAtCycleStart() + (uint32_t)idle_time_limit * 1000;
|
|
|
|
|
|
|
|
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|