From bb19e7102e73931a1b0e031a2c0dc165c7c14fb0 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 27 Sep 2026 15:47:54 +0200 Subject: [PATCH] copy over 3.9.0-dev optimizations to load pre_load.json faster without boot --- src/core/emsesp.cpp | 17 +++++++++-------- src/core/system.cpp | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/core/emsesp.cpp b/src/core/emsesp.cpp index bb35e87fa..b6b615bb8 100644 --- a/src/core/emsesp.cpp +++ b/src/core/emsesp.cpp @@ -1726,6 +1726,15 @@ void EMSESP::start() { // start web log service. now we can start capturing logs to the web log webLogService.begin(); +#ifndef EMSESP_STANDALONE + // apply any uploaded settings before any service loads them from the filesystem + if (system_.check_restore()) { + root = LittleFS.open(EMSESP_SETTINGS_FILE); + factory_settings = !root; + root.close(); + } +#endif + // loads core system services settings (network, mqtt, ap, ntp etc) esp32React.begin(); @@ -1773,14 +1782,6 @@ void EMSESP::start() { LOG_INFO("Last system reset reason Core0: %s, Core1: %s", system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str()); #endif - // see if we're restoring a settings file -#ifndef EMSESP_STANDALONE - if (system_.check_restore()) { - LOG_WARNING("EMS-ESP will restart to apply new settings. Please wait."); - system_.system_restart(); - }; -#endif - LOG_DEBUG("eFuse device information: %s", system_.getBBQKeesGatewayDetails().isEmpty() ? "not set" : system_.getBBQKeesGatewayDetails().c_str()); webSettingsService.begin(); // load EMS-ESP Application settings diff --git a/src/core/system.cpp b/src/core/system.cpp index cb3dd1025..53666b9d9 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -451,7 +451,7 @@ void System::system_restart(const char * partitionname) { EMSuart::stop(); // stop UART so there is no interference #ifndef EMSESP_STANDALONE - delay(1000); // wait 1 second + delay(500); // wait 0.5 second ESP.restart(); // ka-boom! - this is the only place where the ESP32 restart is called #endif }