aboutsummaryrefslogtreecommitdiffstats
path: root/src/Kaleidoscope-LayerHighlighter.cpp
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2018-11-25 11:07:28 -0500
committerBrian Cully <bjc@kublai.com>2018-11-25 11:07:28 -0500
commit9d9d273d47c1c3beddabdd282e4cd0c2fd52509f (patch)
tree1b987775cda4aa01fe2912d180fcff12abd3f79a /src/Kaleidoscope-LayerHighlighter.cpp
parent9e3dc09041aa5ef952033301f304a962da198f62 (diff)
downloadKaleidoscope-LayerHighlighter-9d9d273d47c1c3beddabdd282e4cd0c2fd52509f.tar.gz
Kaleidoscope-LayerHighlighter-9d9d273d47c1c3beddabdd282e4cd0c2fd52509f.zip
Toggle LEDs only when layer key is pressed.
Fixes interactions with NumPad plugin when there are no other LED effects present.
Diffstat (limited to 'src/Kaleidoscope-LayerHighlighter.cpp')
-rw-r--r--src/Kaleidoscope-LayerHighlighter.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Kaleidoscope-LayerHighlighter.cpp b/src/Kaleidoscope-LayerHighlighter.cpp
index 3ed56cb..7c30761 100644
--- a/src/Kaleidoscope-LayerHighlighter.cpp
+++ b/src/Kaleidoscope-LayerHighlighter.cpp
@@ -8,14 +8,25 @@ kaleidoscope::EventHandlerResult LayerHighlighter::onSetup(void) {
return kaleidoscope::EventHandlerResult::OK;
}
+kaleidoscope::EventHandlerResult LayerHighlighter::onKeyswitchEvent(Key &mappedKey, byte row, byte col, uint8_t keyState) {
+ if (mappedKey != LockLayer(layer)) {
+ return kaleidoscope::EventHandlerResult::OK;
+ }
+
+ if (keyToggledOn(keyState)) {
+ savedLEDMode = LEDControl.get_mode_index();
+ } else if (keyToggledOff(keyState)) {
+ LEDControl.set_mode(LEDControl.get_mode_index());
+ }
+
+ return kaleidoscope::EventHandlerResult::OK;
+}
+
kaleidoscope::EventHandlerResult LayerHighlighter::afterEachCycle() {
if (!Layer.isOn(layer)) {
- LEDControl.set_mode(LEDControl.get_mode_index());
return kaleidoscope::EventHandlerResult::OK;
}
- LEDControl.set_mode(LEDControl.get_mode_index());
-
for (uint8_t r = 0; r < ROWS; r++) {
for (uint8_t c = 0; c < COLS; c++) {
Key k = Layer.lookupOnActiveLayer(r, c);