mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Configuration Menu System support for external OSD
A quick hack to support config menu on external OSD, consisiting of: - CMS-OSD partial separation (CMS and OSD reside in a same file: osd.c) - MSP message injection (take it as server-push in client-server model)
This commit is contained in:
parent
9b83af1ccd
commit
01eab00fd7
12 changed files with 1025 additions and 662 deletions
|
@ -128,6 +128,34 @@ static mspPostProcessFnPtr mspSerialProcessReceivedCommand(mspPort_t *mspPort)
|
|||
return mspPostProcessFn;
|
||||
}
|
||||
|
||||
#ifdef USE_DPRINTF
|
||||
#include "common/printf.h"
|
||||
#define DPRINTF_SERIAL_PORT SERIAL_PORT_USART3
|
||||
extern serialPort_t *debugSerialPort;
|
||||
#define dprintf(x) if (debugSerialPort) printf x
|
||||
#else
|
||||
#define dprintf(x)
|
||||
#endif
|
||||
|
||||
void mspSerialPush(int cmd, uint8_t *data, int buflen)
|
||||
{
|
||||
for (uint8_t portIndex = 0; portIndex < MAX_MSP_PORT_COUNT; portIndex++) {
|
||||
mspPort_t * const mspPort = &mspPorts[portIndex];
|
||||
if (!mspPort->port) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Big enough for a OSD line
|
||||
uint8_t buf[sizeof(bufWriter_t) + 30];
|
||||
|
||||
writer = bufWriterInit(buf, sizeof(buf), (bufWrite_t)serialWriteBufShim, mspPort->port);
|
||||
|
||||
mspServerPush(mspPort, cmd, data, buflen);
|
||||
|
||||
bufWriterFlush(writer);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Process MSP commands from serial ports configured as MSP ports.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue