diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 0e34b5744..9259e5595 100644 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -60,7 +60,6 @@ #include "sensors/acceleration.h" #include "sensors/battery.h" #include "sensors/gyro.h" -#include "sensors/gyroanalyse.h" #ifndef USE_OSD_SLAVE pidProfile_t *currentPidProfile; @@ -70,6 +69,8 @@ pidProfile_t *currentPidProfile; #define RX_SPI_DEFAULT_PROTOCOL 0 #endif +#define DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME HZ_TO_INTERVAL_US(2000) + PG_REGISTER_WITH_RESET_TEMPLATE(pilotConfig_t, pilotConfig, PG_PILOT_CONFIG, 0); PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig, @@ -413,7 +414,7 @@ void validateAndFixGyroConfig(void) { #ifdef USE_GYRO_DATA_ANALYSE // Disable dynamic filter if gyro loop is less than 2KHz - if (!dynamicFilterAllowed()) { + if (gyro.targetLooptime > DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME) { featureClear(FEATURE_DYNAMIC_FILTER); } #endif diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 1e505651e..068d16f7a 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -743,7 +743,7 @@ static void gyroInitFilterNotch2(gyroSensor_t *gyroSensor, uint16_t notchHz, uin #ifdef USE_GYRO_DATA_ANALYSE static bool isDynamicFilterActive(void) { - return feature(FEATURE_DYNAMIC_FILTER) && dynamicFilterAllowed(); + return feature(FEATURE_DYNAMIC_FILTER); } static void gyroInitFilterDynamicNotch(gyroSensor_t *gyroSensor) diff --git a/src/main/sensors/gyroanalyse.c b/src/main/sensors/gyroanalyse.c index c69e731f4..45d5a49b7 100644 --- a/src/main/sensors/gyroanalyse.c +++ b/src/main/sensors/gyroanalyse.c @@ -303,8 +303,4 @@ static FAST_CODE_NOINLINE void gyroDataAnalyseUpdate(gyroAnalyseState_t *state, state->updateStep = (state->updateStep + 1) % STEP_COUNT; } - -bool dynamicFilterAllowed(void) { - return (gyro.targetLooptime <= HZ_TO_INTERVAL_US(2000)); -} #endif // USE_GYRO_DATA_ANALYSE diff --git a/src/main/sensors/gyroanalyse.h b/src/main/sensors/gyroanalyse.h index 58a3449c6..89d4401f3 100644 --- a/src/main/sensors/gyroanalyse.h +++ b/src/main/sensors/gyroanalyse.h @@ -61,4 +61,3 @@ void gyroDataAnalyseInit(void); void gyroDataAnalyseStateInit(gyroAnalyseState_t *gyroAnalyse, uint32_t targetLooptime); void gyroDataAnalysePush(gyroAnalyseState_t *gyroAnalyse, int axis, float sample); void gyroDataAnalyse(gyroAnalyseState_t *gyroAnalyse, biquadFilter_t *notchFilterDyn); -bool dynamicFilterAllowed(void);