From 764a2457aba6c1e0f33f9481417813387dcca1d9 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Fri, 1 Mar 2019 16:19:25 -0600 Subject: [PATCH 1/2] Decrease LED refresh rate This decreases the rate at which LEDs get updated from ~60Hz to ~30Hz, which should be fast enough that human eyes won't be able to tell the difference. Signed-off-by: Michael Richters --- src/kaleidoscope/plugin/LEDControl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kaleidoscope/plugin/LEDControl.cpp b/src/kaleidoscope/plugin/LEDControl.cpp index 5f7eb32c..b47bc969 100644 --- a/src/kaleidoscope/plugin/LEDControl.cpp +++ b/src/kaleidoscope/plugin/LEDControl.cpp @@ -22,7 +22,7 @@ namespace plugin { LEDMode *LEDControl::modes[LED_MAX_MODES]; uint8_t LEDControl::mode; -uint16_t LEDControl::syncDelay = 16; +uint16_t LEDControl::syncDelay = 32; // 32ms interval => 30Hz refresh rate uint16_t LEDControl::syncTimer; bool LEDControl::paused = false; From b083803dc0f24b14c25f8fbe3a25198e4020b42a Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Fri, 1 Mar 2019 16:55:09 -0600 Subject: [PATCH 2/2] Only call update() on cycles when we sync LEDs Since LED modes only send updates to the hardware at `syncDelay` intervals, calling `update()` on the active mode every cycle doesn't make animations any smoother. Signed-off-by: Michael Richters --- src/kaleidoscope/plugin/LEDControl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kaleidoscope/plugin/LEDControl.cpp b/src/kaleidoscope/plugin/LEDControl.cpp index b47bc969..1afec63e 100644 --- a/src/kaleidoscope/plugin/LEDControl.cpp +++ b/src/kaleidoscope/plugin/LEDControl.cpp @@ -176,8 +176,8 @@ kaleidoscope::EventHandlerResult LEDControl::beforeReportingState(void) { if (elapsed > syncDelay) { syncLeds(); syncTimer += syncDelay; + update(); } - update(); return kaleidoscope::EventHandlerResult::OK; }