2nd fix issue #781

This commit is contained in:
cyberman54 2021-04-07 20:20:31 +02:00
parent 5c5752805b
commit c00612ad76

View File

@ -97,8 +97,8 @@ void IRAM_ATTR setMyTime(uint32_t t_sec, uint16_t t_msec,
vTaskDelay(pdMS_TO_TICKS(1000 - t_msec % 1000)); vTaskDelay(pdMS_TO_TICKS(1000 - t_msec % 1000));
} }
ESP_LOGI(TAG, "[%0.3f] UTC time: %d.%03d sec", _seconds(), ESP_LOGI(TAG, "[%0.3f] UTC time: %d.%03d sec", _seconds(), time_to_set,
time_to_set, t_msec % 1000); t_msec % 1000);
// if we have got an external timesource, set RTC time and shift RTC_INT pulse // if we have got an external timesource, set RTC time and shift RTC_INT pulse
// to top of second // to top of second
@ -107,11 +107,11 @@ void IRAM_ATTR setMyTime(uint32_t t_sec, uint16_t t_msec,
set_rtctime(time_to_set); set_rtctime(time_to_set);
#endif #endif
// if we have a software pps timer, shift it to top of second // if we have a software pps timer, shift it to top of second
#if (!defined GPS_INT && !defined RTC_INT) if (ppsIRQ != NULL) {
timerWrite(ppsIRQ, 0); // reset pps timer timerWrite(ppsIRQ, 0); // reset pps timer
CLOCKIRQ(); // fire clock pps, this advances time 1 sec CLOCKIRQ(); // fire clock pps, this advances time 1 sec
#endif }
setTime(time_to_set); // set the time on top of second setTime(time_to_set); // set the time on top of second
@ -122,8 +122,11 @@ void IRAM_ATTR setMyTime(uint32_t t_sec, uint16_t t_msec,
} else { } else {
timesyncer.attach(TIME_SYNC_INTERVAL_RETRY * 60, setTimeSyncIRQ); timesyncer.attach(TIME_SYNC_INTERVAL_RETRY * 60, setTimeSyncIRQ);
time_t unix_sec_at_compilation = compiledUTC(); time_t unix_sec_at_compilation = compiledUTC();
ESP_LOGD(TAG, "[%0.3f] Failed to synchronise time from source %c | unix sec obtained from source: %d | unix sec at program compilation: %d", ESP_LOGD(TAG,
_seconds(), timeSetSymbols[mytimesource], time_to_set, unix_sec_at_compilation); "[%0.3f] Failed to synchronise time from source %c | unix sec "
"obtained from source: %d | unix sec at program compilation: %d",
_seconds(), timeSetSymbols[mytimesource], time_to_set,
unix_sec_at_compilation);
} }
} }