|
|
@ -20,33 +20,33 @@
|
|
|
|
#include <LEDUtils.h>
|
|
|
|
#include <LEDUtils.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
namespace LEDEffects {
|
|
|
|
namespace LEDEffects {
|
|
|
|
uint8_t StalkerEffect::map[ROWS][COLS];
|
|
|
|
uint8_t StalkerEffect::map[ROWS][COLS];
|
|
|
|
StalkerEffect::ColorComputer *StalkerEffect::colorComputer;
|
|
|
|
StalkerEffect::ColorComputer *StalkerEffect::colorComputer;
|
|
|
|
uint16_t StalkerEffect::stepLength = 50;
|
|
|
|
uint16_t StalkerEffect::stepLength = 50;
|
|
|
|
uint32_t StalkerEffect::stepEndTime;
|
|
|
|
uint32_t StalkerEffect::stepEndTime;
|
|
|
|
|
|
|
|
|
|
|
|
StalkerEffect::StalkerEffect (void) {
|
|
|
|
StalkerEffect::StalkerEffect (void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
StalkerEffect::configure (ColorComputer *colorComputer_) {
|
|
|
|
StalkerEffect::configure (ColorComputer *colorComputer_) {
|
|
|
|
colorComputer = colorComputer_;
|
|
|
|
colorComputer = colorComputer_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
StalkerEffect::begin (void) {
|
|
|
|
StalkerEffect::begin (void) {
|
|
|
|
event_handler_hook_use (eventHandlerHook);
|
|
|
|
event_handler_hook_use (eventHandlerHook);
|
|
|
|
LEDMode::begin ();
|
|
|
|
LEDMode::begin ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
StalkerEffect::init (void) {
|
|
|
|
StalkerEffect::init (void) {
|
|
|
|
memset (map, 0, sizeof (map));
|
|
|
|
memset (map, 0, sizeof (map));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Key
|
|
|
|
Key
|
|
|
|
StalkerEffect::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
StalkerEffect::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
if (row >= ROWS || col >= COLS)
|
|
|
|
if (row >= ROWS || col >= COLS)
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
|
|
|
|
|
|
|
@ -55,10 +55,10 @@ namespace KaleidoscopePlugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
StalkerEffect::update (void) {
|
|
|
|
StalkerEffect::update (void) {
|
|
|
|
if (!colorComputer)
|
|
|
|
if (!colorComputer)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
@ -78,25 +78,27 @@ namespace KaleidoscopePlugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!wasZero && !map[r][c])
|
|
|
|
if (!wasZero && !map[r][c])
|
|
|
|
LEDControl.led_set_crgb_at (r, c, (cRGB){0, 0, 0});
|
|
|
|
LEDControl.led_set_crgb_at (r, c, (cRGB) {
|
|
|
|
|
|
|
|
0, 0, 0
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (timeOut)
|
|
|
|
if (timeOut)
|
|
|
|
stepEndTime = millis () + stepLength;
|
|
|
|
stepEndTime = millis () + stepLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace Stalker {
|
|
|
|
namespace Stalker {
|
|
|
|
|
|
|
|
|
|
|
|
cRGB Haunt::highlightColor;
|
|
|
|
cRGB Haunt::highlightColor;
|
|
|
|
|
|
|
|
|
|
|
|
// Haunt
|
|
|
|
// Haunt
|
|
|
|
Haunt::Haunt (const cRGB highlightColor_) {
|
|
|
|
Haunt::Haunt (const cRGB highlightColor_) {
|
|
|
|
highlightColor = highlightColor_;
|
|
|
|
highlightColor = highlightColor_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cRGB
|
|
|
|
cRGB
|
|
|
|
Haunt::compute (uint8_t *step) {
|
|
|
|
Haunt::compute (uint8_t *step) {
|
|
|
|
cRGB color = CRGB((uint8_t)min(*step * highlightColor.r / 255, 255),
|
|
|
|
cRGB color = CRGB((uint8_t)min(*step * highlightColor.r / 255, 255),
|
|
|
|
(uint8_t)min(*step * highlightColor.g / 255, 255),
|
|
|
|
(uint8_t)min(*step * highlightColor.g / 255, 255),
|
|
|
|
(uint8_t)min(*step * highlightColor.b / 255, 255));
|
|
|
|
(uint8_t)min(*step * highlightColor.b / 255, 255));
|
|
|
@ -111,20 +113,19 @@ namespace KaleidoscopePlugins {
|
|
|
|
*step = 0;
|
|
|
|
*step = 0;
|
|
|
|
|
|
|
|
|
|
|
|
return color;
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// BlazingTrail
|
|
|
|
// BlazingTrail
|
|
|
|
BlazingTrail::BlazingTrail (...) {
|
|
|
|
BlazingTrail::BlazingTrail (...) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cRGB
|
|
|
|
cRGB
|
|
|
|
BlazingTrail::compute (uint8_t *step) {
|
|
|
|
BlazingTrail::compute (uint8_t *step) {
|
|
|
|
cRGB color;
|
|
|
|
cRGB color;
|
|
|
|
|
|
|
|
|
|
|
|
if (*step >= 0xff - 30) {
|
|
|
|
if (*step >= 0xff - 30) {
|
|
|
|
color = hsv_to_rgb (0xff - *step, 255, 255);
|
|
|
|
color = hsv_to_rgb (0xff - *step, 255, 255);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
color = hsv_to_rgb (30, 255, 255);
|
|
|
|
color = hsv_to_rgb (30, 255, 255);
|
|
|
|
|
|
|
|
|
|
|
|
color.r = min(*step * color.r / 255, 255);
|
|
|
|
color.r = min(*step * color.r / 255, 255);
|
|
|
@ -141,11 +142,11 @@ namespace KaleidoscopePlugins {
|
|
|
|
*step = 0;
|
|
|
|
*step = 0;
|
|
|
|
|
|
|
|
|
|
|
|
return color;
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
KaleidoscopePlugins::LEDEffects::StalkerEffect StalkerEffect;
|
|
|
|
KaleidoscopePlugins::LEDEffects::StalkerEffect StalkerEffect;
|
|
|
|