summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd
diff options
context:
space:
mode:
Diffstat (limited to 'lora_pkt_fwd')
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index ec42ec0..360b96e 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -2452,6 +2452,12 @@ void thread_down(void) {
/* Wait for GPS to be ready before inserting beacons in JiT queue */
if ((gps_ref_valid == true) && (xtal_correct_ok == true)) {
+ if (time_reference_gps.gps.tv_sec < last_beacon_gps_time.tv_sec ||
+ (time_reference_gps.gps.tv_sec - last_beacon_gps_time.tv_sec) > 256) {
+ // Incase system time reference has moved
+ last_beacon_gps_time.tv_sec = 0;
+ }
+
/* compute GPS time for next beacon to come */
/* LoRaWAN: T = k*beacon_period + TBeaconDelay */
/* with TBeaconDelay = [1.5ms +/- 1µs]*/
@@ -2468,6 +2474,7 @@ void thread_down(void) {
next_beacon_gps_time.tv_sec += (retry * beacon_period);
next_beacon_gps_time.tv_nsec = 0;
+
#if DEBUG_BEACON
{
time_t time_unix;