paxcounter.conf: added time sync retry setting

This commit is contained in:
Verkehrsrot 2019-03-24 22:02:19 +01:00
parent 185953bd5a
commit a7a49ee9a0
3 changed files with 4 additions and 6 deletions

View File

@ -67,6 +67,7 @@
// settings for syncing time of node with external time source
#define TIME_SYNC_INTERVAL 0 // sync time attempt each .. minutes from time source (GPS/LORA/RTC) [default = 60], 0 means off
#define TIME_SYNC_INTERVAL_RETRY 0 // retry time sync after lost sync each .. minutes [default = 10], 0 means off
#define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0]
#define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 0]
#define TIME_SYNC_TIMESERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0]

View File

@ -43,7 +43,7 @@ time_t timeProvider(void) {
t = get_rtctime();
if (t) {
timeSource = _rtc;
timesyncer.attach(60, timeSync); // short retry
timesyncer.attach(TIME_SYNC_INTERVAL_RETRY * 60, timeSync); // short retry
}
#endif
@ -57,7 +57,7 @@ time_t timeProvider(void) {
if (!t) {
timeSource = _unsynced;
timesyncer.attach(60, timeSync); // short retry
timesyncer.attach(TIME_SYNC_INTERVAL_RETRY * 60, timeSync); // short retry
}
return t;
@ -138,7 +138,6 @@ void IRAM_ATTR CLOCKIRQ(void) {
portYIELD_FROM_ISR();
}
// helper function to check plausibility of a time
time_t timeIsValid(time_t const t) {
// is it a time in the past? we use compile date to guess
@ -204,7 +203,6 @@ void clock_init(void) {
assert(ClockTask); // has clock task started?
} // clock_init
void clock_loop(void *taskparameter) { // ClockTask
// caveat: don't use now() in this task, it will cause a race condition

View File

@ -160,8 +160,7 @@ void process_timesync_req(void *taskparameter) {
I2C_MUTEX_UNLOCK();
timeSource = _lora;
timesyncer.attach(TIME_SYNC_INTERVAL * 60,
timeSync); // set to regular repeat
timesyncer.attach(TIME_SYNC_INTERVAL * 60, timeSync); // regular repeat
ESP_LOGI(TAG, "[%0.3f] Timesync finished, time was adjusted",
millis() / 1000.0);
} else