You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposed solution:
Add another check in checkConfig(boolean init) for each config element
BEFORE:
int tempInt = atoi(config.c1);
if (validConfig.c1 != tempInt and tempInt > 0 and tempInt <= 256)
{
validConfig.c1 = tempInt;
changeColor = true;
Serial.println("Color 1 changed");
}
AFTER
int tempInt = atoi(config.c1);
if (tempInt > 0 and tempInt <= 256)
{
if(validConfig.c1 != tempInt)
{
validConfig.c1 = tempInt;
changeColor = true;
Serial.println("Color 1 changed");
}
}
else if(init) //that means the current EEPROM value is out of bounds and it is not due to user input (as checkConfig was triggered by setup() method with init=true). The condition init can also be left apart causing every misinput to set the EEPROM.
{
Serial.println("Reset c1");
itoa(validConfig.c1, config.c1, 10)
}
Occasionaly, EEPROM data is corrupt. Each config element should be checked for validity and set to a default value in case of error.
The text was updated successfully, but these errors were encountered: