Skip to content

Commit

Permalink
AP_InertialSensor: cope with negative ESC frequencies in notch updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Oct 4, 2024
1 parent e40ae8e commit cf2c8b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_InertialSensor/AP_InertialSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2327,15 +2327,15 @@ void AP_InertialSensor::acal_update()
*/
void AP_InertialSensor::HarmonicNotch::update_freq_hz(float scaled_freq)
{
calculated_notch_freq_hz[0] = scaled_freq;
calculated_notch_freq_hz[0] = fabsf(scaled_freq);
num_calculated_notch_frequencies = 1;
}

// Update the harmonic notch frequency
void AP_InertialSensor::HarmonicNotch::update_frequencies_hz(uint8_t num_freqs, const float scaled_freq[]) {
// note that we allow zero through, which will disable the notch
for (uint8_t i = 0; i < num_freqs; i++) {
calculated_notch_freq_hz[i] = scaled_freq[i];
calculated_notch_freq_hz[i] = fabsf(scaled_freq[i]);
}
// any uncalculated frequencies will float at the previous value or the initialized freq if none
num_calculated_notch_frequencies = num_freqs;
Expand Down

0 comments on commit cf2c8b6

Please sign in to comment.