mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Better mspPostProcessFn handling
This commit is contained in:
parent
345f9cfe03
commit
445d3f31dc
2 changed files with 16 additions and 7 deletions
|
@ -120,6 +120,7 @@ void mspSerialProcess(void)
|
||||||
bufWriterFlush(writer);
|
bufWriterFlush(writer);
|
||||||
|
|
||||||
if (mspPostProcessFn) {
|
if (mspPostProcessFn) {
|
||||||
|
waitForSerialPortToFinishTransmitting(mspPort->port);
|
||||||
mspPostProcessFn(mspPort);
|
mspPostProcessFn(mspPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,9 +192,22 @@ typedef enum {
|
||||||
|
|
||||||
#define DATAFLASH_BUFFER_SIZE 4096
|
#define DATAFLASH_BUFFER_SIZE 4096
|
||||||
|
|
||||||
|
#ifdef USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||||
|
void msp4WayIfFn(mspPort_t *mspPort)
|
||||||
|
{
|
||||||
|
// rem: App: Wait at least appx. 500 ms for BLHeli to jump into
|
||||||
|
// bootloader mode before try to connect any ESC
|
||||||
|
// Start to activate here
|
||||||
|
esc4wayProcess(mspPort->port);
|
||||||
|
// former used MSP uart is still active
|
||||||
|
// proceed as usual with MSP commands
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void mspRebootFn(mspPort_t *mspPort)
|
void mspRebootFn(mspPort_t *mspPort)
|
||||||
{
|
{
|
||||||
waitForSerialPortToFinishTransmitting(mspPort->port);
|
UNUSED(mspPort);
|
||||||
|
|
||||||
stopPwmAllMotors();
|
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
|
||||||
|
@ -1849,12 +1862,7 @@ static bool processInCommand(uint8_t cmdMSP)
|
||||||
bufWriterFlush(writer);
|
bufWriterFlush(writer);
|
||||||
// wait for all data to send
|
// wait for all data to send
|
||||||
waitForSerialPortToFinishTransmitting(currentPort->port);
|
waitForSerialPortToFinishTransmitting(currentPort->port);
|
||||||
// rem: App: Wait at least appx. 500 ms for BLHeli to jump into
|
msp4WayIfFn(currentPort);
|
||||||
// bootloader mode before try to connect any ESC
|
|
||||||
// Start to activate here
|
|
||||||
esc4wayProcess(currentPort->port);
|
|
||||||
// former used MSP uart is still active
|
|
||||||
// proceed as usual with MSP commands
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue