From da0c998760529ab41d61858f6ab9fc7062bc070a Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 15 Aug 2017 23:04:32 +0200 Subject: [PATCH] Updated to use the new LEDMode/LEDControl API Signed-off-by: Gergely Nagy --- src/Kaleidoscope-Numlock.cpp | 13 +++---------- src/Kaleidoscope-Numlock.h | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Kaleidoscope-Numlock.cpp b/src/Kaleidoscope-Numlock.cpp index b27fe8ca..744ffd49 100644 --- a/src/Kaleidoscope-Numlock.cpp +++ b/src/Kaleidoscope-Numlock.cpp @@ -6,13 +6,9 @@ byte NumLock_::row = 255, NumLock_::col = 255; uint8_t NumLock_::numPadLayer; cRGB numpad_color = CRGB(255, 0, 0); -cRGB off_color = CRGB(0, 0, 0); - -NumLock_::NumLock_(void) { -} void NumLock_::begin(void) { - loop_hook_use(loopHook); + Kaleidoscope.useLoopHook(loopHook); } void NumLock_::loopHook(bool postClear) { @@ -25,7 +21,7 @@ void NumLock_::loopHook(bool postClear) { Key layer_key = Layer.getKey(numPadLayer, r, c); if ((k != layer_key) || (k.flags != KEY_FLAGS)) { - LEDControl.setCrgbAt(r, c, off_color); + LEDControl.refreshAt(r, c); } else { LEDControl.setCrgbAt(r, c, numpad_color); } @@ -45,10 +41,7 @@ const macro_t *NumLock_::toggle() { if (Layer.isOn(numPadLayer)) { Layer.off(numPadLayer); - // Reset all LEDs to off to hopefully give the previous LED effect - // a better starting state - LEDControl.set_all_leds_to({0, 0, 0}); - LEDControl.init_mode(); + LEDControl.set_mode(LEDControl.get_mode_index()); } else { Layer.on(numPadLayer); } diff --git a/src/Kaleidoscope-Numlock.h b/src/Kaleidoscope-Numlock.h index 1c9ebee4..c11a36ce 100644 --- a/src/Kaleidoscope-Numlock.h +++ b/src/Kaleidoscope-Numlock.h @@ -9,7 +9,7 @@ class NumLock_ : public KaleidoscopePlugin { public: - NumLock_(void); + NumLock_(void) {} void begin(void) final;