Add an (optional) default palette

Fixes #1.

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

@ -24,6 +24,7 @@ namespace KaleidoscopePlugins {
uint16_t FingerPainter::paletteBase;
uint16_t FingerPainter::colorBase;
bool FingerPainter::editMode;
const cRGB *FingerPainter::defaultPalette;
FingerPainter::FingerPainter (void) {
}
@ -130,6 +131,17 @@ namespace KaleidoscopePlugins {
return true;
}
if (Serial.peek() == 'd') {
Serial.read ();
if (!defaultPalette)
return true;
for (uint8_t i = 0; i < 16; i++) {
EEPROM.put (paletteBase + i * sizeof (cRGB), defaultPalette[i]);
}
return true;
}
uint8_t i = 0;
while (i < 16 && Serial.peek() != '\n') {
cRGB color;

@ -33,6 +33,8 @@ namespace KaleidoscopePlugins {
static void toggleEdit (void);
static bool focusHook (const char *command);
static const cRGB *defaultPalette;
private:
static uint16_t paletteBase;
static uint16_t colorBase;
@ -48,3 +50,23 @@ extern KaleidoscopePlugins::FingerPainter FingerPainter;
#define FOCUS_HOOK_FINGERPAINTER FOCUS_HOOK(FingerPainter.focusHook, \
"fingerpainter.palette\n" \
"fingerpainter.toggle")
#define FINGERPAINTER_PALETTE_EGA (const cRGB[]) { \
CRGB (0x00, 0x00, 0x00), \
CRGB (0x00, 0x00, 0xaa), \
CRGB (0x00, 0xaa, 0x00), \
CRGB (0x00, 0xaa, 0xaa), \
CRGB (0xaa, 0x00, 0x00), \
CRGB (0xaa, 0x00, 0xaa), \
CRGB (0xaa, 0x55, 0x00), \
CRGB (0xaa, 0xaa, 0xaa), \
\
CRGB (0x55, 0x55, 0x55), \
CRGB (0x55, 0x55, 0xff), \
CRGB (0x55, 0xff, 0x55), \
CRGB (0x55, 0xff, 0xff), \
CRGB (0xff, 0x55, 0x55), \
CRGB (0xff, 0x55, 0xff), \
CRGB (0xff, 0xff, 0x55), \
CRGB (0xff, 0xff, 0xff) \
}

Loading…
Cancel
Save