From d653499efc8eec672d23991c4dae6fa35f430a4f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 7 Jun 2022 19:39:50 +1000 Subject: [PATCH] AP_InertialSensor: count filters to match notch options this allows for much more complex filter setups as long as not filtering on all IMUs --- libraries/AP_InertialSensor/AP_InertialSensor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.cpp b/libraries/AP_InertialSensor/AP_InertialSensor.cpp index b0731fd4bb..6e9f61f809 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor.cpp @@ -930,9 +930,10 @@ AP_InertialSensor::init(uint16_t loop_rate) // calculate number of notches we might want to use for harmonic notch if (notch.params.enabled() || fft_enabled) { const bool double_notch = notch.params.hasOption(HarmonicNotchFilterParams::Options::DoubleNotch); + const bool all_sensors = notch.params.hasOption(HarmonicNotchFilterParams::Options::EnableOnAllIMUs); num_filters += __builtin_popcount(notch.params.harmonics()) * notch.num_dynamic_notches * (double_notch ? 2 : 1) - * sensors_used; + * (all_sensors?sensors_used:1); } }