From 5f971cfee3c769ea43733be7964b9855705be6e2 Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Wed, 22 Nov 2023 16:26:57 +0100 Subject: [PATCH] Fix timezone offset saving --- src/lib/webserver.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/webserver.cpp b/src/lib/webserver.cpp index f0f135a..f4ffa51 100644 --- a/src/lib/webserver.cpp +++ b/src/lib/webserver.cpp @@ -313,7 +313,7 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json) } } - String uintSettings[] = {"minSecPriceUpd", "fullRefreshMin", "gmtOffset", "ledBrightness", "mcapBigChar"}; + String uintSettings[] = {"minSecPriceUpd", "fullRefreshMin", "ledBrightness", "mcapBigChar"}; for (String setting : uintSettings) { @@ -324,6 +324,14 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json) } } + + if (settings.containsKey("tzOffset")) + { + int gmtOffset = settings["tzOffset"].as() * 60; + size_t written = preferences.putInt("gmtOffset", gmtOffset); + Serial.printf("Setting %s to %d (%d minutes, written %d)\r\n", "gmtOffset", gmtOffset, settings["tzOffset"].as(), written); + } + String boolSettings[] = {"fetchEurPrice", "ledTestOnPower", "ledFlashOnUpd", "mdnsEnabled", "otaEnabled", "stealFocus", "mcapBigChar"}; for (String setting : boolSettings)