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