fix PWM remaining active on soft reset.

This commit is contained in:
blckmn 2016-07-09 17:51:19 +10:00
parent 6100e94aee
commit 68026f7c3e
5 changed files with 5 additions and 10 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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.

View File

@ -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