Fix for blank config.json

This commit is contained in:
fvanroie 2020-04-12 17:05:54 +02:00
parent 65de337902
commit cfaa08906d

View File

@ -172,54 +172,57 @@ void configWriteConfig()
bool changed = false;
#if HASP_USE_WIFI
changed = wifiGetConfig(settings[F("wifi")]);
changed = wifiGetConfig(settings[F("wifi")].to<JsonObject>());
if(changed) {
Log.verbose(F("WIFI: Settings changed"));
writefile = true;
}
#if HASP_USE_MQTT
changed = mqttGetConfig(settings[F("mqtt")]);
changed = mqttGetConfig(settings[F("mqtt")].to<JsonObject>());
if(changed) {
Log.verbose(F("MQTT: Settings changed"));
configOutput(settings[F("mqtt")]);
writefile = true;
}
#endif
#if HASP_USE_TELNET
changed = telnetGetConfig(settings[F("telnet")]);
changed = telnetGetConfig(settings[F("telnet")].to<JsonObject>());
if(changed) {
Log.verbose(F("TELNET: Settings changed"));
configOutput(settings[F("telnet")]);
writefile = true;
}
#endif
#if HASP_USE_MDNS
changed = mdnsGetConfig(settings[F("mdns")]);
changed = mdnsGetConfig(settings[F("mdns")].to<JsonObject>());
if(changed) {
Log.verbose(F("MDNS: Settings changed"));
writefile = true;
}
#endif
#if HASP_USE_HTTP
changed = httpGetConfig(settings[F("http")]);
changed = httpGetConfig(settings[F("http")].to<JsonObject>());
if(changed) {
Log.verbose(F("HTTP: Settings changed"));
configOutput(settings[F("http")]);
writefile = true;
}
#endif
#endif
changed = debugGetConfig(settings[F("debug")]);
changed = debugGetConfig(settings[F("debug")].to<JsonObject>());
if(changed) {
Log.verbose(F("DEBUG: Settings changed"));
writefile = true;
}
changed = guiGetConfig(settings[F("gui")]);
changed = guiGetConfig(settings[F("gui")].to<JsonObject>());
if(changed) {
Log.verbose(F("GUI: Settings changed"));
writefile = true;
}
changed = haspGetConfig(settings[F("hasp")]);
changed = haspGetConfig(settings[F("hasp")].to<JsonObject>());
if(changed) {
Log.verbose(F("HASP: Settings changed"));
writefile = true;
@ -235,7 +238,7 @@ void configWriteConfig()
file.close();
if(size > 0) {
Log.verbose(F("CONF: [SUCCESS] Saved %s"), configFile.c_str());
configBackupToEeprom();
// configBackupToEeprom();
return;
}
}