mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-10 15:36:38 +02:00
fix #56
This commit is contained in:
parent
df5a306bb2
commit
247ae3e1db
4 changed files with 20 additions and 21 deletions
|
@ -106,11 +106,16 @@ void app::setup(uint32_t timeout) {
|
|||
|
||||
char addr[16] = {0};
|
||||
sprintf(addr, "%d.%d.%d.%d", mqttAddr[0], mqttAddr[1], mqttAddr[2], mqttAddr[3]);
|
||||
mMqttActive = (mqttAddr[0] > 0);
|
||||
|
||||
if(mqttAddr[0] > 0) {
|
||||
mMqttActive = true;
|
||||
if(mMqttInterval < 1)
|
||||
mMqttInterval = 1;
|
||||
}
|
||||
else
|
||||
mMqttInterval = 0xffff;
|
||||
|
||||
|
||||
if(mMqttInterval < 1)
|
||||
mMqttInterval = 1;
|
||||
mMqtt.setup(addr, mqttTopic, mqttUser, mqttPwd, mqttPort);
|
||||
mMqttTicker = 0;
|
||||
|
||||
|
@ -118,6 +123,15 @@ void app::setup(uint32_t timeout) {
|
|||
|
||||
mMqtt.sendMsg("version", mVersion);
|
||||
}
|
||||
else {
|
||||
DPRINTLN(F("Settings not valid, erasing ..."));
|
||||
eraseSettings();
|
||||
saveValues(false);
|
||||
delay(100);
|
||||
DPRINTLN(F("... restarting ..."));
|
||||
delay(100);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
mSys->setup();
|
||||
|
||||
|
@ -731,6 +745,7 @@ void app::saveValues(bool webSend = true) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
updateCrc();
|
||||
mWeb->send(200, F("text/html"), F("<!doctype html><html><head><title>Error</title><meta http-equiv=\"refresh\" content=\"3; URL=/setup\"></head><body>"
|
||||
"<p>Error while saving</p></body></html>"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue