From 3ad1ecd7304ec1bff8cc9ebe66f78ca5c0ee5c21 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Sun, 2 Sep 2018 23:02:34 -0700 Subject: [PATCH] Add inactive_color property --- doc/plugin/LED-Stalker.md | 6 ++++++ src/kaleidoscope/plugin/LED-Stalker.cpp | 7 ++++--- src/kaleidoscope/plugin/LED-Stalker.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/plugin/LED-Stalker.md b/doc/plugin/LED-Stalker.md index 5cf51cf4..85a6fe8d 100644 --- a/doc/plugin/LED-Stalker.md +++ b/doc/plugin/LED-Stalker.md @@ -46,6 +46,12 @@ properties: > > Defaults to 50. +### `.inactive-color` + +> The color to use when a key hasn't been pressed recently. +> +> Defaults to `(cRGB) { 0, 0, 0 }` + ## Plugin helpers ### `STALKER(effect, params)` diff --git a/src/kaleidoscope/plugin/LED-Stalker.cpp b/src/kaleidoscope/plugin/LED-Stalker.cpp index 4f64913c..4734f036 100644 --- a/src/kaleidoscope/plugin/LED-Stalker.cpp +++ b/src/kaleidoscope/plugin/LED-Stalker.cpp @@ -24,6 +24,9 @@ uint8_t StalkerEffect::map_[ROWS][COLS]; StalkerEffect::ColorComputer *StalkerEffect::variant; uint16_t StalkerEffect::step_length = 50; uint16_t StalkerEffect::step_start_time_; +cRGB StalkerEffect::inactive_color = (cRGB) { + 0, 0, 0 +}; void StalkerEffect::onActivate(void) { memset(map_, 0, sizeof(map_)); @@ -59,9 +62,7 @@ void StalkerEffect::update(void) { } if (!map_[r][c]) - ::LEDControl.setCrgbAt(r, c, (cRGB) { - 0, 0, 0 - }); + ::LEDControl.setCrgbAt(r, c, inactive_color); } } diff --git a/src/kaleidoscope/plugin/LED-Stalker.h b/src/kaleidoscope/plugin/LED-Stalker.h index 029895fa..80e893e0 100644 --- a/src/kaleidoscope/plugin/LED-Stalker.h +++ b/src/kaleidoscope/plugin/LED-Stalker.h @@ -35,6 +35,7 @@ class StalkerEffect : public LEDMode { static ColorComputer *variant; static uint16_t step_length; + static cRGB inactive_color; EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t keyState);