From 2c0e1bbe57af18da6b980d6a1ca6fd2e6678f6eb Mon Sep 17 00:00:00 2001 From: tastendruecker123 <111116980+tastendruecker123@users.noreply.github.com> Date: Thu, 13 Apr 2023 17:42:54 +0200 Subject: [PATCH] Bugfixes around saving settings --- src/app.h | 4 ++++ src/appInterface.h | 1 + src/web/RestApi.h | 1 + src/web/html/api.js | 8 +++++--- src/web/html/save.html | 39 +++++++++++++++++++++++++-------------- src/web/html/setup.html | 1 + src/web/web.h | 2 +- 7 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/app.h b/src/app.h index 52f5591d..b5f30346 100644 --- a/src/app.h +++ b/src/app.h @@ -92,6 +92,10 @@ class app : public IApp, public ah::Scheduler { return mSettings.getLastSaveSucceed(); } + bool getShouldReboot() { + return mSaveReboot; + } + statistics_t *getStatistics() { return &mStat; } diff --git a/src/appInterface.h b/src/appInterface.h index 44491d91..0c67415e 100644 --- a/src/appInterface.h +++ b/src/appInterface.h @@ -20,6 +20,7 @@ class IApp { virtual bool eraseSettings(bool eraseWifi) = 0; virtual bool getSavePending() = 0; virtual bool getLastSaveSucceed() = 0; + virtual bool getShouldReboot() = 0; virtual void setOnUpdate() = 0; virtual void setRebootFlag() = 0; virtual const char *getVersion() = 0; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 2d617847..fde8c7a4 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -276,6 +276,7 @@ class RestApi { getGeneric(request, obj.createNestedObject(F("generic"))); obj["pending"] = (bool)mApp->getSavePending(); obj["success"] = (bool)mApp->getLastSaveSucceed(); + obj["reboot"] = (bool)mApp->getShouldReboot(); } void getReboot(AsyncWebServerRequest *request, JsonObject obj) { diff --git a/src/web/html/api.js b/src/web/html/api.js index 5ccb0e15..cdc9e748 100644 --- a/src/web/html/api.js +++ b/src/web/html/api.js @@ -103,9 +103,11 @@ function parseVersion(obj) { } function parseESP(obj) { - document.getElementById("esp_type").append( - document.createTextNode("Board: " + obj["esp_type"]) - ); + if(document.getElementById("esp_type").childNodes.length < 1) { + document.getElementById("esp_type").append( + document.createTextNode("Board: " + obj["esp_type"]) + ); + } } function parseRssi(obj) { diff --git a/src/web/html/save.html b/src/web/html/save.html index 54d43d7f..f3b1896d 100644 --- a/src/web/html/save.html +++ b/src/web/html/save.html @@ -8,11 +8,14 @@ {#HTML_NAV}
-
+
Saving settings...
{#HTML_FOOTER} diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 32484308..00ea8101 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -31,6 +31,7 @@
Dark Mode
+
(empty browser cache or use Shift + F5 after reboot to apply this setting)
diff --git a/src/web/web.h b/src/web/web.h index 4b7cbb39..056b9e7c 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -515,7 +515,7 @@ class Web { // pinout uint8_t pin; - for (uint8_t i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 9; i++) { pin = request->arg(String(pinArgNames[i])).toInt(); switch(i) { default: mConfig->nrf.pinCs = ((pin != 0xff) ? pin : DEF_CS_PIN); break;