mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-18 08:11:55 +01:00
Compute sunrise and sunset only if necessary.
Sunrise and -set must recomputed if one of the following conditions is met: * The date changed (based on the selected timezone) * Location (Lat/Lon) changed * Sunset type changed So instead of calculating that every minute just do it on update via web interface or date change. If a new config is uploaded, the DTU gets restarted. There is no need to initiate a recalculation in this case.
This commit is contained in:
@@ -190,6 +190,8 @@ void WebApiNtpClass::onNtpAdminPost(AsyncWebServerRequest* request)
|
||||
|
||||
NtpSettings.setServer();
|
||||
NtpSettings.setTimezone();
|
||||
|
||||
SunPosition.setDoRecalc(true);
|
||||
}
|
||||
|
||||
void WebApiNtpClass::onNtpTimeGet(AsyncWebServerRequest* request)
|
||||
@@ -350,4 +352,4 @@ void WebApiNtpClass::onNtpTimePost(AsyncWebServerRequest* request)
|
||||
|
||||
response->setLength();
|
||||
request->send(response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user