Don't allow bidirectional DSHOT600 on an F411

This commit is contained in:
Steve Evans 2022-01-03 17:51:53 +00:00
parent 573984eb2a
commit ea53e32db4
1 changed files with 10 additions and 0 deletions

View File

@ -618,6 +618,16 @@ void validateAndFixGyroConfig(void)
// check for looptime restrictions based on motor protocol. Motor times have safety margin
float motorUpdateRestriction;
#if defined(STM32F40_41xxx) || defined(STM32F411xE)
/* If bidirectional DSHOT is being used on an F411 then force DSHOT300. The motor update restrictions then applied
* will automatically consider the loop time and adjust pid_process_denom appropriately
*/
if (motorConfig()->dev.useDshotTelemetry && (motorConfig()->dev.motorPwmProtocol == PWM_TYPE_DSHOT600)) {
motorConfigMutable()->dev.motorPwmProtocol = PWM_TYPE_DSHOT300;
}
#endif
switch (motorConfig()->dev.motorPwmProtocol) {
case PWM_TYPE_STANDARD:
motorUpdateRestriction = 1.0f / BRUSHLESS_MOTORS_PWM_RATE;