diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 17c9d3e2c..ea7e43ba7 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -1601,7 +1601,7 @@ void EMSESP::start() { // start the file system #ifndef EMSESP_STANDALONE if (!LittleFS.begin(true)) { - Serial.println("LittleFS Mount Failed. Using default settings."); + LOG_INFO("LittleFS Mount Failed. Using default settings."); return; } #endif @@ -1612,9 +1612,7 @@ void EMSESP::start() { File root = LittleFS.open("/config"); bool factory_settings = !root; if (!root) { -#if defined(EMSESP_DEBUG) - Serial.println("No config found, assuming factory settings"); -#endif + LOG_INFO("No config found, assuming factory settings"); } root.close(); #else @@ -1644,8 +1642,6 @@ void EMSESP::start() { system_.system_restart(); }; - - webSettingsService.begin(); // load EMS-ESP Application settings... // do any system upgrades diff --git a/src/system.cpp b/src/system.cpp index 01d60ba81..24acc2daf 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -1170,7 +1170,7 @@ bool System::check_upgrade(bool factory_settings) { // see if we're missing a version, will be < 3.5.0b13 from Dec 23 2022 missing_version = (settingsVersion.empty() || (settingsVersion.length() < 5)); if (missing_version) { - LOG_WARNING("No version information found (%s)", settingsVersion.c_str()); + LOG_WARNING("No version information found"); settingsVersion = "3.5.0"; // this was the last stable version without version info } } @@ -1200,13 +1200,13 @@ bool System::check_upgrade(bool factory_settings) { // if we're coming from 3.4.4 or 3.5.0b14 which had no version stored then we need to apply new settings if (missing_version) { - LOG_INFO("Setting MQTT Entity ID format to v3.4 format"); + LOG_INFO("Upgrade: Setting MQTT Entity ID format to v3.4 format"); EMSESP::esp8266React.getMqttSettingsService()->update([&](MqttSettings & mqttSettings) { mqttSettings.entity_format = 0; // use old Entity ID format from v3.4 return StateUpdateResult::CHANGED; }); } else if (settings_version.major() == 3 && settings_version.minor() <= 6) { - LOG_INFO("Setting MQTT Entity ID format to v3.6 format"); + LOG_INFO("Upgrade: Setting MQTT Entity ID format to v3.6 format"); EMSESP::esp8266React.getMqttSettingsService()->update([&](MqttSettings & mqttSettings) { if (mqttSettings.entity_format == 1) { mqttSettings.entity_format = 3; // use old Entity ID format from v3.6 @@ -1223,7 +1223,7 @@ bool System::check_upgrade(bool factory_settings) { EMSESP::esp8266React.getNetworkSettingsService()->update([&](NetworkSettings & networkSettings) { if (networkSettings.tx_power == 20) { networkSettings.tx_power = WIFI_POWER_19_5dBm; // use 19.5 as we don't have 20 anymore - LOG_INFO("Setting WiFi TX Power to Auto"); + LOG_INFO("Upgrade: Setting WiFi TX Power to Auto"); return StateUpdateResult::CHANGED; } return StateUpdateResult::UNCHANGED; @@ -1237,7 +1237,7 @@ bool System::check_upgrade(bool factory_settings) { save_version = false; } - // if we did a change, set the new version and reboot + // if we did a change, set the new version and save it, then reboot if (save_version) { EMSESP::webSettingsService.update([&](WebSettings & settings) { settings.version = EMSESP_APP_VERSION; diff --git a/src/web/WebSettingsService.cpp b/src/web/WebSettingsService.cpp index e3fbd997e..054947c61 100644 --- a/src/web/WebSettingsService.cpp +++ b/src/web/WebSettingsService.cpp @@ -32,6 +32,7 @@ WebSettingsService::WebSettingsService(AsyncWebServer * server, FS * fs, Securit } void WebSettings::read(WebSettings & settings, JsonObject root) { + root["version"] = settings.version; root["locale"] = settings.locale; root["tx_mode"] = settings.tx_mode; root["ems_bus_id"] = settings.ems_bus_id;