|
|
@ -23,24 +23,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t EEPROMColormapEffect::paletteBase;
|
|
|
|
uint16_t EEPROMColormapEffect::paletteBase;
|
|
|
|
uint16_t EEPROMColormapEffect::mapBase;
|
|
|
|
uint16_t EEPROMColormapEffect::mapBase;
|
|
|
|
uint8_t EEPROMColormapEffect::maxLayers;
|
|
|
|
uint8_t EEPROMColormapEffect::maxLayers;
|
|
|
|
|
|
|
|
|
|
|
|
EEPROMColormapEffect::EEPROMColormapEffect (void) {
|
|
|
|
EEPROMColormapEffect::EEPROMColormapEffect (void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
EEPROMColormapEffect::configure (uint8_t maxLayers_) {
|
|
|
|
EEPROMColormapEffect::configure (uint8_t maxLayers_) {
|
|
|
|
USE_PLUGINS (&::EEPROMSettings);
|
|
|
|
USE_PLUGINS (&::EEPROMSettings);
|
|
|
|
|
|
|
|
|
|
|
|
maxLayers = maxLayers_;
|
|
|
|
maxLayers = maxLayers_;
|
|
|
|
paletteBase = ::EEPROMSettings.requestSlice (15 * sizeof (cRGB));
|
|
|
|
paletteBase = ::EEPROMSettings.requestSlice (15 * sizeof (cRGB));
|
|
|
|
mapBase = ::EEPROMSettings.requestSlice (maxLayers * ROWS * COLS / 2);
|
|
|
|
mapBase = ::EEPROMSettings.requestSlice (maxLayers * ROWS * COLS / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
EEPROMColormapEffect::update (void) {
|
|
|
|
EEPROMColormapEffect::update (void) {
|
|
|
|
for (uint8_t l = 0; l < 32; l++) {
|
|
|
|
for (uint8_t l = 0; l < 32; l++) {
|
|
|
|
if (!Layer.isOn (l))
|
|
|
|
if (!Layer.isOn (l))
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -56,10 +56,10 @@ namespace KaleidoscopePlugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bool
|
|
|
|
const bool
|
|
|
|
EEPROMColormapEffect::lookupColor (uint8_t layer, uint8_t row, uint8_t column, cRGB *color) {
|
|
|
|
EEPROMColormapEffect::lookupColor (uint8_t layer, uint8_t row, uint8_t column, cRGB *color) {
|
|
|
|
uint8_t colorIndex;
|
|
|
|
uint8_t colorIndex;
|
|
|
|
uint16_t mapIndex = (layer * ROWS * COLS / 2 + row * COLS / 2 + column / 2);
|
|
|
|
uint16_t mapIndex = (layer * ROWS * COLS / 2 + row * COLS / 2 + column / 2);
|
|
|
|
|
|
|
|
|
|
|
@ -75,10 +75,10 @@ namespace KaleidoscopePlugins {
|
|
|
|
EEPROM.get (paletteBase + colorIndex * sizeof (cRGB), *color);
|
|
|
|
EEPROM.get (paletteBase + colorIndex * sizeof (cRGB), *color);
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
EEPROMColormapEffect::focusHook (const char *command) {
|
|
|
|
EEPROMColormapEffect::focusHook (const char *command) {
|
|
|
|
enum {
|
|
|
|
enum {
|
|
|
|
PALETTE,
|
|
|
|
PALETTE,
|
|
|
|
MAP,
|
|
|
|
MAP,
|
|
|
@ -94,8 +94,7 @@ namespace KaleidoscopePlugins {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
switch (subCommand) {
|
|
|
|
switch (subCommand) {
|
|
|
|
case PALETTE:
|
|
|
|
case PALETTE: {
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Serial.peek () == '\n') {
|
|
|
|
if (Serial.peek () == '\n') {
|
|
|
|
for (uint8_t i = 0; i < 15; i++) {
|
|
|
|
for (uint8_t i = 0; i < 15; i++) {
|
|
|
|
cRGB color;
|
|
|
|
cRGB color;
|
|
|
@ -123,8 +122,7 @@ namespace KaleidoscopePlugins {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case MAP:
|
|
|
|
case MAP: {
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Serial.peek () == '\n') {
|
|
|
|
if (Serial.peek () == '\n') {
|
|
|
|
for (uint8_t layer = 0; layer < maxLayers; layer++) {
|
|
|
|
for (uint8_t layer = 0; layer < maxLayers; layer++) {
|
|
|
|
for (uint8_t row = 0; row < ROWS; row++) {
|
|
|
|
for (uint8_t row = 0; row < ROWS; row++) {
|
|
|
@ -153,7 +151,7 @@ namespace KaleidoscopePlugins {
|
|
|
|
uint8_t idx2 = Serial.parseInt ();
|
|
|
|
uint8_t idx2 = Serial.parseInt ();
|
|
|
|
uint8_t indexes = (idx1 << 4) + idx2;
|
|
|
|
uint8_t indexes = (idx1 << 4) + idx2;
|
|
|
|
|
|
|
|
|
|
|
|
EEPROM.update (mapBase + loc , indexes);
|
|
|
|
EEPROM.update (mapBase + loc, indexes);
|
|
|
|
loc++;
|
|
|
|
loc++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -161,7 +159,7 @@ namespace KaleidoscopePlugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|