mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Merge pull request #5242 from AndersHoglund/spektrum_cms_tm_perf
Spektrum CMS over TM performance increase.
This commit is contained in:
commit
7df3f01b36
5 changed files with 23 additions and 4 deletions
|
@ -71,7 +71,7 @@
|
|||
#define CMS_MAX_DEVICE 4
|
||||
#endif
|
||||
|
||||
static displayPort_t *pCurrentDisplay;
|
||||
displayPort_t *pCurrentDisplay;
|
||||
|
||||
static displayPort_t *cmsDisplayPorts[CMS_MAX_DEVICE];
|
||||
static int cmsDeviceCount;
|
||||
|
|
|
@ -8,6 +8,7 @@ extern bool cmsInMenu;
|
|||
|
||||
// Device management
|
||||
bool cmsDisplayPortRegister(displayPort_t *pDisplay);
|
||||
displayPort_t *pCurrentDisplay;
|
||||
|
||||
// For main.c and scheduler
|
||||
void cmsInit(void);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include "telemetry/srxl.h"
|
||||
|
||||
static displayPort_t srxlDisplayPort;
|
||||
displayPort_t srxlDisplayPort;
|
||||
|
||||
static int srxlDrawScreen(displayPort_t *displayPort)
|
||||
{
|
||||
|
|
|
@ -18,3 +18,4 @@
|
|||
#pragma once
|
||||
|
||||
displayPort_t *displayPortSrxlInit();
|
||||
displayPort_t srxlDisplayPort;
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
#include "build/version.h"
|
||||
|
||||
#include "cms/cms.h"
|
||||
#include "io/displayport_srxl.h"
|
||||
|
||||
#include "common/crc.h"
|
||||
#include "common/streambuf.h"
|
||||
#include "common/utils.h"
|
||||
|
@ -232,8 +235,11 @@ static bool lineSent[SPEKTRUM_SRXL_DEVICE_TEXTGEN_ROWS];
|
|||
int spektrumTmTextGenPutChar(uint8_t col, uint8_t row, char c)
|
||||
{
|
||||
if (row < SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS && col < SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS) {
|
||||
srxlTextBuff[row][col] = c;
|
||||
lineSent[row] = false;
|
||||
// Only update and force a tm transmision if something has actually changed.
|
||||
if (srxlTextBuff[row][col] != c) {
|
||||
srxlTextBuff[row][col] = c;
|
||||
lineSent[row] = false;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -448,6 +454,7 @@ const srxlScheduleFnPtr srxlScheduleFuncs[SRXL_TOTAL_COUNT] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
|
||||
static void processSrxl(timeUs_t currentTimeUs)
|
||||
{
|
||||
static uint8_t srxlScheduleIndex = 0;
|
||||
|
@ -462,6 +469,16 @@ static void processSrxl(timeUs_t currentTimeUs)
|
|||
} else {
|
||||
srxlFnPtr = srxlScheduleFuncs[srxlScheduleIndex + srxlScheduleUserIndex];
|
||||
srxlScheduleUserIndex = (srxlScheduleUserIndex + 1) % SRXL_SCHEDULE_USER_COUNT;
|
||||
|
||||
#if defined (USE_SPEKTRUM_CMS_TELEMETRY) && defined (USE_CMS)
|
||||
// Boost CMS performance by sending nothing else but CMS Text frames when in a CMS menu.
|
||||
// Sideeffect, all other reports are still not sent if user leaves CMS without a proper EXIT.
|
||||
if (cmsInMenu &&
|
||||
(pCurrentDisplay == &srxlDisplayPort)) {
|
||||
srxlFnPtr = srxlFrameText;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if (srxlFnPtr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue