mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Disallow dual gyro in "BOTH" mode if RPM filter enabled
RPM Filter currently doesn't support dual-gyro running in "BOTH" mode. Switch to the "FIRST" gyro if configured for "BOTH" and RPM filter is enabled. Once RPM filter is updated to support dual-gyro using both sensors then this check should be removed.
This commit is contained in:
parent
5c75974415
commit
3fdb0e2b2e
4 changed files with 18 additions and 7 deletions
|
@ -461,6 +461,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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue