1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

CF/BF - Improve performance of mspSerialPush / MSP_DISPLAYPORT.

* avoiding the use of an unncessesary buffer and memcopy
* the `pushBuf` was a fixed size
* the size didn't correlate to the size of the buffer being passed in.
* avoids repeating the memcpy for each port being used for MSP.
* reduces ram usage.
This commit is contained in:
Hydra 2017-04-08 16:16:37 +01:00 committed by Dominic Clifton
parent ca5bafeab9
commit b307007ac3
3 changed files with 12 additions and 17 deletions

View file

@ -44,7 +44,7 @@ PG_REGISTER(displayPortProfile_t, displayPortProfileMsp, PG_DISPLAY_PORT_MSP_CON
static displayPort_t mspDisplayPort;
static int output(displayPort_t *displayPort, uint8_t cmd, const uint8_t *buf, int len)
static int output(displayPort_t *displayPort, uint8_t cmd, uint8_t *buf, int len)
{
UNUSED(displayPort);
return mspSerialPush(cmd, buf, len);
@ -52,7 +52,7 @@ static int output(displayPort_t *displayPort, uint8_t cmd, const uint8_t *buf, i
static int heartbeat(displayPort_t *displayPort)
{
const uint8_t subcmd[] = { 0 };
uint8_t subcmd[] = { 0 };
// ensure display is not released by MW OSD software
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
@ -65,21 +65,21 @@ static int grab(displayPort_t *displayPort)
static int release(displayPort_t *displayPort)
{
const uint8_t subcmd[] = { 1 };
uint8_t subcmd[] = { 1 };
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
}
static int clearScreen(displayPort_t *displayPort)
{
const uint8_t subcmd[] = { 2 };
uint8_t subcmd[] = { 2 };
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
}
static int drawScreen(displayPort_t *displayPort)
{
const uint8_t subcmd[] = { 4 };
uint8_t subcmd[] = { 4 };
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
}