diff options
-rw-r--r-- | lora_pkt_fwd/src/lora_pkt_fwd.c | 8 |
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); |