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

Merge pull request #3267 from brycedjohnson/dshotcommand

Added anti-turtle reversemotors and beeper using dshot commands on blheli_s
This commit is contained in:
Michael Keller 2017-06-16 01:01:12 +12:00 committed by GitHub
commit 227a1f617e
8 changed files with 62 additions and 10 deletions

View file

@ -107,7 +107,7 @@ int16_t magHold;
int16_t headFreeModeHold;
uint8_t motorControlEnable = false;
static bool reverseMotors;
static uint32_t disarmAt; // Time of automatic disarm when "Don't spin the motors when armed" is enabled and auto_disarm_delay is nonzero
bool isRXDataNew;
@ -206,6 +206,20 @@ void mwArm(void)
return;
}
if (!ARMING_FLAG(PREVENT_ARMING)) {
#ifdef USE_DSHOT
if (!feature(FEATURE_3D) && !IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) {
reverseMotors = false;
for (unsigned index = 0; index < getMotorCount(); index++) {
pwmWriteDshotCommand(index, DSHOT_CMD_ROTATE_NORMAL);
}
}
if (!feature(FEATURE_3D) && IS_RC_MODE_ACTIVE(BOX3DDISABLESWITCH)) {
reverseMotors = true;
for (unsigned index = 0; index < getMotorCount(); index++) {
pwmWriteDshotCommand(index, DSHOT_CMD_ROTATE_REVERSE);
}
}
#endif
ENABLE_ARMING_FLAG(ARMED);
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);
headFreeModeHold = DECIDEGREES_TO_DEGREES(attitude.values.yaw);
@ -645,3 +659,8 @@ void taskMainPidLoop(timeUs_t currentTimeUs)
runTaskMainSubprocesses = true;
}
}
bool isMotorsReversed()
{
return reverseMotors;
}