From 69ba9e02257d1b6a5df0cdb11f635af54d8d5e91 Mon Sep 17 00:00:00 2001 From: Mikhail Grushinskiy Date: Sat, 7 Sep 2024 18:12:57 -0400 Subject: [PATCH] Update bbn_wave_freq_m5atomS3.ino --- bbn_wave_freq_m5atomS3/bbn_wave_freq_m5atomS3.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bbn_wave_freq_m5atomS3/bbn_wave_freq_m5atomS3.ino b/bbn_wave_freq_m5atomS3/bbn_wave_freq_m5atomS3.ino index 58af908..6e47121 100644 --- a/bbn_wave_freq_m5atomS3/bbn_wave_freq_m5atomS3.ino +++ b/bbn_wave_freq_m5atomS3/bbn_wave_freq_m5atomS3.ino @@ -183,7 +183,7 @@ void repeatMe() { } float freq_adj = kalman_smoother_update(&kalman_freq, freq); - if (freq_adj > 0.001) { + if (freq_adj > 0.001 && freq_adj < 10000) { float period = 1.0 / freq_adj; float wave_length = trochoid_wave_length(period); //float heave = - a * wave_length / (2 * PI); @@ -192,6 +192,9 @@ void repeatMe() { sample.timeMicroSec = now; sample.value = heave; uint32_t windowMicros = 5 * period * 1000000; + if (windowMicros <= 15 * 1000000) { + windowMicros = 15 * 1000000; + } min_max_lemire_update(&min_max, sample, windowMicros); }