Fix for negative timezone offsets
This commit is contained in:
parent
a1c5d8a579
commit
f6796fa448
@ -93,12 +93,12 @@ void setupComponents()
|
|||||||
|
|
||||||
void synchronizeTime()
|
void synchronizeTime()
|
||||||
{
|
{
|
||||||
configTime(preferences.getUInt("gmtOffset", TIME_OFFSET_SECONDS), 0, NTP_SERVER);
|
configTime(preferences.getInt("gmtOffset", TIME_OFFSET_SECONDS), 0, NTP_SERVER);
|
||||||
struct tm timeinfo;
|
struct tm timeinfo;
|
||||||
|
|
||||||
while (!getLocalTime(&timeinfo))
|
while (!getLocalTime(&timeinfo))
|
||||||
{
|
{
|
||||||
configTime(preferences.getUInt("gmtOffset", TIME_OFFSET_SECONDS), 0, NTP_SERVER);
|
configTime(preferences.getInt("gmtOffset", TIME_OFFSET_SECONDS), 0, NTP_SERVER);
|
||||||
delay(500);
|
delay(500);
|
||||||
Serial.println("Retry set time");
|
Serial.println("Retry set time");
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,9 @@ void setupWebserver()
|
|||||||
// Initialize SPIFFS
|
// Initialize SPIFFS
|
||||||
if (!SPIFFS.begin(true))
|
if (!SPIFFS.begin(true))
|
||||||
{
|
{
|
||||||
|
pinMode(47, OUTPUT);
|
||||||
|
digitalWrite(47, HIGH);
|
||||||
|
|
||||||
Serial.println("An Error has occurred while mounting SPIFFS");
|
Serial.println("An Error has occurred while mounting SPIFFS");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -142,7 +145,7 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
|
|||||||
root["bgColor"] = getBgColor();
|
root["bgColor"] = getBgColor();
|
||||||
root["timerSeconds"] = timerSeconds;
|
root["timerSeconds"] = timerSeconds;
|
||||||
root["timerRunning"] = timerRunning;
|
root["timerRunning"] = timerRunning;
|
||||||
root["tzOffset"] = preferences.getUInt("gmtOffset", TIME_OFFSET_SECONDS) / 60;
|
root["tzOffset"] = preferences.getInt("gmtOffset", TIME_OFFSET_SECONDS) / 60;
|
||||||
root["useBitcoinNode"] = preferences.getBool("useNode", false);
|
root["useBitcoinNode"] = preferences.getBool("useNode", false);
|
||||||
root["rpcPort"] = preferences.getUInt("rpcPort", BITCOIND_PORT);
|
root["rpcPort"] = preferences.getUInt("rpcPort", BITCOIND_PORT);
|
||||||
root["rpcUser"] = preferences.getString("rpcUser", BITCOIND_RPC_USER);
|
root["rpcUser"] = preferences.getString("rpcUser", BITCOIND_RPC_USER);
|
||||||
@ -245,7 +248,9 @@ void onApiSettingsPost(AsyncWebServerRequest *request)
|
|||||||
{
|
{
|
||||||
AsyncWebParameter *p = request->getParam("tzOffset", true);
|
AsyncWebParameter *p = request->getParam("tzOffset", true);
|
||||||
int tzOffsetSeconds = p->value().toInt() * 60;
|
int tzOffsetSeconds = p->value().toInt() * 60;
|
||||||
preferences.putUInt("tzOffset", tzOffsetSeconds);
|
preferences.putInt("gmtOffset", tzOffsetSeconds);
|
||||||
|
Serial.print("Setting tz offset to ");
|
||||||
|
Serial.println(tzOffsetSeconds);
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user