diff --git a/src/Kaleidoscope-LEDControl.cpp b/src/Kaleidoscope-LEDControl.cpp index 30b24b36..7e440afc 100644 --- a/src/Kaleidoscope-LEDControl.cpp +++ b/src/Kaleidoscope-LEDControl.cpp @@ -2,6 +2,8 @@ LEDMode *LEDControl_::modes[LED_MAX_MODES]; uint8_t LEDControl_::previousMode, LEDControl_::mode; +uint16_t LEDControl_::syncDelay = 16; +uint32_t LEDControl_::syncTimer; void LEDMode::activate (void) { @@ -126,6 +128,8 @@ LEDControl_::begin (void) { event_handler_hook_use(eventHandler); loop_hook_use(loopHook); + + syncTimer = millis() + syncDelay; } Key @@ -144,7 +148,10 @@ LEDControl_::loopHook (bool postClear) { if (postClear) return; - led_sync(); + if (millis() > syncTimer) { + led_sync(); + syncTimer = millis() + syncDelay; + } update(); } diff --git a/src/Kaleidoscope-LEDControl.h b/src/Kaleidoscope-LEDControl.h index a6c678a1..81280b58 100644 --- a/src/Kaleidoscope-LEDControl.h +++ b/src/Kaleidoscope-LEDControl.h @@ -41,7 +41,10 @@ class LEDControl_ : public KaleidoscopePlugin { static void activate (LEDMode *mode); + static uint16_t syncDelay; + private: + static uint32_t syncTimer; static LEDMode *modes[LED_MAX_MODES]; static uint8_t previousMode, mode;