mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Fixes #13934: Fix motor(PWM protocol) spin while fc reset. (#13937) * Fix motor(PWM protocol) spin while fc reset. * move delay out to motorShutdown Co-authored-by: ke deng <degkxp@hotmail.com>
This commit is contained in:
parent
f7697e22fe
commit
ad93ec30f1
1 changed files with 15 additions and 1 deletions
|
@ -51,11 +51,25 @@ static bool motorProtocolDshot = false;
|
|||
|
||||
void motorShutdown(void)
|
||||
{
|
||||
uint32_t shutdownDelayUs = 1500;
|
||||
motorDevice->vTable.shutdown();
|
||||
motorDevice->enabled = false;
|
||||
motorDevice->motorEnableTimeMs = 0;
|
||||
motorDevice->initialized = false;
|
||||
delayMicroseconds(1500);
|
||||
|
||||
switch (motorConfig()->dev.motorPwmProtocol) {
|
||||
case PWM_TYPE_STANDARD:
|
||||
case PWM_TYPE_ONESHOT125:
|
||||
case PWM_TYPE_ONESHOT42:
|
||||
case PWM_TYPE_MULTISHOT:
|
||||
// Delay 500ms will disarm esc which can prevent motor spin while reboot
|
||||
shutdownDelayUs += 500 * 1000;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delayMicroseconds(shutdownDelayUs);
|
||||
}
|
||||
|
||||
void motorWriteAll(float *values)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue