diff --git a/interface/src/project/Modules.tsx b/interface/src/project/Modules.tsx index 9ca592cc6..5e6a0f6ed 100644 --- a/interface/src/project/Modules.tsx +++ b/interface/src/project/Modules.tsx @@ -41,8 +41,7 @@ const Modules: FC = () => { send: fetchModules, error } = useRequest(EMSESP.readModules, { - initialData: [], - force: true + initialData: [] }); const { send: writeModules } = useRequest( @@ -128,8 +127,7 @@ const Modules: FC = () => { .catch((error: Error) => { toast.error(error.message); }) - .finally(async () => { - await fetchModules(); + .finally(() => { setNumChanges(0); }); }; diff --git a/lib/framework/FSPersistence.h b/lib/framework/FSPersistence.h index a7ad681a8..712ed1cb2 100644 --- a/lib/framework/FSPersistence.h +++ b/lib/framework/FSPersistence.h @@ -27,6 +27,7 @@ class FSPersistence { JsonObject jsonObject = jsonDocument.as(); _statefulService->updateWithoutPropagation(jsonObject, _stateUpdater); #ifdef EMSESP_DEBUG + Serial.println(); Serial.printf("Reading settings from %s ", _filePath); serializeJson(jsonDocument, Serial); Serial.println(); @@ -40,7 +41,9 @@ class FSPersistence { // If we reach here we have not been successful in loading the config, // hard-coded emergency defaults are now applied. #ifdef EMSESP_DEBUG - Serial.println("Applying defaults to " + String(_filePath)); + Serial.println(); + Serial.printf("Applying defaults to %s ", _filePath); + Serial.println(); #endif applyDefaults(); writeToFS(); // added to make sure the initial file is created @@ -72,6 +75,7 @@ class FSPersistence { // serialize the data to the file #ifdef EMSESP_DEBUG + Serial.println(); Serial.printf("Writing settings to %s ", _filePath); serializeJson(jsonDocument, Serial); Serial.println(); diff --git a/src/web/WebModulesService.cpp b/src/web/WebModulesService.cpp index b9cc9f350..c9eaa73f1 100644 --- a/src/web/WebModulesService.cpp +++ b/src/web/WebModulesService.cpp @@ -44,7 +44,9 @@ void WebModulesService::loop() { // this creates the modules file, saving it to the FS // and also calls when the Modules web page is refreshed void WebModules::read(WebModules & webModules, JsonObject root) { - // EMSESP::logger().debug("module read called"); // TODO remove +#ifdef EMSESP_DEBUG + EMSESP::logger().debug("module read called"); +#endif JsonDocument doc_modules; JsonObject root_modules = doc_modules.to(); @@ -67,7 +69,9 @@ void WebModules::read(WebModules & webModules, JsonObject root) { // and then apply the enable/disable // it's also called on a save StateUpdateResult WebModules::update(JsonObject root, WebModules & webModules) { - // EMSESP::logger().debug("module update called"); // TODO remove +#ifdef EMSESP_DEBUG + EMSESP::logger().debug("module update called"); +#endif if (root["modules"].is()) { for (const JsonObject module : root["modules"].as()) { @@ -76,7 +80,7 @@ StateUpdateResult WebModules::update(JsonObject root, WebModules & webModules) { } } - return StateUpdateResult::CHANGED; + return StateUpdateResult::CHANGED_RESTART; } } // namespace emsesp