AP_InertialSensor: count filters to match notch options

this allows for much more complex filter setups as long as not
filtering on all IMUs
This commit is contained in:
Andrew Tridgell 2022-06-07 19:39:50 +10:00
parent d07761cfd9
commit d653499efc

View File

@ -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);
}
}