Merge pull request #383 from keyboardio/pr-migration/LED-Stalker/19

Add inactive_color property
pull/426/head
Gergely Nagy 6 years ago committed by GitHub
commit dc5c25c99f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -46,6 +46,12 @@ properties:
> >
> Defaults to 50. > 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 ## Plugin helpers
### `STALKER(effect, params)` ### `STALKER(effect, params)`

@ -24,6 +24,9 @@ uint8_t StalkerEffect::map_[ROWS][COLS];
StalkerEffect::ColorComputer *StalkerEffect::variant; StalkerEffect::ColorComputer *StalkerEffect::variant;
uint16_t StalkerEffect::step_length = 50; uint16_t StalkerEffect::step_length = 50;
uint16_t StalkerEffect::step_start_time_; uint16_t StalkerEffect::step_start_time_;
cRGB StalkerEffect::inactive_color = (cRGB) {
0, 0, 0
};
void StalkerEffect::onActivate(void) { void StalkerEffect::onActivate(void) {
memset(map_, 0, sizeof(map_)); memset(map_, 0, sizeof(map_));
@ -59,9 +62,7 @@ void StalkerEffect::update(void) {
} }
if (!map_[r][c]) if (!map_[r][c])
::LEDControl.setCrgbAt(r, c, (cRGB) { ::LEDControl.setCrgbAt(r, c, inactive_color);
0, 0, 0
});
} }
} }

@ -35,6 +35,7 @@ class StalkerEffect : public LEDMode {
static ColorComputer *variant; static ColorComputer *variant;
static uint16_t step_length; static uint16_t step_length;
static cRGB inactive_color;
EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t keyState); EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t keyState);

Loading…
Cancel
Save