mirror of https://github.com/arendst/Tasmota.git
Fix RtcNtpServer induced exception on ESP32
Fix RtcNtpServer induced exception on ESP32 (#17338)
This commit is contained in:
parent
4f70f4d33e
commit
062a2e3a7e
|
@ -404,6 +404,8 @@ NtpServer RtcChipTimeServer(PortUdp);
|
|||
void RtcChipEverySecond(void) {
|
||||
static bool ntp_server_started = false;
|
||||
|
||||
if (TasmotaGlobal.global_state.network_down) { return; } // Exception on ESP32 if network is down (#17338)
|
||||
|
||||
if (Settings->sbflag1.local_ntp_server && (Rtc.utc_time > START_VALID_TIME)) {
|
||||
if (!ntp_server_started) {
|
||||
if (RtcChipTimeServer.beginListening()) {
|
||||
|
@ -418,7 +420,7 @@ void RtcChipEverySecond(void) {
|
|||
|
||||
void CmndRtcNtpServer(void) {
|
||||
// RtcChipNtpServer 0 or 1
|
||||
if (XdrvMailbox.payload >= 0) {
|
||||
if ((XdrvMailbox.payload >= 0) && !TasmotaGlobal.global_state.network_down) {
|
||||
Settings->sbflag1.local_ntp_server = 0;
|
||||
if ((XdrvMailbox.payload &1) && RtcChipTimeServer.beginListening()) {
|
||||
Settings->sbflag1.local_ntp_server = 1;
|
||||
|
|
|
@ -584,7 +584,7 @@ void UBXSelectMode(uint16_t mode)
|
|||
UBX.mode.send_when_new = 0; // only TELE
|
||||
break;
|
||||
case 9:
|
||||
if (timeServer.beginListening()) {
|
||||
if (!TasmotaGlobal.global_state.network_down && timeServer.beginListening()) {
|
||||
UBX.mode.runningNTP = true;
|
||||
}
|
||||
break;
|
||||
|
@ -722,7 +722,7 @@ void UBXLoop50msec(void)
|
|||
}
|
||||
}
|
||||
// handle NTP-server
|
||||
if(UBX.mode.runningNTP){
|
||||
if(!TasmotaGlobal.global_state.network_down && UBX.mode.runningNTP){
|
||||
timeServer.processOneRequest(UBX.rec_buffer.values.time, UBX.state.timeOffset - NTP_MILLIS_OFFSET);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue