diff options
author | Jason Reiss <jreiss@multitech.com> | 2022-10-26 11:42:20 -0500 |
---|---|---|
committer | Jason Reiss <jreiss@multitech.com> | 2022-10-26 11:42:20 -0500 |
commit | 34d28eb28f6931f55a46fdcc6c1b5ba9d5e4cfe4 (patch) | |
tree | 695ec4d6d0bbfa01f22a47b4a2434d7896ad2e49 | |
parent | 82549a0039197695eddc2889cdc7c8437790b9bf (diff) | |
download | lora_gateway_mtac_full-5.0.19.tar.gz lora_gateway_mtac_full-5.0.19.tar.bz2 lora_gateway_mtac_full-5.0.19.zip |
gps: add check for loss of PPS to the SX13015.0.19
-rw-r--r-- | libloragw/src/loragw_gps.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libloragw/src/loragw_gps.c b/libloragw/src/loragw_gps.c index 5b400bf..de0d495 100644 --- a/libloragw/src/loragw_gps.c +++ b/libloragw/src/loragw_gps.c @@ -636,9 +636,19 @@ int lgw_gps_sync(struct tref *ref, uint32_t count_us, struct timespec utc, struc bool aber_n0; /* is the update value for synchronization aberrant or not ? */ static bool aber_min1 = false; /* keep track of whether value at sync N-1 was aberrant or not */ static bool aber_min2 = false; /* keep track of whether value at sync N-2 was aberrant or not */ + static uint32_t last_count_us = 0; CHECK_NULL(ref); + if (cnt_diff == 0.0 || last_count_us == count_us) { + // no pps change from SX1301, invalidate system reference time + ref->systime = 0; + ref->count_us = count_us; + return LGW_GPS_ERROR; + } + + last_count_us = count_us; + /* calculate the slope */ cnt_diff = (double)(count_us - ref->count_us) / (double)(TS_CPS); /* uncorrected by xtal_err */ |