From 4f7e60ec52efedcf969b4cb42b6abbcfdc7e17c4 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 28 Jul 2017 08:24:36 +0200 Subject: [PATCH] Highlight changed keys on the NumLock layer, not just NumPad ones As there are - or at least may be - other keys on the layer, not just NumPad ones, those should be highlighted too. Addresses the bulk of keyboardio/Kaleidoscope#149, by comparing the looked up key with what is directly on the `numPadLayer`: if they are the same, then it is a key that we assume changed, and do the coloring. If they are different (in other words, the key on the `numPadLayer` is transparent or off), we skip the highlight. The downside is that we highlight layer switching keys too, which we may not want. That will be addressed separately. Signed-off-by: Gergely Nagy --- src/Kaleidoscope-Numlock.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Kaleidoscope-Numlock.cpp b/src/Kaleidoscope-Numlock.cpp index 9b251120..430d7f2b 100644 --- a/src/Kaleidoscope-Numlock.cpp +++ b/src/Kaleidoscope-Numlock.cpp @@ -21,8 +21,9 @@ void NumLock_::loopHook(bool postClear) { for (uint8_t r = 0; r < ROWS; r++) { for (uint8_t c = 0; c < COLS; c++) { Key k = Layer.lookup(r, c); + Key layer_key = Layer.getKey(numPadLayer, r, c); - if (k.raw < Key_KeypadNumLock.raw || k.raw > Key_KeypadDot.raw) + if ((k != layer_key)) continue; LEDControl.setCrgbAt(r, c, numpad_color);