Added a timeout of 5ms to detect current time.
This prevents false positives when a interrupt occours during the reading of the time
This commit is contained in:
parent
83acba323f
commit
dd7babb448
@ -14,7 +14,7 @@ HM_Abstract::HM_Abstract(uint64_t serial)
|
||||
bool HM_Abstract::sendStatsRequest(HoymilesRadio* radio)
|
||||
{
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ bool HM_Abstract::sendStatsRequest(HoymilesRadio* radio)
|
||||
bool HM_Abstract::sendAlarmLogRequest(HoymilesRadio* radio, bool force)
|
||||
{
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ bool HM_Abstract::sendAlarmLogRequest(HoymilesRadio* radio, bool force)
|
||||
bool HM_Abstract::sendDevInfoRequest(HoymilesRadio* radio)
|
||||
{
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ bool HM_Abstract::sendDevInfoRequest(HoymilesRadio* radio)
|
||||
bool HM_Abstract::sendSystemConfigParaRequest(HoymilesRadio* radio)
|
||||
{
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ void WebApiNtpClass::onNtpStatus(AsyncWebServerRequest* request)
|
||||
root[F("ntp_timezone_descr")] = config.Ntp_TimezoneDescr;
|
||||
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
root[F("ntp_status")] = false;
|
||||
} else {
|
||||
root[F("ntp_status")] = true;
|
||||
@ -159,7 +159,7 @@ void WebApiNtpClass::onNtpTimeGet(AsyncWebServerRequest* request)
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
root[F("ntp_status")] = false;
|
||||
} else {
|
||||
root[F("ntp_status")] = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user