Remove defunct presetApplyCol and presetApplyFx

This commit is contained in:
cschwinne 2020-02-29 18:42:55 +01:00
parent 14a5ab6740
commit 18dad0c72c
6 changed files with 26 additions and 36 deletions

View File

@ -390,7 +390,7 @@ bool presetCyclingEnabled = false;
byte presetCycleMin = 1, presetCycleMax = 5; byte presetCycleMin = 1, presetCycleMax = 5;
uint16_t presetCycleTime = 1250; uint16_t presetCycleTime = 1250;
unsigned long presetCycledTime = 0; byte presetCycCurr = presetCycleMin; unsigned long presetCycledTime = 0; byte presetCycCurr = presetCycleMin;
bool presetApplyBri = false, presetApplyCol = true, presetApplyFx = true; bool presetApplyBri = true;
bool saveCurrPresetCycConf = false; bool saveCurrPresetCycConf = false;
//realtime //realtime

View File

@ -232,8 +232,8 @@ void saveSettingsToEEPROM()
EEPROM.write(2208, presetCycleMin); EEPROM.write(2208, presetCycleMin);
EEPROM.write(2209, presetCycleMax); EEPROM.write(2209, presetCycleMax);
EEPROM.write(2210, presetApplyBri); EEPROM.write(2210, presetApplyBri);
EEPROM.write(2211, presetApplyCol); // was EEPROM.write(2211, presetApplyCol);
EEPROM.write(2212, presetApplyFx); // was EEPROM.write(2212, presetApplyFx);
saveCurrPresetCycConf = false; saveCurrPresetCycConf = false;
} }
@ -519,8 +519,8 @@ void loadSettingsFromEEPROM(bool first)
presetCycleMin = EEPROM.read(2208); presetCycleMin = EEPROM.read(2208);
presetCycleMax = EEPROM.read(2209); presetCycleMax = EEPROM.read(2209);
presetApplyBri = EEPROM.read(2210); presetApplyBri = EEPROM.read(2210);
presetApplyCol = EEPROM.read(2211); //was presetApplyCol = EEPROM.read(2211);
presetApplyFx = EEPROM.read(2212); //was presetApplyFx = EEPROM.read(2212);
} }
bootPreset = EEPROM.read(389); bootPreset = EEPROM.read(389);
@ -583,7 +583,7 @@ void savedToPresets()
} }
} }
bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool loadFX = true) bool applyPreset(byte index, bool loadBri = true)
{ {
if (index == 255 || index == 0) if (index == 255 || index == 0)
{ {
@ -596,22 +596,18 @@ bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool load
if (EEPROM.read(i) != 1) return false; if (EEPROM.read(i) != 1) return false;
strip.applyToAllSelected = true; strip.applyToAllSelected = true;
if (loadBri) bri = EEPROM.read(i+1); if (loadBri) bri = EEPROM.read(i+1);
if (loadCol)
for (byte j=0; j<4; j++)
{ {
for (byte j=0; j<4; j++) col[j] = EEPROM.read(i+j+2);
{ colSec[j] = EEPROM.read(i+j+6);
col[j] = EEPROM.read(i+j+2);
colSec[j] = EEPROM.read(i+j+6);
}
strip.setColor(2, EEPROM.read(i+12), EEPROM.read(i+13), EEPROM.read(i+14), EEPROM.read(i+15)); //tertiary color
}
if (loadFX)
{
effectCurrent = EEPROM.read(i+10);
effectSpeed = EEPROM.read(i+11);
effectIntensity = EEPROM.read(i+16);
effectPalette = EEPROM.read(i+17);
} }
strip.setColor(2, EEPROM.read(i+12), EEPROM.read(i+13), EEPROM.read(i+14), EEPROM.read(i+15)); //tertiary color
effectCurrent = EEPROM.read(i+10);
effectSpeed = EEPROM.read(i+11);
effectIntensity = EEPROM.read(i+16);
effectPalette = EEPROM.read(i+17);
} else { } else {
if (EEPROM.read(i) != 2) return false; if (EEPROM.read(i) != 2) return false;
strip.applyToAllSelected = false; strip.applyToAllSelected = false;

View File

@ -460,18 +460,12 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
pos = req.indexOf("PA="); //apply brightness from preset pos = req.indexOf("PA="); //apply brightness from preset
if (pos > 0) presetApplyBri = (req.charAt(pos+3) != '0'); if (pos > 0) presetApplyBri = (req.charAt(pos+3) != '0');
pos = req.indexOf("PC="); //apply color from preset
if (pos > 0) presetApplyCol = (req.charAt(pos+3) != '0');
pos = req.indexOf("PX="); //apply effects from preset
if (pos > 0) presetApplyFx = (req.charAt(pos+3) != '0');
pos = req.indexOf("PS="); //saves current in preset pos = req.indexOf("PS="); //saves current in preset
if (pos > 0) savePreset(getNumVal(&req, pos)); if (pos > 0) savePreset(getNumVal(&req, pos));
//apply preset //apply preset
if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) { if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) {
applyPreset(presetCycCurr, presetApplyBri, presetApplyCol, presetApplyFx); applyPreset(presetCycCurr, presetApplyBri);
} }
//set brightness //set brightness
@ -653,7 +647,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
pos = req.indexOf("NB="); pos = req.indexOf("NB=");
if (pos > 0) //sets backlight if (pos > 0) //sets backlight
{ {
presetApplyFx = (req.charAt(pos+3) != '0'); cronixieBacklight = (req.charAt(pos+3) != '0');
if (overlayCurrent == 3) strip.setCronixieBacklight(cronixieBacklight); if (overlayCurrent == 3) strip.setCronixieBacklight(cronixieBacklight);
overlayRefreshedTime = 0; overlayRefreshedTime = 0;
} }

View File

@ -100,7 +100,7 @@ void beginStrip()
pinMode(BTNPIN, INPUT_PULLUP); pinMode(BTNPIN, INPUT_PULLUP);
#endif #endif
if (bootPreset>0) applyPreset(bootPreset, turnOnAtBoot, true, true); if (bootPreset > 0) applyPreset(bootPreset, turnOnAtBoot);
colorUpdated(NOTIFIER_CALL_MODE_INIT); colorUpdated(NOTIFIER_CALL_MODE_INIT);
//init relay pin //init relay pin

View File

@ -251,7 +251,7 @@ void handleNightlight()
//also handle preset cycle here //also handle preset cycle here
if (presetCyclingEnabled && (millis() - presetCycledTime > presetCycleTime)) if (presetCyclingEnabled && (millis() - presetCycledTime > presetCycleTime))
{ {
applyPreset(presetCycCurr,presetApplyBri,presetApplyCol,presetApplyFx); applyPreset(presetCycCurr,presetApplyBri);
presetCycCurr++; if (presetCycCurr > presetCycleMax) presetCycCurr = presetCycleMin; presetCycCurr++; if (presetCycCurr > presetCycleMax) presetCycCurr = presetCycleMin;
if (presetCycCurr > 25) presetCycCurr = 1; if (presetCycCurr > 25) presetCycCurr = 1;
colorUpdated(NOTIFIER_CALL_MODE_PRESET_CYCLE); colorUpdated(NOTIFIER_CALL_MODE_PRESET_CYCLE);

View File

@ -97,8 +97,8 @@ void setCronixie()
case '-': dP[i] = 11; break; case '-': dP[i] = 11; break;
case 'r': dP[i] = random(1,7); break; //random btw. 1-6 case 'r': dP[i] = random(1,7); break; //random btw. 1-6
case 'R': dP[i] = random(0,10); break; //random btw. 0-9 case 'R': dP[i] = random(0,10); break; //random btw. 0-9
case 't': break; //Test upw. //case 't': break; //Test upw.
case 'T': break; //Test dnw. //case 'T': break; //Test dnw.
case 'b': dP[i] = 14 + getSameCodeLength('b',i,cronixieDisplay); i = i+dP[i]-14; break; case 'b': dP[i] = 14 + getSameCodeLength('b',i,cronixieDisplay); i = i+dP[i]-14; break;
case 'B': dP[i] = 14 + getSameCodeLength('B',i,cronixieDisplay); i = i+dP[i]-14; break; case 'B': dP[i] = 14 + getSameCodeLength('B',i,cronixieDisplay); i = i+dP[i]-14; break;
case 'h': dP[i] = 70 + getSameCodeLength('h',i,cronixieDisplay); i = i+dP[i]-70; break; case 'h': dP[i] = 70 + getSameCodeLength('h',i,cronixieDisplay); i = i+dP[i]-70; break;
@ -113,8 +113,8 @@ void setCronixie()
case 'y': dP[i] = 86 + getSameCodeLength('y',i,cronixieDisplay); i = i+dP[i]-86; break; case 'y': dP[i] = 86 + getSameCodeLength('y',i,cronixieDisplay); i = i+dP[i]-86; break;
case 'I': dP[i] = 39 + getSameCodeLength('I',i,cronixieDisplay); i = i+dP[i]-39; break; //Month. Don't ask me why month and minute both start with M. case 'I': dP[i] = 39 + getSameCodeLength('I',i,cronixieDisplay); i = i+dP[i]-39; break; //Month. Don't ask me why month and minute both start with M.
case 'i': dP[i] = 89 + getSameCodeLength('i',i,cronixieDisplay); i = i+dP[i]-89; break; case 'i': dP[i] = 89 + getSameCodeLength('i',i,cronixieDisplay); i = i+dP[i]-89; break;
case 'W': break; //case 'W': break;
case 'w': break; //case 'w': break;
case 'D': dP[i] = 43 + getSameCodeLength('D',i,cronixieDisplay); i = i+dP[i]-43; break; case 'D': dP[i] = 43 + getSameCodeLength('D',i,cronixieDisplay); i = i+dP[i]-43; break;
case 'd': dP[i] = 93 + getSameCodeLength('d',i,cronixieDisplay); i = i+dP[i]-93; break; case 'd': dP[i] = 93 + getSameCodeLength('d',i,cronixieDisplay); i = i+dP[i]-93; break;
case '0': dP[i] = 0; break; case '0': dP[i] = 0; break;
@ -127,8 +127,8 @@ void setCronixie()
case '7': dP[i] = 7; break; case '7': dP[i] = 7; break;
case '8': dP[i] = 8; break; case '8': dP[i] = 8; break;
case '9': dP[i] = 9; break; case '9': dP[i] = 9; break;
case 'V': break; //user var0 //case 'V': break; //user var0
case 'v': break; //user var1 //case 'v': break; //user var1
} }
} }
DEBUG_PRINT("result "); DEBUG_PRINT("result ");