From 4b04d506c414ae5685b0fe04b010c4addb66c1f6 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 15 Jun 2018 15:31:41 +0200 Subject: [PATCH 1/2] Make the numpad highlight color configurable Fixes #11. Signed-off-by: Gergely Nagy --- src/Kaleidoscope-NumPad.cpp | 8 ++++---- src/Kaleidoscope-NumPad.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Kaleidoscope-NumPad.cpp b/src/Kaleidoscope-NumPad.cpp index 70a2299a..16263e38 100644 --- a/src/Kaleidoscope-NumPad.cpp +++ b/src/Kaleidoscope-NumPad.cpp @@ -7,7 +7,7 @@ byte NumPad_::row = 255, NumPad_::col = 255; uint8_t NumPad_::numPadLayer; bool NumPad_::cleanupDone = true; bool NumPad_::originalNumLockState = false; -cRGB numpad_color = CRGB(160, 0, 0); +cRGB NumPad_::color = CRGB(160, 0, 0); kaleidoscope::EventHandlerResult NumPad_::onSetup(void) { originalNumLockState = !!(kaleidoscope::hid::getKeyboardLEDs() & LED_NUM_LOCK); @@ -57,7 +57,7 @@ kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() { if ((k != layer_key) || (k == Key_NoKey) || (k.flags != KEY_FLAGS)) { LEDControl.refreshAt(r, c); } else { - LEDControl.setCrgbAt(r, c, numpad_color); + LEDControl.setCrgbAt(r, c, color); } } } @@ -65,8 +65,8 @@ kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() { if (row > ROWS || col > COLS) return kaleidoscope::EventHandlerResult::OK; - cRGB color = breath_compute(); - LEDControl.setCrgbAt(row, col, color); + cRGB lock_color = breath_compute(); + LEDControl.setCrgbAt(row, col, lock_color); return kaleidoscope::EventHandlerResult::OK; } diff --git a/src/Kaleidoscope-NumPad.h b/src/Kaleidoscope-NumPad.h index 6371c534..d6b73eaf 100644 --- a/src/Kaleidoscope-NumPad.h +++ b/src/Kaleidoscope-NumPad.h @@ -9,6 +9,7 @@ class NumPad_ : public kaleidoscope::Plugin { NumPad_(void) {} static uint8_t numPadLayer; + static cRGB color; kaleidoscope::EventHandlerResult onSetup(void); kaleidoscope::EventHandlerResult afterEachCycle(); From 604ebc448d613576027dabe2f2793c3607ebed4c Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 15 Jun 2018 15:32:59 +0200 Subject: [PATCH 2/2] Make the NumLock breathe's hue configurable too Signed-off-by: Gergely Nagy --- src/Kaleidoscope-NumPad.cpp | 3 ++- src/Kaleidoscope-NumPad.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Kaleidoscope-NumPad.cpp b/src/Kaleidoscope-NumPad.cpp index 16263e38..c9860238 100644 --- a/src/Kaleidoscope-NumPad.cpp +++ b/src/Kaleidoscope-NumPad.cpp @@ -8,6 +8,7 @@ uint8_t NumPad_::numPadLayer; bool NumPad_::cleanupDone = true; bool NumPad_::originalNumLockState = false; cRGB NumPad_::color = CRGB(160, 0, 0); +uint8_t NumPad_::lock_hue = 170; kaleidoscope::EventHandlerResult NumPad_::onSetup(void) { originalNumLockState = !!(kaleidoscope::hid::getKeyboardLEDs() & LED_NUM_LOCK); @@ -65,7 +66,7 @@ kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() { if (row > ROWS || col > COLS) return kaleidoscope::EventHandlerResult::OK; - cRGB lock_color = breath_compute(); + cRGB lock_color = breath_compute(lock_hue); LEDControl.setCrgbAt(row, col, lock_color); return kaleidoscope::EventHandlerResult::OK; diff --git a/src/Kaleidoscope-NumPad.h b/src/Kaleidoscope-NumPad.h index d6b73eaf..aeb534b1 100644 --- a/src/Kaleidoscope-NumPad.h +++ b/src/Kaleidoscope-NumPad.h @@ -10,6 +10,7 @@ class NumPad_ : public kaleidoscope::Plugin { static uint8_t numPadLayer; static cRGB color; + static uint8_t lock_hue; kaleidoscope::EventHandlerResult onSetup(void); kaleidoscope::EventHandlerResult afterEachCycle();