From 7beff67c70488ec5c6cd60633aeb459c70221dd1 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Wed, 24 Mar 2021 09:30:18 -0500 Subject: Update lora_pkt_fwd.c - add periodic restart of PKF --- lora_pkt_fwd/src/lora_pkt_fwd.c | 13 +++++++++++-- 1 file 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) { -- cgit v1.2.3