From 68e2337a9a647c89abb8a706b44038a1ec3c5acd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 8 Sep 2024 18:10:57 +1000 Subject: [PATCH] Filter: only update notch on init if fixed --- libraries/Filter/HarmonicNotchFilter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/Filter/HarmonicNotchFilter.cpp b/libraries/Filter/HarmonicNotchFilter.cpp index 06a2400a15ff3..c98a50eeac4ea 100644 --- a/libraries/Filter/HarmonicNotchFilter.cpp +++ b/libraries/Filter/HarmonicNotchFilter.cpp @@ -191,8 +191,11 @@ void HarmonicNotchFilter::init(float sample_freq_hz, HarmonicNotchFilterParam NotchFilter::calculate_A_and_Q(center_freq_hz, bandwidth_hz / _composite_notches, attenuation_dB, _A, _Q); _initialised = true; + // ensure static notches are allocated and working - update(center_freq_hz); + if (params->tracking_mode() == HarmonicNotchDynamicMode::Fixed) { + update(center_freq_hz); + } } /*