Skip to content

Commit

Permalink
Merge branch 'rotorflight:master' into fix_cms_profile_copy_count
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersHoglund authored Jun 28, 2024
2 parents 5db8ebb + fea3988 commit 7debef3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/main/io/displayport_srxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ static int srxlWriteString(displayPort_t *displayPort, uint8_t col, uint8_t row,
static int srxlClearScreen(displayPort_t *displayPort, displayClearOption_e options)
{
UNUSED(options);
for (int row = 0; row < SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS; row++) {
for (int col= 0; col < SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS; col++) {
for (int row = 0; row < SPEKTRUM_SRXL_TEXTGEN_ROWS; row++) {
for (int col= 0; col < SPEKTRUM_SRXL_TEXTGEN_COLS; col++) {
srxlWriteChar(displayPort, col, row, DISPLAYPORT_ATTR_NONE, ' ');
}
}
Expand Down Expand Up @@ -147,8 +147,8 @@ static displayPort_t *displayPortSrxlInit()
{
srxlDisplayPort.device = NULL;
displayInit(&srxlDisplayPort, &srxlVTable, DISPLAYPORT_DEVICE_TYPE_SRXL);
srxlDisplayPort.rows = SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS;
srxlDisplayPort.cols = SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS;
srxlDisplayPort.rows = SPEKTRUM_SRXL_TEXTGEN_ROWS;
srxlDisplayPort.cols = SPEKTRUM_SRXL_TEXTGEN_COLS;

return &srxlDisplayPort;
}
Expand Down
21 changes: 7 additions & 14 deletions src/main/telemetry/srxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ bool srxlFrameFlightPackCurrent(sbuf_t *dst, timeUs_t currentTimeUs)
// Betaflight CMS using Spektrum Tx telemetry TEXT_GEN sensor as display.

#define SPEKTRUM_SRXL_DEVICE_TEXTGEN (0x0C) // Text Generator
#define SPEKTRUM_SRXL_DEVICE_TEXTGEN_ROWS (9) // Text Generator ROWS
#define SPEKTRUM_SRXL_DEVICE_TEXTGEN_COLS (13) // Text Generator COLS

/*
typedef struct
Expand All @@ -473,19 +471,14 @@ typedef struct
} STRU_SPEKTRUM_SRXL_TEXTGEN;
*/

#if ( SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS > SPEKTRUM_SRXL_DEVICE_TEXTGEN_COLS )
static char srxlTextBuff[SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS][SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS];
static bool lineSent[SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS];
#else
static char srxlTextBuff[SPEKTRUM_SRXL_DEVICE_TEXTGEN_ROWS][SPEKTRUM_SRXL_DEVICE_TEXTGEN_COLS];
static bool lineSent[SPEKTRUM_SRXL_DEVICE_TEXTGEN_ROWS];
#endif
static char srxlTextBuff[SPEKTRUM_SRXL_TEXTGEN_ROWS][SPEKTRUM_SRXL_TEXTGEN_COLS];
static bool lineSent[SPEKTRUM_SRXL_TEXTGEN_ROWS];

//**************************************************************************
// API Running in external client task context. E.g. in the CMS task
int spektrumTmTextGenPutChar(uint8_t col, uint8_t row, char c)
{
if (row < SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS && col < SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS) {
if (row < SPEKTRUM_SRXL_TEXTGEN_ROWS && col < SPEKTRUM_SRXL_TEXTGEN_COLS) {
// Only update and force a tm transmision if something has actually changed.
if (srxlTextBuff[row][col] != c) {
srxlTextBuff[row][col] = c;
Expand All @@ -508,18 +501,18 @@ bool srxlFrameText(sbuf_t *dst, timeUs_t currentTimeUs)

// Skip already sent lines...
while (lineSent[lineNo] &&
lineCount < SPEKTRUM_SRXL_DEVICE_TEXTGEN_ROWS) {
lineNo = (lineNo + 1) % SPEKTRUM_SRXL_DEVICE_TEXTGEN_ROWS;
lineCount < SPEKTRUM_SRXL_TEXTGEN_ROWS) {
lineNo = (lineNo + 1) % SPEKTRUM_SRXL_TEXTGEN_ROWS;
lineCount++;
}

sbufWriteU8(dst, SPEKTRUM_SRXL_DEVICE_TEXTGEN);
sbufWriteU8(dst, SRXL_FRAMETYPE_SID);
sbufWriteU8(dst, lineNo);
sbufWriteData(dst, srxlTextBuff[lineNo], SPEKTRUM_SRXL_DEVICE_TEXTGEN_COLS);
sbufWriteData(dst, srxlTextBuff[lineNo], SPEKTRUM_SRXL_TEXTGEN_COLS);

lineSent[lineNo] = true;
lineNo = (lineNo + 1) % SPEKTRUM_SRXL_DEVICE_TEXTGEN_ROWS;
lineNo = (lineNo + 1) % SPEKTRUM_SRXL_TEXTGEN_ROWS;

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/telemetry/srxl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ void initSrxlTelemetry(void);
bool checkSrxlTelemetryState(void);
void handleSrxlTelemetry(timeUs_t currentTimeUs);

#define SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS 9
#define SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS 12 // Airware 1.20
//#define SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS 13 // Airware 1.21
#define SPEKTRUM_SRXL_TEXTGEN_ROWS 9
//#define SPEKTRUM_SRXL_TEXTGEN_COLS 12 // Airware 1.20
#define SPEKTRUM_SRXL_TEXTGEN_COLS 13 // Airware 1.21
#define SPEKTRUM_SRXL_TEXTGEN_CLEAR_SCREEN 255

int spektrumTmTextGenPutChar(uint8_t col, uint8_t row, char c);

0 comments on commit 7debef3

Please sign in to comment.