diff options
-rw-r--r-- | lora_pkt_fwd/src/lora_pkt_fwd.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c index 2969053..a181ea7 100644 --- a/lora_pkt_fwd/src/lora_pkt_fwd.c +++ b/lora_pkt_fwd/src/lora_pkt_fwd.c @@ -1994,8 +1994,18 @@ int main(int argc, char** argv) 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; + /* read the currrent temperature */ pthread_mutex_unlock(&mx_concent); if (i != LGW_HAL_SUCCESS) { printf("# SX1301 time (PPS): unknown\n"); |