|
@ -19,6 +19,10 @@ void ntpConnect() { |
|
|
NTP.setInterval(NTP_UPDATE_INTERVAL); |
|
|
NTP.setInterval(NTP_UPDATE_INTERVAL); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool ntpConnected() { |
|
|
|
|
|
return (timeStatus() == timeSet); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void ntpSetup() { |
|
|
void ntpSetup() { |
|
|
|
|
|
|
|
|
NTP.onNTPSyncEvent([](NTPSyncEvent_t error) { |
|
|
NTP.onNTPSyncEvent([](NTPSyncEvent_t error) { |
|
@ -28,8 +32,10 @@ void ntpSetup() { |
|
|
} else if (error == invalidAddress) { |
|
|
} else if (error == invalidAddress) { |
|
|
DEBUG_MSG_P(PSTR("[NTP] Error: Invalid NTP server address\n")); |
|
|
DEBUG_MSG_P(PSTR("[NTP] Error: Invalid NTP server address\n")); |
|
|
} |
|
|
} |
|
|
|
|
|
wsSend("{\"ntpStatus\": false}"); |
|
|
} else { |
|
|
} else { |
|
|
DEBUG_MSG_P(PSTR("[NTP] Time: %s\n"), (char *) NTP.getTimeDateString(NTP.getLastNTPSync()).c_str()); |
|
|
DEBUG_MSG_P(PSTR("[NTP] Time: %s\n"), (char *) NTP.getTimeDateString(NTP.getLastNTPSync()).c_str()); |
|
|
|
|
|
wsSend("{\"ntpStatus\": true}"); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|