Focus: Add a "clear" sub-command

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent cd8a87ec47
commit 8a5b13673a

@ -104,6 +104,7 @@ namespace KaleidoscopePlugins {
enum {
PALETTE,
TOGGLE,
CLEAR,
} subCommand;
if (strncmp_P (command, PSTR ("fingerpainter."), 14) != 0)
@ -113,6 +114,8 @@ namespace KaleidoscopePlugins {
subCommand = PALETTE;
else if (strcmp_P (command + 14, PSTR ("toggle")) == 0)
subCommand = TOGGLE;
else if (strcmp_P (command + 14, PSTR ("clear")) == 0)
subCommand = CLEAR;
else
return false;
@ -122,6 +125,13 @@ namespace KaleidoscopePlugins {
return true;
}
if (subCommand == CLEAR) {
for (uint16_t i = 0; i < ROWS * COLS; i++) {
EEPROM.update (colorBase + i, 0);
}
return true;
}
if (Serial.peek () == '\n') {
for (uint8_t i = 0; i < 16; i++) {
cRGB color;

@ -49,7 +49,8 @@ extern KaleidoscopePlugins::FingerPainter FingerPainter;
#define FOCUS_HOOK_FINGERPAINTER FOCUS_HOOK(FingerPainter.focusHook, \
"fingerpainter.palette\n" \
"fingerpainter.toggle")
"fingerpainter.toggle\n" \
"fingerpainter.clear")
#define FINGERPAINTER_PALETTE_EGA (const cRGB[]) { \
CRGB (0x00, 0x00, 0x00), \

Loading…
Cancel
Save