fix error when checking for FS. re-order events for cleaner logging

This commit is contained in:
proddy
2024-09-08 15:44:13 +02:00
parent 195c889e17
commit 29c5881cf0

View File

@@ -1561,18 +1561,18 @@ void EMSESP::start() {
// start the file system // start the file system
#ifndef EMSESP_STANDALONE #ifndef EMSESP_STANDALONE
if (!LittleFS.begin(true)) { if (!LittleFS.begin(true)) {
LOG_INFO("LittleFS Mount Failed. Using default settings."); LOG_ERROR("LittleFS Mount Failed");
return; return;
} }
#endif #endif
// do a quick scan of the filesystem to see if we have a /config folder // 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 install or not // so we know if this is a new factory install or not
#ifndef EMSESP_STANDALONE #ifndef EMSESP_STANDALONE
File root = LittleFS.open(EMSESP_FS_CONFIG_DIRECTORY); File root = LittleFS.open(EMSESP_SETTINGS_FILE);
bool factory_settings = !root; bool factory_settings = !root;
if (!root) { if (!root) {
LOG_INFO("No config found, assuming factory settings"); LOG_WARNING("No settings found on filesystem. Using factory settings.");
} }
root.close(); root.close();
#else #else
@@ -1583,11 +1583,6 @@ void EMSESP::start() {
esp8266React.begin(); // loads core system services settings (network, mqtt, ap, ntp etc) 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 #ifndef EMSESP_STANDALONE
LOG_INFO("Booting EMS-ESP version %s from %s partition", EMSESP_APP_VERSION, esp_ota_get_running_partition()->label); // welcome message LOG_INFO("Booting EMS-ESP version %s from %s partition", EMSESP_APP_VERSION, esp_ota_get_running_partition()->label); // welcome message
#else #else
@@ -1602,6 +1597,11 @@ void EMSESP::start() {
system_.system_restart(); 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... webSettingsService.begin(); // load EMS-ESP Application settings...
// do any system upgrades // do any system upgrades