|
@ -156,7 +156,8 @@ void handleSave() { |
|
|
Serial.println(F("[WEBSERVER] Request: /save")); |
|
|
Serial.println(F("[WEBSERVER] Request: /save")); |
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
bool disconnectMQTT = false; |
|
|
|
|
|
|
|
|
bool dirty = false; |
|
|
|
|
|
bool dirtyMQTT = false; |
|
|
|
|
|
|
|
|
for (unsigned int i=0; i<server.args(); i++) { |
|
|
for (unsigned int i=0; i<server.args(); i++) { |
|
|
|
|
|
|
|
@ -172,18 +173,17 @@ void handleSave() { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Check wether we will have to reconfigure MQTT connection
|
|
|
|
|
|
if (!disconnectMQTT && key.startsWith("mqtt")) { |
|
|
|
|
|
if (value != getSetting(key)) disconnectMQTT = true; |
|
|
|
|
|
|
|
|
if (value != getSetting(key)) { |
|
|
|
|
|
setSetting(key, value); |
|
|
|
|
|
dirty = true; |
|
|
|
|
|
if (key.startsWith("mqtt")) dirtyMQTT = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (value != getSetting(key)) setSetting(key, value); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
server.send(202, "text/json", "{}"); |
|
|
server.send(202, "text/json", "{}"); |
|
|
|
|
|
|
|
|
saveSettings(); |
|
|
|
|
|
|
|
|
if (dirty) saveSettings(); |
|
|
|
|
|
|
|
|
#if ENABLE_RF
|
|
|
#if ENABLE_RF
|
|
|
rfBuildCodes(); |
|
|
rfBuildCodes(); |
|
@ -199,7 +199,7 @@ void handleSave() { |
|
|
wifiDisconnect(); |
|
|
wifiDisconnect(); |
|
|
|
|
|
|
|
|
// else check if we should reconigure MQTT connection
|
|
|
// else check if we should reconigure MQTT connection
|
|
|
} else if (disconnectMQTT) { |
|
|
|
|
|
|
|
|
} else if (dirtyMQTT) { |
|
|
mqttDisconnect(); |
|
|
mqttDisconnect(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|