Merge pull request #3351 from mikeller/improve_dshot_reverse_condition
Refactored Dshot reverse condition block.
This commit is contained in:
commit
582af3d515
|
@ -206,21 +206,23 @@ void mwArm(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!ARMING_FLAG(PREVENT_ARMING)) {
|
if (!ARMING_FLAG(PREVENT_ARMING)) {
|
||||||
#ifdef USE_DSHOT
|
#ifdef USE_DSHOT
|
||||||
//TODO: Use BOXDSHOTREVERSE here
|
if (!feature(FEATURE_3D)) {
|
||||||
if (!feature(FEATURE_3D) && !IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) {
|
//TODO: Use BOXDSHOTREVERSE here
|
||||||
reverseMotors = false;
|
if (!IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) {
|
||||||
for (unsigned index = 0; index < getMotorCount(); index++) {
|
reverseMotors = false;
|
||||||
pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_NORMAL);
|
for (unsigned index = 0; index < getMotorCount(); index++) {
|
||||||
|
pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_NORMAL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reverseMotors = true;
|
||||||
|
for (unsigned index = 0; index < getMotorCount(); index++) {
|
||||||
|
pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_REVERSED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!feature(FEATURE_3D) && IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) {
|
#endif
|
||||||
reverseMotors = true;
|
|
||||||
for (unsigned index = 0; index < getMotorCount(); index++) {
|
|
||||||
pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_REVERSED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ENABLE_ARMING_FLAG(ARMED);
|
ENABLE_ARMING_FLAG(ARMED);
|
||||||
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);
|
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);
|
||||||
headFreeModeHold = DECIDEGREES_TO_DEGREES(attitude.values.yaw);
|
headFreeModeHold = DECIDEGREES_TO_DEGREES(attitude.values.yaw);
|
||||||
|
|
Loading…
Reference in New Issue