diff --git a/wled00/ntp.cpp b/wled00/ntp.cpp index 3787c7a49..c615d59c7 100644 --- a/wled00/ntp.cpp +++ b/wled00/ntp.cpp @@ -264,7 +264,7 @@ void checkTimers() lastTimerMinute = minute(localTime); // calculate sunrise and sunset at midnight (if longitude and latitude are set) - if (((int)longitude || (int)latitude) /*&& ((!hour(localTime) && !minute(localTime)) || (!sunrise && !sunset))*/) { + if (((int)longitude || (int)latitude) && ((!hour(localTime) && !minute(localTime)) || (!sunrise && !sunset))) { struct tm tim_0; tim_0.tm_year = year(localTime)-1900; tim_0.tm_mon = month(localTime)-1; diff --git a/wled00/set.cpp b/wled00/set.cpp index 46183a97a..294357ad6 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -296,6 +296,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) if (ntpEnabled && WLED_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort); longitude = request->arg(F("LN")).toFloat(); latitude = request->arg(F("LT")).toFloat(); + // force a sunrise/sunset re-calculation + sunrise = sunset =0; if (request->hasArg(F("OL"))) { overlayDefault = request->arg(F("OL")).toInt(); diff --git a/wled00/wled.h b/wled00/wled.h index a2200e403..69cbeb6cd 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2103081 +#define VERSION 2103082 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 47d20639a..cfe43fe61 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -451,7 +451,7 @@ void getSettingsJS(byte subPage, char* dest) sappends('s',SET_F("LT"),tm); getTimeString(tm); sappends('m',SET_F("(\"times\")[0]"),tm); - if ((int)longitude || (int)latitude) { + if ((int)(longitude*10) || (int)(latitude*10)) { sprintf_P(tm, PSTR("Sunrise: %02d:%02d Sunset: %02d:%02d"), hour(sunrise), minute(sunrise), hour(sunset), minute(sunset)); sappends('m',SET_F("(\"times\")[1]"),tm); }