Focus: add fingerpainter.toggle

Toggles the Edit mode.

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

@ -94,9 +94,27 @@ namespace KaleidoscopePlugins {
bool
FingerPainter::focusHook (const char *command) {
if (strcmp_P (command, PSTR ("fingerpainter.palette")) != 0)
enum {
PALETTE,
TOGGLE,
} subCommand;
if (strncmp_P (command, PSTR ("fingerpainter."), 14) != 0)
return false;
if (strcmp_P (command + 14, PSTR ("palette")) == 0)
subCommand = PALETTE;
else if (strcmp_P (command + 14, PSTR ("toggle")) == 0)
subCommand = TOGGLE;
else
return false;
if (subCommand == TOGGLE) {
::FingerPainter.activate ();
toggleEdit ();
return true;
}
if (Serial.peek () == '\n') {
for (uint8_t i = 0; i < 16; i++) {
cRGB color;

@ -46,4 +46,5 @@ namespace KaleidoscopePlugins {
extern KaleidoscopePlugins::FingerPainter FingerPainter;
#define FOCUS_HOOK_FINGERPAINTER FOCUS_HOOK(FingerPainter.focusHook, \
"fingerpainter.palette")
"fingerpainter.palette\n" \
"fingerpainter.toggle")

Loading…
Cancel
Save