mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-13 23:45:25 +00:00
Clear debug config on setup if not already set
This commit is contained in:
parent
7412ba2697
commit
13bbc81b7f
@ -220,6 +220,7 @@ bool AmsConfiguration::getDebugConfig(DebugConfig& config) {
|
||||
EEPROM.end();
|
||||
return true;
|
||||
} else {
|
||||
clearDebug(config);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -232,6 +233,12 @@ bool AmsConfiguration::setDebugConfig(DebugConfig& config) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AmsConfiguration::clearDebug(DebugConfig& config) {
|
||||
config.level = 5;
|
||||
config.telnet = false;
|
||||
config.serial = false;
|
||||
}
|
||||
|
||||
bool AmsConfiguration::getDomoticzConfig(DomoticzConfig& config) {
|
||||
if(hasConfig()) {
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
|
||||
@ -286,6 +286,7 @@ public:
|
||||
|
||||
bool getDebugConfig(DebugConfig&);
|
||||
bool setDebugConfig(DebugConfig&);
|
||||
void clearDebug(DebugConfig&);
|
||||
|
||||
bool pinUsed(uint8_t, GpioConfig&);
|
||||
|
||||
|
||||
@ -741,6 +741,9 @@ void AmsWebServer::handleSetup() {
|
||||
} else {
|
||||
SystemConfig sys { server.arg("board").toInt() };
|
||||
|
||||
DebugConfig debugConfig;
|
||||
config->getDebugConfig(debugConfig);
|
||||
|
||||
config->clear();
|
||||
|
||||
config->clearGpio(*gpioConfig);
|
||||
@ -882,6 +885,8 @@ void AmsWebServer::handleSetup() {
|
||||
success = false;
|
||||
}
|
||||
|
||||
config->setDebugConfig(debugConfig);
|
||||
|
||||
if(success && config->save()) {
|
||||
performRestart = true;
|
||||
server.sendHeader("Location","/restart-wait");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user