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:
commit
72d0117278
|
@ -457,6 +457,14 @@ static void validateAndFixConfig(void)
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
#if defined(TARGET_VALIDATECONFIG)
|
||||||
targetValidateConfiguration();
|
targetValidateConfiguration();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -296,13 +296,10 @@ void updateArmingStatus(void)
|
||||||
#ifdef USE_RPM_FILTER
|
#ifdef USE_RPM_FILTER
|
||||||
// USE_RPM_FILTER will only be defined if USE_DSHOT and USE_DSHOT_TELEMETRY are defined
|
// 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 the RPM filter is anabled and any motor isn't providing telemetry, then disable arming
|
||||||
if (motorConfig()->dev.useDshotTelemetry
|
if (isRpmFilterEnabled() && !isDshotTelemetryActive()) {
|
||||||
&& (rpmFilterConfig()->gyro_rpm_notch_harmonics || rpmFilterConfig()->dterm_rpm_notch_harmonics)) {
|
setArmingDisabled(ARMING_DISABLED_RPMFILTER);
|
||||||
if (!isDshotTelemetryActive()) {
|
} else {
|
||||||
setArmingDisabled(ARMING_DISABLED_RPMFILTER);
|
unsetArmingDisabled(ARMING_DISABLED_RPMFILTER);
|
||||||
} else {
|
|
||||||
unsetArmingDisabled(ARMING_DISABLED_RPMFILTER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
|
@ -42,3 +42,4 @@ void rpmFilterInit(const rpmFilterConfig_t *config);
|
||||||
float rpmFilterGyro(int axis, float values);
|
float rpmFilterGyro(int axis, float values);
|
||||||
float rpmFilterDterm(int axis, float values);
|
float rpmFilterDterm(int axis, float values);
|
||||||
void rpmFilterUpdate();
|
void rpmFilterUpdate();
|
||||||
|
bool isRpmFilterEnabled(void);
|
||||||
|
|
Loading…
Reference in New Issue