summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2021-11-29 17:05:38 -0600
committerJason Reiss <jreiss@multitech.com>2021-11-29 17:05:38 -0600
commit2644f280e8957e4a4a661b5c9d0631489a366b5c (patch)
tree43d9eb7a7f7b9a21bd4424c516c7b98865def076 /lora_pkt_fwd
parent8406b3a9ba85f65b222452b5e22a7cde2e253d13 (diff)
downloadpacket_forwarder_mtac_full-2644f280e8957e4a4a661b5c9d0631489a366b5c.tar.gz
packet_forwarder_mtac_full-2644f280e8957e4a4a661b5c9d0631489a366b5c.tar.bz2
packet_forwarder_mtac_full-2644f280e8957e4a4a661b5c9d0631489a366b5c.zip
Skip err accumulation if calculated error is 0.0 during calibration4.0.13
Diffstat (limited to 'lora_pkt_fwd')
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index a971dc0..d59b59e 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -3622,9 +3622,11 @@ void thread_valid(void) {
init_acc = 0.0;
} else {
if (init_cpt < XERR_INIT_AVG) {
- /* initial accumulation */
- init_acc += xtal_err_cpy;
- ++init_cpt;
+ if (xtal_err_cpy > 0.0) {
+ /* initial accumulation */
+ init_acc += xtal_err_cpy;
+ ++init_cpt;
+ }
} else if (init_cpt == XERR_INIT_AVG) {
/* initial average calculation */
pthread_mutex_lock(&mx_xcorr);