diff options
-rw-r--r-- | lora_pkt_fwd/src/lora_pkt_fwd.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c index e3c08cf..08aaf43 100644 --- a/lora_pkt_fwd/src/lora_pkt_fwd.c +++ b/lora_pkt_fwd/src/lora_pkt_fwd.c @@ -1997,8 +1997,17 @@ int main(int argc, char** argv) MSG("WARNING: lgw page was unexpectedly changed, process is exiting.\n"); break; } - - /* read the currrent temperature */ + + static uint32_t last_tstamp = 0; + static uint32_t rollover_cnt = 0; + if (trig_tstamp < last_tstamp) { + if (rollover_cnt++ > 10) { + exit_sig = true; + MSG("INFO: periodic restart, process is exiting.\n"); + break; + } + } + last_tstamp = trig_tstamp; pthread_mutex_unlock(&mx_concent); if (i != LGW_HAL_SUCCESS) { |