Merge pull request #7895 from etracer65/dshot_bidir_disable_dual_gyro

Disallow dual gyro in "BOTH" mode if RPM filter enabled
This commit is contained in:
Michael Keller 2019-03-31 16:08:59 +13:00 committed by GitHub
commit 72d0117278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 7 deletions

View File

@ -457,6 +457,14 @@ static void validateAndFixConfig(void)
}
#endif
// Temporary workaround until RPM Filter supports dual-gyro using both sensors
// Once support is added remove this block
#if defined(USE_MULTI_GYRO) && defined(USE_RPM_FILTER)
if (gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_BOTH && isRpmFilterEnabled()) {
gyroConfigMutable()->gyro_to_use = GYRO_CONFIG_USE_GYRO_1;
}
#endif
#if defined(TARGET_VALIDATECONFIG)
targetValidateConfiguration();
#endif

View File

@ -296,13 +296,10 @@ void updateArmingStatus(void)
#ifdef USE_RPM_FILTER
// USE_RPM_FILTER will only be defined if USE_DSHOT and USE_DSHOT_TELEMETRY are defined
// If the RPM filter is anabled and any motor isn't providing telemetry, then disable arming
if (motorConfig()->dev.useDshotTelemetry
&& (rpmFilterConfig()->gyro_rpm_notch_harmonics || rpmFilterConfig()->dterm_rpm_notch_harmonics)) {
if (!isDshotTelemetryActive()) {
setArmingDisabled(ARMING_DISABLED_RPMFILTER);
} else {
unsetArmingDisabled(ARMING_DISABLED_RPMFILTER);
}
if (isRpmFilterEnabled() && !isDshotTelemetryActive()) {
setArmingDisabled(ARMING_DISABLED_RPMFILTER);
} else {
unsetArmingDisabled(ARMING_DISABLED_RPMFILTER);
}
#endif

View File

@ -209,4 +209,9 @@ FAST_CODE_NOINLINE void rpmFilterUpdate()
}
}
bool isRpmFilterEnabled(void)
{
return (motorConfig()->dev.useDshotTelemetry && (rpmFilterConfig()->gyro_rpm_notch_harmonics || rpmFilterConfig()->dterm_rpm_notch_harmonics));
}
#endif

View File

@ -42,3 +42,4 @@ void rpmFilterInit(const rpmFilterConfig_t *config);
float rpmFilterGyro(int axis, float values);
float rpmFilterDterm(int axis, float values);
void rpmFilterUpdate();
bool isRpmFilterEnabled(void);