From e19bf8149b211684fbfc1a507c6f8fa4fb40ec04 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Tue, 23 Feb 2021 22:06:53 +0000 Subject: [PATCH] Copter: generalise ESC telemetry to allow harmonic notch handling with other ESCs --- ArduCopter/system.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ArduCopter/system.cpp b/ArduCopter/system.cpp index eba627adcf..dfbd04a273 100644 --- a/ArduCopter/system.cpp +++ b/ArduCopter/system.cpp @@ -1,5 +1,5 @@ #include "Copter.h" -#include +#include /***************************************************************************** * The init_ardupilot function processes everything we need for an in - air restart @@ -278,12 +278,12 @@ void Copter::update_dynamic_notch() } break; #endif -#ifdef HAVE_AP_BLHELI_SUPPORT +#if HAL_WITH_ESC_TELEM case HarmonicNotchDynamicMode::UpdateBLHeli: // BLHeli based tracking // set the harmonic notch filter frequency scaled on measured frequency if (ins.has_harmonic_option(HarmonicNotchFilterParams::Options::DynamicHarmonic)) { float notches[INS_MAX_NOTCHES]; - const uint8_t num_notches = AP_BLHeli::get_singleton()->get_motor_frequencies_hz(INS_MAX_NOTCHES, notches); + const uint8_t num_notches = AP::esc_telem().get_motor_frequencies_hz(INS_MAX_NOTCHES, notches); for (uint8_t i = 0; i < num_notches; i++) { notches[i] = MAX(ref_freq, notches[i]); @@ -294,7 +294,7 @@ void Copter::update_dynamic_notch() ins.update_harmonic_notch_freq_hz(throttle_freq); } } else { - ins.update_harmonic_notch_freq_hz(MAX(ref_freq, AP_BLHeli::get_singleton()->get_average_motor_frequency_hz() * ref)); + ins.update_harmonic_notch_freq_hz(MAX(ref_freq, AP::esc_telem().get_average_motor_frequency_hz() * ref)); } break; #endif