1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 23:05:19 +03:00

Refactored Dshot reverse condition block.

This commit is contained in:
mikeller 2017-06-25 21:18:39 +12:00
parent b77b866c2d
commit 7bd05b2148

View file

@ -207,20 +207,22 @@ void mwArm(void)
} }
if (!ARMING_FLAG(PREVENT_ARMING)) { if (!ARMING_FLAG(PREVENT_ARMING)) {
#ifdef USE_DSHOT #ifdef USE_DSHOT
if (!feature(FEATURE_3D)) {
//TODO: Use BOXDSHOTREVERSE here //TODO: Use BOXDSHOTREVERSE here
if (!feature(FEATURE_3D) && !IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) { if (!IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) {
reverseMotors = false; reverseMotors = false;
for (unsigned index = 0; index < getMotorCount(); index++) { for (unsigned index = 0; index < getMotorCount(); index++) {
pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_NORMAL); pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_NORMAL);
} }
} } else {
if (!feature(FEATURE_3D) && IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) {
reverseMotors = true; reverseMotors = true;
for (unsigned index = 0; index < getMotorCount(); index++) { for (unsigned index = 0; index < getMotorCount(); index++) {
pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_REVERSED); pwmWriteDshotCommand(index, DSHOT_CMD_SPIN_DIRECTION_REVERSED);
} }
} }
}
#endif #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);