Skip to content

Commit

Permalink
Update bbn_wave_freq_m5atomS3.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch authored Sep 7, 2024
1 parent 11082bb commit 69ba9e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bbn_wave_freq_m5atomS3/bbn_wave_freq_m5atomS3.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down

0 comments on commit 69ba9e0

Please sign in to comment.