mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
Fix blocking DSHOT commands
Motor and DSHOT refactoring broke blocking DSHOT commands as the check for commands being enabled was not taking into account that "blocking" type commands need to operate only when the motors are not enabled. Fixes the CLI `dshotprog` command.
This commit is contained in:
parent
a2aa3f19f4
commit
c6c9ba7229
5 changed files with 28 additions and 21 deletions
|
@ -277,7 +277,7 @@ void updateArmingStatus(void)
|
|||
// We also need to prevent arming until it's possible to send DSHOT commands.
|
||||
// Otherwise if the initial arming is in crash-flip the motor direction commands
|
||||
// might not be sent.
|
||||
&& dshotCommandsAreEnabled()
|
||||
&& dshotCommandsAreEnabled(DSHOT_CMD_TYPE_INLINE)
|
||||
#endif
|
||||
) {
|
||||
// If so, unset the grace time arming disable flag
|
||||
|
@ -458,7 +458,7 @@ void disarm(flightLogDisarmReason_e reason)
|
|||
BEEP_OFF;
|
||||
#ifdef USE_DSHOT
|
||||
if (isMotorProtocolDshot() && flipOverAfterCrashActive && !featureIsEnabled(FEATURE_3D)) {
|
||||
dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SPIN_DIRECTION_NORMAL, false);
|
||||
dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SPIN_DIRECTION_NORMAL, DSHOT_CMD_TYPE_INLINE);
|
||||
}
|
||||
#endif
|
||||
flipOverAfterCrashActive = false;
|
||||
|
@ -509,7 +509,7 @@ void tryArm(void)
|
|||
if (!(IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH) || (tryingToArm == ARMING_DELAYED_CRASHFLIP))) {
|
||||
flipOverAfterCrashActive = false;
|
||||
if (!featureIsEnabled(FEATURE_3D)) {
|
||||
dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SPIN_DIRECTION_NORMAL, false);
|
||||
dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SPIN_DIRECTION_NORMAL, DSHOT_CMD_TYPE_INLINE);
|
||||
}
|
||||
} else {
|
||||
flipOverAfterCrashActive = true;
|
||||
|
@ -517,7 +517,7 @@ void tryArm(void)
|
|||
runawayTakeoffCheckDisabled = false;
|
||||
#endif
|
||||
if (!featureIsEnabled(FEATURE_3D)) {
|
||||
dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SPIN_DIRECTION_REVERSED, false);
|
||||
dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SPIN_DIRECTION_REVERSED, DSHOT_CMD_TYPE_INLINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue