From 29c5881cf04d62af04fd71e4c08ebb6d8014a002 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 8 Sep 2024 15:44:13 +0200 Subject: [PATCH] fix error when checking for FS. re-order events for cleaner logging --- src/emsesp.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/emsesp.cpp b/src/emsesp.cpp index bcb020c94..3c89f43d0 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -1561,18 +1561,18 @@ void EMSESP::start() { // start the file system #ifndef EMSESP_STANDALONE if (!LittleFS.begin(true)) { - LOG_INFO("LittleFS Mount Failed. Using default settings."); + LOG_ERROR("LittleFS Mount Failed"); return; } #endif -// do a quick scan of the filesystem to see if we have a /config folder -// so we know if this is a new install or not +// do a quick scan of the filesystem to see if we a settings file in the /config folder +// so we know if this is a new factory install or not #ifndef EMSESP_STANDALONE - File root = LittleFS.open(EMSESP_FS_CONFIG_DIRECTORY); + File root = LittleFS.open(EMSESP_SETTINGS_FILE); bool factory_settings = !root; if (!root) { - LOG_INFO("No config found, assuming factory settings"); + LOG_WARNING("No settings found on filesystem. Using factory settings."); } root.close(); #else @@ -1583,11 +1583,6 @@ void EMSESP::start() { esp8266React.begin(); // loads core system services settings (network, mqtt, ap, ntp etc) - if (!nvs_.begin("ems-esp", false, "nvs1")) { // try bigger nvs partition on 16M flash first - nvs_.begin("ems-esp", false, "nvs"); // fallback to small nvs - } - LOG_DEBUG("NVS device information: %s", system_.getBBQKeesGatewayDetails().c_str()); - #ifndef EMSESP_STANDALONE LOG_INFO("Booting EMS-ESP version %s from %s partition", EMSESP_APP_VERSION, esp_ota_get_running_partition()->label); // welcome message #else @@ -1602,6 +1597,11 @@ void EMSESP::start() { system_.system_restart(); }; + if (!nvs_.begin("ems-esp", false, "nvs1")) { // try bigger nvs partition on 16M flash first + nvs_.begin("ems-esp", false, "nvs"); // fallback to small nvs + } + LOG_DEBUG("NVS device information: %s", system_.getBBQKeesGatewayDetails().c_str()); + webSettingsService.begin(); // load EMS-ESP Application settings... // do any system upgrades