diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 28475b3f4..9259e5595 100644 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -69,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, @@ -410,6 +412,13 @@ static void validateAndFixConfig(void) #ifndef USE_OSD_SLAVE void validateAndFixGyroConfig(void) { +#ifdef USE_GYRO_DATA_ANALYSE + // Disable dynamic filter if gyro loop is less than 2KHz + if (gyro.targetLooptime > DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME) { + featureClear(FEATURE_DYNAMIC_FILTER); + } +#endif + // Prevent invalid notch cutoff if (gyroConfig()->gyro_soft_notch_cutoff_1 >= gyroConfig()->gyro_soft_notch_hz_1) { gyroConfigMutable()->gyro_soft_notch_hz_1 = 0; diff --git a/src/main/sensors/gyroanalyse.c b/src/main/sensors/gyroanalyse.c index 236126739..45d5a49b7 100644 --- a/src/main/sensors/gyroanalyse.c +++ b/src/main/sensors/gyroanalyse.c @@ -303,5 +303,4 @@ static FAST_CODE_NOINLINE void gyroDataAnalyseUpdate(gyroAnalyseState_t *state, state->updateStep = (state->updateStep + 1) % STEP_COUNT; } - #endif // USE_GYRO_DATA_ANALYSE