Merge pull request #704 from blckmn/pwm_abort
stop all PWM on all motors on soft reset
This commit is contained in:
commit
5c31b59de8
|
@ -666,9 +666,10 @@ void stopMotors(void)
|
||||||
delay(50); // give the timers and ESCs a chance to react.
|
delay(50); // give the timers and ESCs a chance to react.
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopPwmAllMotors()
|
void stopPwmAllMotors()
|
||||||
{
|
{
|
||||||
pwmShutdownPulsesForAllMotors(motorCount);
|
pwmShutdownPulsesForAllMotors(motorCount);
|
||||||
|
delayMicroseconds(1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_QUAD_MIXER_ONLY
|
#ifndef USE_QUAD_MIXER_ONLY
|
||||||
|
|
|
@ -215,4 +215,4 @@ void mixTable(void);
|
||||||
void syncMotors(bool enabled);
|
void syncMotors(bool enabled);
|
||||||
void writeMotors(void);
|
void writeMotors(void);
|
||||||
void stopMotors(void);
|
void stopMotors(void);
|
||||||
void StopPwmAllMotors(void);
|
void stopPwmAllMotors(void);
|
||||||
|
|
|
@ -2574,7 +2574,7 @@ static void cliRebootEx(bool bootLoader)
|
||||||
cliPrint("\r\nRebooting");
|
cliPrint("\r\nRebooting");
|
||||||
bufWriterFlush(cliWriter);
|
bufWriterFlush(cliWriter);
|
||||||
waitForSerialPortToFinishTransmitting(cliPort);
|
waitForSerialPortToFinishTransmitting(cliPort);
|
||||||
stopMotors();
|
stopPwmAllMotors();
|
||||||
if (bootLoader) {
|
if (bootLoader) {
|
||||||
systemResetToBootloader();
|
systemResetToBootloader();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1967,7 +1967,7 @@ void mspProcess(void)
|
||||||
|
|
||||||
if (isRebootScheduled) {
|
if (isRebootScheduled) {
|
||||||
waitForSerialPortToFinishTransmitting(candidatePort->port);
|
waitForSerialPortToFinishTransmitting(candidatePort->port);
|
||||||
stopMotors();
|
stopPwmAllMotors();
|
||||||
// On real flight controllers, systemReset() will do a soft reset of the device,
|
// On real flight controllers, systemReset() will do a soft reset of the device,
|
||||||
// reloading the program. But to support offline testing this flag needs to be
|
// reloading the program. But to support offline testing this flag needs to be
|
||||||
// cleared so that the software doesn't continuously attempt to reboot itself.
|
// cleared so that the software doesn't continuously attempt to reboot itself.
|
||||||
|
|
|
@ -335,12 +335,6 @@ void init(void)
|
||||||
|
|
||||||
mixerUsePWMOutputConfiguration(pwmOutputConfiguration, use_unsyncedPwm);
|
mixerUsePWMOutputConfiguration(pwmOutputConfiguration, use_unsyncedPwm);
|
||||||
|
|
||||||
/*
|
|
||||||
// TODO is this needed here? enables at the end
|
|
||||||
if (!feature(FEATURE_ONESHOT125))
|
|
||||||
motorControlEnable = true;
|
|
||||||
|
|
||||||
*/
|
|
||||||
systemState |= SYSTEM_STATE_MOTORS_READY;
|
systemState |= SYSTEM_STATE_MOTORS_READY;
|
||||||
|
|
||||||
#ifdef BEEPER
|
#ifdef BEEPER
|
||||||
|
|
Loading…
Reference in New Issue