From 4a8ad71b63206676dafb62fe6d4dc2b119b8ba4c Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 1 Aug 2026 17:03:15 +0200 Subject: [PATCH] auto-formatting --- src/core/system.cpp | 3 +-- src/web/WebCustomEntityService.cpp | 8 ++++---- src/web/WebDataService.cpp | 22 +++++++++++----------- src/web/WebSchedulerService.cpp | 2 +- src/web/WebSettingsService.h | 4 ++-- src/web/WebStatusService.cpp | 4 ++-- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index f23dc664e..06a75a831 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -677,7 +677,7 @@ void System::store_settings(WebSettings & settings) { locale_ = settings.locale; system_name_ = settings.system_name; developer_mode_ = settings.developer_mode; - disable_reset_ = settings.disable_reset; + disable_reset_ = settings.disable_reset; } // Starts up core services @@ -2876,7 +2876,6 @@ bool System::command_txpause(const char * value, const int8_t id) { // format command - factory reset, removing all config files bool System::command_format(const char * value, const int8_t id) { - if (EMSESP::system_.disable_reset()) { LOG_NOTICE("Factory reset disabled"); return false; diff --git a/src/web/WebCustomEntityService.cpp b/src/web/WebCustomEntityService.cpp index 3d2de59bd..e3693a256 100644 --- a/src/web/WebCustomEntityService.cpp +++ b/src/web/WebCustomEntityService.cpp @@ -417,10 +417,10 @@ std::string WebCustomEntityService::get_metrics_prometheus() { // build the json for specific entity void WebCustomEntityService::get_value_json(JsonObject output, CustomEntityItem const & entity) { - output["name"] = (const char *)entity.name; - output["fullname"] = (const char *)entity.name; - output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems"; - output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number); + output["name"] = (const char *)entity.name; + output["fullname"] = (const char *)entity.name; + output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems"; + output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number); output["readable"] = true; output["writeable"] = entity.writeable; output["visible"] = true; diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index 1c29ff719..36c82814c 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -64,17 +64,17 @@ void WebDataService::core_data(AsyncWebServerRequest * request) { // list is already sorted by device type JsonArray devices = root["devices"].to(); for (const auto & emsdevice : EMSESP::emsdevices) { - JsonObject obj = devices.add(); - obj["id"] = emsdevice->unique_id(); // a unique id - obj["tn"] = emsdevice->device_type_2_device_name_translated(); // translated device type name - obj["t"] = emsdevice->device_type(); // device type number - obj["b"] = emsdevice->brand_to_char(); // brand (std::string → copied into doc, safe across async serialize) - obj["n"] = emsdevice->name(); // custom name - obj["d"] = emsdevice->device_id(); // deviceid - obj["p"] = emsdevice->product_id(); // productid - obj["v"] = emsdevice->version(); // version - obj["e"] = emsdevice->count_entities(); // number of entities - obj["url"] = emsdevice->device_type_name(); // non-translated, lower-case, used for API URL in customization page + JsonObject obj = devices.add(); + obj["id"] = emsdevice->unique_id(); // a unique id + obj["tn"] = emsdevice->device_type_2_device_name_translated(); // translated device type name + obj["t"] = emsdevice->device_type(); // device type number + obj["b"] = emsdevice->brand_to_char(); // brand (std::string → copied into doc, safe across async serialize) + obj["n"] = emsdevice->name(); // custom name + obj["d"] = emsdevice->device_id(); // deviceid + obj["p"] = emsdevice->product_id(); // productid + obj["v"] = emsdevice->version(); // version + obj["e"] = emsdevice->count_entities(); // number of entities + obj["url"] = emsdevice->device_type_name(); // non-translated, lower-case, used for API URL in customization page } // add any custom entities diff --git a/src/web/WebSchedulerService.cpp b/src/web/WebSchedulerService.cpp index ab816d09e..e9075509d 100644 --- a/src/web/WebSchedulerService.cpp +++ b/src/web/WebSchedulerService.cpp @@ -213,7 +213,7 @@ void WebSchedulerService::get_value_json(JsonObject output, const ScheduleItem & } else { output["time"] = scheduleItem.time; } - output["cmd_name"] = scheduleItem.cmd_name; + output["cmd_name"] = scheduleItem.cmd_name; output["readable"] = true; output["writeable"] = true; output["visible"] = true; diff --git a/src/web/WebSettingsService.h b/src/web/WebSettingsService.h index a8366253a..d8a600f81 100644 --- a/src/web/WebSettingsService.h +++ b/src/web/WebSettingsService.h @@ -121,8 +121,8 @@ class WebSettings { uint8_t eth_clock_mode; bool developer_mode; // developer mode - bool disable_reset; // disable reset - + bool disable_reset; // disable reset + static void read(WebSettings & settings, JsonObject root); static StateUpdateResult update(JsonObject root, WebSettings & settings); diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index 133fe2efc..19c8d6315 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -172,8 +172,8 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) { } root["developer_mode"] = EMSESP::system_.developer_mode(); - root["disable_reset"] = EMSESP::system_.disable_reset(); - + root["disable_reset"] = EMSESP::system_.disable_reset(); + // Also used in SystemMonitor.tsx root["status"] = EMSESP::system_.systemStatus(); // send the status. See System.h for status codes if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_PENDING_RESTART) {