Merge pull request #6484 from etracer65/disable_dynfilter_below_2k

Disable DYNAMIC_FILTER feature if gyro loop is less than 2KHz
This commit is contained in:
Michael Keller 2018-08-02 13:07:28 +12:00 committed by GitHub
commit 1f1dd981bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -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