From 6ac35ce9afb8ce89af4164f6b72d2109541c2e70 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 15 Feb 2024 12:06:22 +1100 Subject: [PATCH] AP_Vehicle: use update_dynamic_notch() directly in rate loop --- libraries/AP_Vehicle/AP_Vehicle.cpp | 3 ++- libraries/AP_Vehicle/AP_Vehicle.h | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index b79373b364..9f7d70bb24 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.cpp +++ b/libraries/AP_Vehicle/AP_Vehicle.cpp @@ -3,6 +3,7 @@ #if AP_VEHICLE_ENABLED #include "AP_Vehicle.h" +#include #include #include @@ -621,7 +622,7 @@ const AP_Scheduler::Task AP_Vehicle::scheduler_tasks[] = { SCHED_TASK_CLASS(AP_GyroFFT, &vehicle.gyro_fft, update, 400, 50, 205), SCHED_TASK_CLASS(AP_GyroFFT, &vehicle.gyro_fft, update_parameters, 1, 50, 210), #endif -#if AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED +#if AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED && !AP_INERTIALSENSOR_FAST_SAMPLE_WINDOW_ENABLED SCHED_TASK(update_dynamic_notch_at_specified_rate, LOOP_RATE, 200, 215), #endif #if AP_VIDEOTX_ENABLED diff --git a/libraries/AP_Vehicle/AP_Vehicle.h b/libraries/AP_Vehicle/AP_Vehicle.h index cba506cb9b..f34be5accb 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -522,6 +522,13 @@ protected: // Check if this mode can be entered from the GCS bool block_GCS_mode_change(uint8_t mode_num, const uint8_t *mode_list, uint8_t mode_list_length) const; +#if AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED + // update the harmonic notch + void update_dynamic_notch(AP_InertialSensor::HarmonicNotch ¬ch); + // run notch update at either loop rate or 200Hz + void update_dynamic_notch_at_specified_rate(); +#endif // AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED + private: #if AP_SCHEDULER_ENABLED @@ -536,13 +543,7 @@ private: #if AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED // update the harmonic notch for throttle based notch void update_throttle_notch(AP_InertialSensor::HarmonicNotch ¬ch); - - // update the harmonic notch - void update_dynamic_notch(AP_InertialSensor::HarmonicNotch ¬ch); - - // run notch update at either loop rate or 200Hz - void update_dynamic_notch_at_specified_rate(); -#endif // AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED +#endif // AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED // decimation for 1Hz update uint8_t one_Hz_counter;