mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Added Dshot commands for reversing the motors and beeper for blheli_s
This commit is contained in:
parent
617d36a6a9
commit
13e21c969e
8 changed files with 62 additions and 10 deletions
|
@ -106,7 +106,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;
|
||||
|
@ -205,6 +205,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);
|
||||
|
@ -644,3 +658,8 @@ void taskMainPidLoop(timeUs_t currentTimeUs)
|
|||
runTaskMainSubprocesses = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool isMotorsReversed()
|
||||
{
|
||||
return reverseMotors;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue