mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
OSD - Add support for async screen clearing to display API.
No screen clearing is actually done asynchronously yet.
This commit is contained in:
parent
f2559fbfd8
commit
e2c0388a6a
17 changed files with 174 additions and 145 deletions
|
@ -268,7 +268,7 @@ static void cmsPageSelect(displayPort_t *instance, int8_t newpage)
|
||||||
for (p = pageTop, i = 0; (p <= pageTop + pageMaxRow); p++, i++) {
|
for (p = pageTop, i = 0; (p <= pageTop + pageMaxRow); p++, i++) {
|
||||||
runtimeEntryFlags[i] = p->flags;
|
runtimeEntryFlags[i] = p->flags;
|
||||||
}
|
}
|
||||||
displayClearScreen(instance);
|
displayClearScreen(instance, DISPLAY_CLEAR_WAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmsPageNext(displayPort_t *instance)
|
static void cmsPageNext(displayPort_t *instance)
|
||||||
|
@ -998,7 +998,7 @@ const void *cmsMenuExit(displayPort_t *pDisplay, const void *ptr)
|
||||||
currentCtx.menu = NULL;
|
currentCtx.menu = NULL;
|
||||||
|
|
||||||
if ((exitType == CMS_EXIT_SAVEREBOOT) || (exitType == CMS_POPUP_SAVEREBOOT) || (exitType == CMS_POPUP_EXITREBOOT)) {
|
if ((exitType == CMS_EXIT_SAVEREBOOT) || (exitType == CMS_POPUP_SAVEREBOOT) || (exitType == CMS_POPUP_EXITREBOOT)) {
|
||||||
displayClearScreen(pDisplay);
|
displayClearScreen(pDisplay, DISPLAY_CLEAR_WAIT);
|
||||||
cmsDisplayWrite(pDisplay, 5, 3, DISPLAYPORT_ATTR_NONE, "REBOOTING...");
|
cmsDisplayWrite(pDisplay, 5, 3, DISPLAYPORT_ATTR_NONE, "REBOOTING...");
|
||||||
|
|
||||||
// Flush display
|
// Flush display
|
||||||
|
@ -1364,6 +1364,92 @@ uint16_t cmsHandleKeyWithRepeat(displayPort_t *pDisplay, cms_key_e key, int repe
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint16_t cmsScanKeys(timeMs_t currentTimeMs, timeMs_t lastCalledMs, int16_t rcDelayMs)
|
||||||
|
{
|
||||||
|
static int holdCount = 1;
|
||||||
|
static int repeatCount = 1;
|
||||||
|
static int repeatBase = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Scan 'key' first
|
||||||
|
//
|
||||||
|
|
||||||
|
cms_key_e key = CMS_KEY_NONE;
|
||||||
|
|
||||||
|
if (externKey != CMS_KEY_NONE) {
|
||||||
|
rcDelayMs = cmsHandleKey(pCurrentDisplay, externKey);
|
||||||
|
externKey = CMS_KEY_NONE;
|
||||||
|
} else {
|
||||||
|
if (IS_MID(THROTTLE) && IS_LO(YAW) && IS_HI(PITCH) && !ARMING_FLAG(ARMED)) {
|
||||||
|
key = CMS_KEY_MENU;
|
||||||
|
} else if (IS_HI(PITCH)) {
|
||||||
|
key = CMS_KEY_UP;
|
||||||
|
} else if (IS_LO(PITCH)) {
|
||||||
|
key = CMS_KEY_DOWN;
|
||||||
|
} else if (IS_LO(ROLL)) {
|
||||||
|
key = CMS_KEY_LEFT;
|
||||||
|
} else if (IS_HI(ROLL)) {
|
||||||
|
key = CMS_KEY_RIGHT;
|
||||||
|
} else if (IS_LO(YAW)) {
|
||||||
|
key = CMS_KEY_ESC;
|
||||||
|
} else if (IS_HI(YAW)) {
|
||||||
|
key = CMS_KEY_SAVEMENU;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == CMS_KEY_NONE) {
|
||||||
|
// No 'key' pressed, reset repeat control
|
||||||
|
holdCount = 1;
|
||||||
|
repeatCount = 1;
|
||||||
|
repeatBase = 0;
|
||||||
|
} else {
|
||||||
|
// The 'key' is being pressed; keep counting
|
||||||
|
++holdCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rcDelayMs > 0) {
|
||||||
|
rcDelayMs -= (currentTimeMs - lastCalledMs);
|
||||||
|
} else if (key) {
|
||||||
|
rcDelayMs = cmsHandleKeyWithRepeat(pCurrentDisplay, key, repeatCount);
|
||||||
|
|
||||||
|
// Key repeat effect is implemented in two phases.
|
||||||
|
// First phldase is to decrease rcDelayMs reciprocal to hold time.
|
||||||
|
// When rcDelayMs reached a certain limit (scheduling interval),
|
||||||
|
// repeat rate will not raise anymore, so we call key handler
|
||||||
|
// multiple times (repeatCount).
|
||||||
|
//
|
||||||
|
// XXX Caveat: Most constants are adjusted pragmatically.
|
||||||
|
// XXX Rewrite this someday, so it uses actual hold time instead
|
||||||
|
// of holdCount, which depends on the scheduling interval.
|
||||||
|
|
||||||
|
if (((key == CMS_KEY_LEFT) || (key == CMS_KEY_RIGHT)) && (holdCount > 20)) {
|
||||||
|
|
||||||
|
// Decrease rcDelayMs reciprocally
|
||||||
|
|
||||||
|
rcDelayMs /= (holdCount - 20);
|
||||||
|
|
||||||
|
// When we reach the scheduling limit,
|
||||||
|
|
||||||
|
if (rcDelayMs <= 50) {
|
||||||
|
|
||||||
|
// start calling handler multiple times.
|
||||||
|
|
||||||
|
if (repeatBase == 0) {
|
||||||
|
repeatBase = holdCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
repeatCount = repeatCount + (holdCount - repeatBase) / 5;
|
||||||
|
|
||||||
|
if (repeatCount > 5) {
|
||||||
|
repeatCount= 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rcDelayMs;
|
||||||
|
}
|
||||||
|
|
||||||
static void cmsUpdate(uint32_t currentTimeUs)
|
static void cmsUpdate(uint32_t currentTimeUs)
|
||||||
{
|
{
|
||||||
if (IS_RC_MODE_ACTIVE(BOXPARALYZE)
|
if (IS_RC_MODE_ACTIVE(BOXPARALYZE)
|
||||||
|
@ -1378,9 +1464,6 @@ static void cmsUpdate(uint32_t currentTimeUs)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t rcDelayMs = BUTTON_TIME;
|
static int16_t rcDelayMs = BUTTON_TIME;
|
||||||
static int holdCount = 1;
|
|
||||||
static int repeatCount = 1;
|
|
||||||
static int repeatBase = 0;
|
|
||||||
|
|
||||||
static uint32_t lastCalledMs = 0;
|
static uint32_t lastCalledMs = 0;
|
||||||
static uint32_t lastCmsHeartBeatMs = 0;
|
static uint32_t lastCmsHeartBeatMs = 0;
|
||||||
|
@ -1394,82 +1477,9 @@ static void cmsUpdate(uint32_t currentTimeUs)
|
||||||
rcDelayMs = BUTTON_PAUSE; // Tends to overshoot if BUTTON_TIME
|
rcDelayMs = BUTTON_PAUSE; // Tends to overshoot if BUTTON_TIME
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
displayBeginTransaction(pCurrentDisplay, DISPLAY_TRANSACTION_OPT_RESET_DRAWING);
|
||||||
// Scan 'key' first
|
|
||||||
//
|
|
||||||
|
|
||||||
cms_key_e key = CMS_KEY_NONE;
|
rcDelayMs = cmsScanKeys(currentTimeMs, lastCalledMs, rcDelayMs);
|
||||||
|
|
||||||
if (externKey != CMS_KEY_NONE) {
|
|
||||||
rcDelayMs = cmsHandleKey(pCurrentDisplay, externKey);
|
|
||||||
externKey = CMS_KEY_NONE;
|
|
||||||
} else {
|
|
||||||
if (IS_MID(THROTTLE) && IS_LO(YAW) && IS_HI(PITCH) && !ARMING_FLAG(ARMED)) {
|
|
||||||
key = CMS_KEY_MENU;
|
|
||||||
} else if (IS_HI(PITCH)) {
|
|
||||||
key = CMS_KEY_UP;
|
|
||||||
} else if (IS_LO(PITCH)) {
|
|
||||||
key = CMS_KEY_DOWN;
|
|
||||||
} else if (IS_LO(ROLL)) {
|
|
||||||
key = CMS_KEY_LEFT;
|
|
||||||
} else if (IS_HI(ROLL)) {
|
|
||||||
key = CMS_KEY_RIGHT;
|
|
||||||
} else if (IS_LO(YAW)) {
|
|
||||||
key = CMS_KEY_ESC;
|
|
||||||
} else if (IS_HI(YAW)) {
|
|
||||||
key = CMS_KEY_SAVEMENU;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == CMS_KEY_NONE) {
|
|
||||||
// No 'key' pressed, reset repeat control
|
|
||||||
holdCount = 1;
|
|
||||||
repeatCount = 1;
|
|
||||||
repeatBase = 0;
|
|
||||||
} else {
|
|
||||||
// The 'key' is being pressed; keep counting
|
|
||||||
++holdCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rcDelayMs > 0) {
|
|
||||||
rcDelayMs -= (currentTimeMs - lastCalledMs);
|
|
||||||
} else if (key) {
|
|
||||||
rcDelayMs = cmsHandleKeyWithRepeat(pCurrentDisplay, key, repeatCount);
|
|
||||||
|
|
||||||
// Key repeat effect is implemented in two phases.
|
|
||||||
// First phldase is to decrease rcDelayMs reciprocal to hold time.
|
|
||||||
// When rcDelayMs reached a certain limit (scheduling interval),
|
|
||||||
// repeat rate will not raise anymore, so we call key handler
|
|
||||||
// multiple times (repeatCount).
|
|
||||||
//
|
|
||||||
// XXX Caveat: Most constants are adjusted pragmatically.
|
|
||||||
// XXX Rewrite this someday, so it uses actual hold time instead
|
|
||||||
// of holdCount, which depends on the scheduling interval.
|
|
||||||
|
|
||||||
if (((key == CMS_KEY_LEFT) || (key == CMS_KEY_RIGHT)) && (holdCount > 20)) {
|
|
||||||
|
|
||||||
// Decrease rcDelayMs reciprocally
|
|
||||||
|
|
||||||
rcDelayMs /= (holdCount - 20);
|
|
||||||
|
|
||||||
// When we reach the scheduling limit,
|
|
||||||
|
|
||||||
if (rcDelayMs <= 50) {
|
|
||||||
|
|
||||||
// start calling handler multiple times.
|
|
||||||
|
|
||||||
if (repeatBase == 0) {
|
|
||||||
repeatBase = holdCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
repeatCount = repeatCount + (holdCount - repeatBase) / 5;
|
|
||||||
|
|
||||||
if (repeatCount > 5) {
|
|
||||||
repeatCount= 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cmsDrawMenu(pCurrentDisplay, currentTimeUs);
|
cmsDrawMenu(pCurrentDisplay, currentTimeUs);
|
||||||
|
|
||||||
|
@ -1479,6 +1489,8 @@ static void cmsUpdate(uint32_t currentTimeUs)
|
||||||
displayHeartbeat(pCurrentDisplay);
|
displayHeartbeat(pCurrentDisplay);
|
||||||
lastCmsHeartBeatMs = currentTimeMs;
|
lastCmsHeartBeatMs = currentTimeMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayCommitTransaction(pCurrentDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some key (command), notably flash erase, takes too long to use the
|
// Some key (command), notably flash erase, takes too long to use the
|
||||||
|
|
|
@ -169,7 +169,7 @@ static const void *cmsx_EraseFlash(displayPort_t *pDisplay, const void *ptr)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayClearScreen(pDisplay);
|
displayClearScreen(pDisplay, DISPLAY_CLEAR_WAIT);
|
||||||
displayWrite(pDisplay, 5, 3, DISPLAYPORT_ATTR_INFO, "ERASING FLASH...");
|
displayWrite(pDisplay, 5, 3, DISPLAYPORT_ATTR_INFO, "ERASING FLASH...");
|
||||||
displayRedraw(pDisplay);
|
displayRedraw(pDisplay);
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ static const void *cmsx_EraseFlash(displayPort_t *pDisplay, const void *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
beeper(BEEPER_BLACKBOX_ERASE);
|
beeper(BEEPER_BLACKBOX_ERASE);
|
||||||
displayClearScreen(pDisplay);
|
displayClearScreen(pDisplay, DISPLAY_CLEAR_WAIT);
|
||||||
displayRedraw(pDisplay);
|
displayRedraw(pDisplay);
|
||||||
|
|
||||||
// Update storage device status to show new used space amount
|
// Update storage device status to show new used space amount
|
||||||
|
|
|
@ -356,7 +356,7 @@ static const void *cmsx_max7456Update(displayPort_t *pDisp, const void *self)
|
||||||
displayPortProfileMax7456Mutable()->blackBrightness = displayPortProfileMax7456_blackBrightness;
|
displayPortProfileMax7456Mutable()->blackBrightness = displayPortProfileMax7456_blackBrightness;
|
||||||
displayPortProfileMax7456Mutable()->whiteBrightness = displayPortProfileMax7456_whiteBrightness;
|
displayPortProfileMax7456Mutable()->whiteBrightness = displayPortProfileMax7456_whiteBrightness;
|
||||||
|
|
||||||
displayClearScreen(pDisp);
|
displayClearScreen(pDisp, DISPLAY_CLEAR_WAIT);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ static const void *cmsx_ResetStats(displayPort_t *pDisplay, const void *ptr)
|
||||||
stats_total_time_s = 0;
|
stats_total_time_s = 0;
|
||||||
stats_total_dist_m = 0;
|
stats_total_dist_m = 0;
|
||||||
|
|
||||||
displayClearScreen(pDisplay);
|
displayClearScreen(pDisplay, DISPLAY_CLEAR_WAIT);
|
||||||
displayRedraw(pDisplay);
|
displayRedraw(pDisplay);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
void displayClearScreen(displayPort_t *instance)
|
void displayClearScreen(displayPort_t *instance, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
instance->vTable->clearScreen(instance);
|
instance->vTable->clearScreen(instance, options);
|
||||||
instance->cleared = true;
|
instance->cleared = true;
|
||||||
instance->cursorRow = -1;
|
instance->cursorRow = -1;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ int displayScreenSize(const displayPort_t *instance)
|
||||||
void displayGrab(displayPort_t *instance)
|
void displayGrab(displayPort_t *instance)
|
||||||
{
|
{
|
||||||
instance->vTable->grab(instance);
|
instance->vTable->grab(instance);
|
||||||
instance->vTable->clearScreen(instance);
|
instance->vTable->clearScreen(instance, DISPLAY_CLEAR_WAIT);
|
||||||
++instance->grabCount;
|
++instance->grabCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,10 +216,11 @@ bool displaySupportsOsdSymbols(displayPort_t *instance)
|
||||||
void displayInit(displayPort_t *instance, const displayPortVTable_t *vTable, displayPortDeviceType_e deviceType)
|
void displayInit(displayPort_t *instance, const displayPortVTable_t *vTable, displayPortDeviceType_e deviceType)
|
||||||
{
|
{
|
||||||
instance->vTable = vTable;
|
instance->vTable = vTable;
|
||||||
instance->vTable->clearScreen(instance);
|
|
||||||
instance->useFullscreen = false;
|
instance->useFullscreen = false;
|
||||||
instance->cleared = true;
|
|
||||||
instance->grabCount = 0;
|
instance->grabCount = 0;
|
||||||
instance->cursorRow = -1;
|
|
||||||
instance->deviceType = deviceType;
|
instance->deviceType = deviceType;
|
||||||
|
|
||||||
|
displayBeginTransaction(instance, DISPLAY_TRANSACTION_OPT_NONE);
|
||||||
|
displayClearScreen(instance, DISPLAY_CLEAR_WAIT);
|
||||||
|
displayCommitTransaction(instance);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,11 @@ typedef enum {
|
||||||
DISPLAY_BACKGROUND_COUNT // must be the last entry
|
DISPLAY_BACKGROUND_COUNT // must be the last entry
|
||||||
} displayPortBackground_e;
|
} displayPortBackground_e;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DISPLAY_CLEAR_NONE = 0,
|
||||||
|
DISPLAY_CLEAR_WAIT = 1 << 0,
|
||||||
|
} displayClearOption_e;
|
||||||
|
|
||||||
struct displayCanvas_s;
|
struct displayCanvas_s;
|
||||||
struct osdCharacter_s;
|
struct osdCharacter_s;
|
||||||
struct displayPortVTable_s;
|
struct displayPortVTable_s;
|
||||||
|
@ -87,7 +92,7 @@ typedef struct displayPort_s {
|
||||||
typedef struct displayPortVTable_s {
|
typedef struct displayPortVTable_s {
|
||||||
int (*grab)(displayPort_t *displayPort);
|
int (*grab)(displayPort_t *displayPort);
|
||||||
int (*release)(displayPort_t *displayPort);
|
int (*release)(displayPort_t *displayPort);
|
||||||
int (*clearScreen)(displayPort_t *displayPort);
|
int (*clearScreen)(displayPort_t *displayPort, displayClearOption_e options);
|
||||||
bool (*drawScreen)(displayPort_t *displayPort);
|
bool (*drawScreen)(displayPort_t *displayPort);
|
||||||
int (*screenSize)(const displayPort_t *displayPort);
|
int (*screenSize)(const displayPort_t *displayPort);
|
||||||
int (*writeString)(displayPort_t *displayPort, uint8_t x, uint8_t y, uint8_t attr, const char *text);
|
int (*writeString)(displayPort_t *displayPort, uint8_t x, uint8_t y, uint8_t attr, const char *text);
|
||||||
|
@ -112,7 +117,7 @@ void displayGrab(displayPort_t *instance);
|
||||||
void displayRelease(displayPort_t *instance);
|
void displayRelease(displayPort_t *instance);
|
||||||
void displayReleaseAll(displayPort_t *instance);
|
void displayReleaseAll(displayPort_t *instance);
|
||||||
bool displayIsGrabbed(const displayPort_t *instance);
|
bool displayIsGrabbed(const displayPort_t *instance);
|
||||||
void displayClearScreen(displayPort_t *instance);
|
void displayClearScreen(displayPort_t *instance, displayClearOption_e options);
|
||||||
bool displayDrawScreen(displayPort_t *instance);
|
bool displayDrawScreen(displayPort_t *instance);
|
||||||
int displayScreenSize(const displayPort_t *instance);
|
int displayScreenSize(const displayPort_t *instance);
|
||||||
void displaySetXY(displayPort_t *instance, uint8_t x, uint8_t y);
|
void displaySetXY(displayPort_t *instance, uint8_t x, uint8_t y);
|
||||||
|
|
|
@ -49,9 +49,10 @@ static int crsfGrab(displayPort_t *displayPort)
|
||||||
return displayPort->grabCount = 1;
|
return displayPort->grabCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int crsfClearScreen(displayPort_t *displayPort)
|
static int crsfClearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
UNUSED(displayPort);
|
UNUSED(displayPort);
|
||||||
|
UNUSED(options);
|
||||||
memset(crsfScreen.buffer, ' ', sizeof(crsfScreen.buffer));
|
memset(crsfScreen.buffer, ' ', sizeof(crsfScreen.buffer));
|
||||||
crsfScreen.updated = false;
|
crsfScreen.updated = false;
|
||||||
crsfScreen.reset = true;
|
crsfScreen.reset = true;
|
||||||
|
@ -62,7 +63,7 @@ static int crsfClearScreen(displayPort_t *displayPort)
|
||||||
static int crsfRelease(displayPort_t *displayPort)
|
static int crsfRelease(displayPort_t *displayPort)
|
||||||
{
|
{
|
||||||
displayPort->grabCount = 0;
|
displayPort->grabCount = 0;
|
||||||
return crsfClearScreen(displayPort);
|
return crsfClearScreen(displayPort, DISPLAY_CLEAR_WAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool crsfDrawScreen(displayPort_t *displayPort)
|
static bool crsfDrawScreen(displayPort_t *displayPort)
|
||||||
|
|
|
@ -47,9 +47,10 @@ static int release(displayPort_t *displayPort)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clearScreen(displayPort_t *displayPort)
|
static int clearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
UNUSED(displayPort);
|
UNUSED(displayPort);
|
||||||
|
UNUSED(options);
|
||||||
frskyOsdClearScreen();
|
frskyOsdClearScreen();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,10 @@ static int hottWriteString(displayPort_t *displayPort, uint8_t col, uint8_t row,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hottClearScreen(displayPort_t *displayPort)
|
static int hottClearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
|
UNUSED(options);
|
||||||
|
|
||||||
for (int row = 0; row < displayPort->rows; row++) {
|
for (int row = 0; row < displayPort->rows; row++) {
|
||||||
for (int col= 0; col < displayPort->cols; col++) {
|
for (int col= 0; col < displayPort->cols; col++) {
|
||||||
hottWriteChar(displayPort, col, row, DISPLAYPORT_ATTR_NONE, ' ');
|
hottWriteChar(displayPort, col, row, DISPLAYPORT_ATTR_NONE, ' ');
|
||||||
|
@ -106,7 +108,7 @@ static int hottGrab(displayPort_t *displayPort)
|
||||||
static int hottRelease(displayPort_t *displayPort)
|
static int hottRelease(displayPort_t *displayPort)
|
||||||
{
|
{
|
||||||
int cnt = displayPort->grabCount = 0;
|
int cnt = displayPort->grabCount = 0;
|
||||||
hottClearScreen(displayPort);
|
hottClearScreen(displayPort, DISPLAY_CLEAR_WAIT);
|
||||||
hottTextmodeExit();
|
hottTextmodeExit();
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,10 @@ static int release(displayPort_t *displayPort)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clearScreen(displayPort_t *displayPort)
|
static int clearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
UNUSED(displayPort);
|
UNUSED(displayPort);
|
||||||
|
UNUSED(options);
|
||||||
|
|
||||||
max7456Invert(displayPortProfileMax7456()->invert);
|
max7456Invert(displayPortProfileMax7456()->invert);
|
||||||
max7456Brightness(displayPortProfileMax7456()->blackBrightness, displayPortProfileMax7456()->whiteBrightness);
|
max7456Brightness(displayPortProfileMax7456()->blackBrightness, displayPortProfileMax7456()->whiteBrightness);
|
||||||
|
|
|
@ -81,8 +81,10 @@ static int release(displayPort_t *displayPort)
|
||||||
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clearScreen(displayPort_t *displayPort)
|
static int clearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
|
UNUSED(options);
|
||||||
|
|
||||||
uint8_t subcmd[] = { 2 };
|
uint8_t subcmd[] = { 2 };
|
||||||
|
|
||||||
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
||||||
|
|
|
@ -42,8 +42,10 @@ static int oledRelease(displayPort_t *displayPort)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int oledClearScreen(displayPort_t *displayPort)
|
static int oledClearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
|
UNUSED(options);
|
||||||
|
|
||||||
i2c_OLED_clear_display_quick(displayPort->device);
|
i2c_OLED_clear_display_quick(displayPort->device);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,9 @@ static int srxlWriteString(displayPort_t *displayPort, uint8_t col, uint8_t row,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int srxlClearScreen(displayPort_t *displayPort)
|
static int srxlClearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
|
UNUSED(options);
|
||||||
for (int row = 0; row < SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS; row++) {
|
for (int row = 0; row < SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS; row++) {
|
||||||
for (int col= 0; col < SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS; col++) {
|
for (int col= 0; col < SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS; col++) {
|
||||||
srxlWriteChar(displayPort, col, row, DISPLAYPORT_ATTR_NONE, ' ');
|
srxlWriteChar(displayPort, col, row, DISPLAYPORT_ATTR_NONE, ' ');
|
||||||
|
@ -120,7 +121,7 @@ static int srxlGrab(displayPort_t *displayPort)
|
||||||
static int srxlRelease(displayPort_t *displayPort)
|
static int srxlRelease(displayPort_t *displayPort)
|
||||||
{
|
{
|
||||||
int cnt = displayPort->grabCount = 0;
|
int cnt = displayPort->grabCount = 0;
|
||||||
srxlClearScreen(displayPort);
|
srxlClearScreen(displayPort, DISPLAY_CLEAR_WAIT);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -428,7 +428,7 @@ static void osdCompleteInitialization(void)
|
||||||
displayLayerSelect(osdDisplayPort, DISPLAYPORT_LAYER_FOREGROUND);
|
displayLayerSelect(osdDisplayPort, DISPLAYPORT_LAYER_FOREGROUND);
|
||||||
|
|
||||||
displayBeginTransaction(osdDisplayPort, DISPLAY_TRANSACTION_OPT_RESET_DRAWING);
|
displayBeginTransaction(osdDisplayPort, DISPLAY_TRANSACTION_OPT_RESET_DRAWING);
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
|
|
||||||
osdDrawLogo(3, 1);
|
osdDrawLogo(3, 1);
|
||||||
|
|
||||||
|
@ -903,14 +903,14 @@ static void osdRefreshStats(void)
|
||||||
// Non-flight operation which takes a little longer than normal
|
// Non-flight operation which takes a little longer than normal
|
||||||
schedulerIgnoreTaskExecTime();
|
schedulerIgnoreTaskExecTime();
|
||||||
|
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
if (osdStatsRowCount == 0) {
|
if (osdStatsRowCount == 0) {
|
||||||
// No stats row count has been set yet.
|
// No stats row count has been set yet.
|
||||||
// Go through the logic one time to determine how many stats are actually displayed.
|
// Go through the logic one time to determine how many stats are actually displayed.
|
||||||
osdStatsRowCount = osdShowStats(0);
|
osdStatsRowCount = osdShowStats(0);
|
||||||
// Then clear the screen and commence with normal stats display which will
|
// Then clear the screen and commence with normal stats display which will
|
||||||
// determine if the heading should be displayed and also center the content vertically.
|
// determine if the heading should be displayed and also center the content vertically.
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
}
|
}
|
||||||
osdShowStats(osdStatsRowCount);
|
osdShowStats(osdStatsRowCount);
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ static timeDelta_t osdShowArmed(void)
|
||||||
{
|
{
|
||||||
timeDelta_t ret;
|
timeDelta_t ret;
|
||||||
|
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
|
|
||||||
if ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_ON) || ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_FIRST) && !ARMING_FLAG(WAS_EVER_ARMED))) {
|
if ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_ON) || ((osdConfig()->logo_on_arming == OSD_LOGO_ARMING_FIRST) && !ARMING_FLAG(WAS_EVER_ARMED))) {
|
||||||
osdDrawLogo(3, 1);
|
osdDrawLogo(3, 1);
|
||||||
|
@ -973,7 +973,7 @@ STATIC_UNIT_TESTED void osdDrawStats1(timeUs_t currentTimeUs)
|
||||||
} else {
|
} else {
|
||||||
if (IS_RC_MODE_ACTIVE(BOXOSD) && osdStatsVisible) {
|
if (IS_RC_MODE_ACTIVE(BOXOSD) && osdStatsVisible) {
|
||||||
osdStatsVisible = false;
|
osdStatsVisible = false;
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
} else if (!IS_RC_MODE_ACTIVE(BOXOSD)) {
|
} else if (!IS_RC_MODE_ACTIVE(BOXOSD)) {
|
||||||
if (!osdStatsVisible) {
|
if (!osdStatsVisible) {
|
||||||
osdStatsVisible = true;
|
osdStatsVisible = true;
|
||||||
|
@ -1001,7 +1001,7 @@ void osdDrawStats2(timeUs_t currentTimeUs)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
resumeRefreshAt = 0;
|
resumeRefreshAt = 0;
|
||||||
osdStatsEnabled = false;
|
osdStatsEnabled = false;
|
||||||
stats.armed_time = 0;
|
stats.armed_time = 0;
|
||||||
|
@ -1172,7 +1172,7 @@ void osdUpdate(timeUs_t currentTimeUs)
|
||||||
case OSD_STATE_UPDATE_CANVAS:
|
case OSD_STATE_UPDATE_CANVAS:
|
||||||
// Hide OSD when OSDSW mode is active
|
// Hide OSD when OSDSW mode is active
|
||||||
if (IS_RC_MODE_ACTIVE(BOXOSD)) {
|
if (IS_RC_MODE_ACTIVE(BOXOSD)) {
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdState = OSD_STATE_COMMIT;
|
osdState = OSD_STATE_COMMIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1184,7 +1184,7 @@ void osdUpdate(timeUs_t currentTimeUs)
|
||||||
} else {
|
} else {
|
||||||
// Background layer not supported, just clear the foreground in preparation
|
// Background layer not supported, just clear the foreground in preparation
|
||||||
// for drawing the elements including their backgrounds.
|
// for drawing the elements including their backgrounds.
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_GPS
|
#ifdef USE_GPS
|
||||||
|
|
|
@ -1846,7 +1846,7 @@ void osdDrawActiveElementsBackground(displayPort_t *osdDisplayPort)
|
||||||
{
|
{
|
||||||
if (backgroundLayerSupported) {
|
if (backgroundLayerSupported) {
|
||||||
displayLayerSelect(osdDisplayPort, DISPLAYPORT_LAYER_BACKGROUND);
|
displayLayerSelect(osdDisplayPort, DISPLAYPORT_LAYER_BACKGROUND);
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
for (unsigned i = 0; i < activeOsdElementCount; i++) {
|
for (unsigned i = 0; i < activeOsdElementCount; i++) {
|
||||||
osdDrawSingleElementBackground(osdDisplayPort, activeOsdElementArray[i]);
|
osdDrawSingleElementBackground(osdDisplayPort, activeOsdElementArray[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -744,7 +744,7 @@ TEST_F(OsdTest, TestElementRssi)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
rssi = 1024;
|
rssi = 1024;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -752,7 +752,7 @@ TEST_F(OsdTest, TestElementRssi)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
rssi = 0;
|
rssi = 0;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -760,7 +760,7 @@ TEST_F(OsdTest, TestElementRssi)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
rssi = 512;
|
rssi = 512;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -779,7 +779,7 @@ TEST_F(OsdTest, TestElementAmperage)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationBatteryAmperage = 0;
|
simulationBatteryAmperage = 0;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -787,7 +787,7 @@ TEST_F(OsdTest, TestElementAmperage)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationBatteryAmperage = 2156;
|
simulationBatteryAmperage = 2156;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -795,7 +795,7 @@ TEST_F(OsdTest, TestElementAmperage)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationBatteryAmperage = 12345;
|
simulationBatteryAmperage = 12345;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -814,7 +814,7 @@ TEST_F(OsdTest, TestElementMahDrawn)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationMahDrawn = 0;
|
simulationMahDrawn = 0;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -822,7 +822,7 @@ TEST_F(OsdTest, TestElementMahDrawn)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationMahDrawn = 4;
|
simulationMahDrawn = 4;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -830,7 +830,7 @@ TEST_F(OsdTest, TestElementMahDrawn)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationMahDrawn = 15;
|
simulationMahDrawn = 15;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -838,7 +838,7 @@ TEST_F(OsdTest, TestElementMahDrawn)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationMahDrawn = 246;
|
simulationMahDrawn = 246;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -846,7 +846,7 @@ TEST_F(OsdTest, TestElementMahDrawn)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationMahDrawn = 1042;
|
simulationMahDrawn = 1042;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -870,7 +870,7 @@ TEST_F(OsdTest, TestElementPower)
|
||||||
simulationBatteryAmperage = 0; // 0A
|
simulationBatteryAmperage = 0; // 0A
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -880,7 +880,7 @@ TEST_F(OsdTest, TestElementPower)
|
||||||
simulationBatteryAmperage = 10; // 0.1A
|
simulationBatteryAmperage = 10; // 0.1A
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -890,7 +890,7 @@ TEST_F(OsdTest, TestElementPower)
|
||||||
simulationBatteryAmperage = 120; // 1.2A
|
simulationBatteryAmperage = 120; // 1.2A
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -900,7 +900,7 @@ TEST_F(OsdTest, TestElementPower)
|
||||||
simulationBatteryAmperage = 1230; // 12.3A
|
simulationBatteryAmperage = 1230; // 12.3A
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -910,7 +910,7 @@ TEST_F(OsdTest, TestElementPower)
|
||||||
simulationBatteryAmperage = 12340; // 123.4A
|
simulationBatteryAmperage = 12340; // 123.4A
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -933,7 +933,7 @@ TEST_F(OsdTest, TestElementAltitude)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationAltitude = 0;
|
simulationAltitude = 0;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -941,7 +941,7 @@ TEST_F(OsdTest, TestElementAltitude)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
sensorsSet(SENSOR_GPS);
|
sensorsSet(SENSOR_GPS);
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -949,7 +949,7 @@ TEST_F(OsdTest, TestElementAltitude)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationAltitude = 247; // rounds to 2.5m
|
simulationAltitude = 247; // rounds to 2.5m
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -957,7 +957,7 @@ TEST_F(OsdTest, TestElementAltitude)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationAltitude = 4247; // rounds to 42.5m
|
simulationAltitude = 4247; // rounds to 42.5m
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -965,7 +965,7 @@ TEST_F(OsdTest, TestElementAltitude)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationAltitude = -247; // rounds to -2.5m
|
simulationAltitude = -247; // rounds to -2.5m
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -973,7 +973,7 @@ TEST_F(OsdTest, TestElementAltitude)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
simulationAltitude = -70;
|
simulationAltitude = -70;
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -998,7 +998,7 @@ TEST_F(OsdTest, TestElementCoreTemperature)
|
||||||
simulationCoreTemperature = 0;
|
simulationCoreTemperature = 0;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -1008,7 +1008,7 @@ TEST_F(OsdTest, TestElementCoreTemperature)
|
||||||
simulationCoreTemperature = 33;
|
simulationCoreTemperature = 33;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -1018,7 +1018,7 @@ TEST_F(OsdTest, TestElementCoreTemperature)
|
||||||
osdConfigMutable()->units = UNIT_IMPERIAL;
|
osdConfigMutable()->units = UNIT_IMPERIAL;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -1052,7 +1052,7 @@ TEST_F(OsdTest, TestElementWarningsBattery)
|
||||||
simulationBatteryState = BATTERY_OK;
|
simulationBatteryState = BATTERY_OK;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
// Delay as the warnings are flashing
|
// Delay as the warnings are flashing
|
||||||
simulationTime += 1000000;
|
simulationTime += 1000000;
|
||||||
simulationTime -= simulationTime % 1000000;
|
simulationTime -= simulationTime % 1000000;
|
||||||
|
@ -1067,7 +1067,7 @@ TEST_F(OsdTest, TestElementWarningsBattery)
|
||||||
simulationBatteryState = BATTERY_OK;
|
simulationBatteryState = BATTERY_OK;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -1079,7 +1079,7 @@ TEST_F(OsdTest, TestElementWarningsBattery)
|
||||||
simulationBatteryState = BATTERY_WARNING;
|
simulationBatteryState = BATTERY_WARNING;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
// Delay as the warnings are flashing
|
// Delay as the warnings are flashing
|
||||||
simulationTime += 1000000;
|
simulationTime += 1000000;
|
||||||
simulationTime -= simulationTime % 1000000;
|
simulationTime -= simulationTime % 1000000;
|
||||||
|
@ -1094,7 +1094,7 @@ TEST_F(OsdTest, TestElementWarningsBattery)
|
||||||
simulationBatteryState = BATTERY_CRITICAL;
|
simulationBatteryState = BATTERY_CRITICAL;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
// Delay as the warnings are flashing
|
// Delay as the warnings are flashing
|
||||||
simulationTime += 1000000;
|
simulationTime += 1000000;
|
||||||
simulationTime -= simulationTime % 1000000;
|
simulationTime -= simulationTime % 1000000;
|
||||||
|
@ -1109,7 +1109,7 @@ TEST_F(OsdTest, TestElementWarningsBattery)
|
||||||
simulationBatteryState = BATTERY_OK;
|
simulationBatteryState = BATTERY_OK;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -1197,7 +1197,7 @@ TEST_F(OsdTest, TestGpsElements)
|
||||||
simulationGpsHealthy = false;
|
simulationGpsHealthy = false;
|
||||||
gpsSol.numSat = 0;
|
gpsSol.numSat = 0;
|
||||||
|
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -1221,7 +1221,7 @@ TEST_F(OsdTest, TestGpsElements)
|
||||||
simulationGpsHealthy = true;
|
simulationGpsHealthy = true;
|
||||||
gpsSol.numSat = 0;
|
gpsSol.numSat = 0;
|
||||||
|
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -1245,7 +1245,7 @@ TEST_F(OsdTest, TestGpsElements)
|
||||||
simulationGpsHealthy = true;
|
simulationGpsHealthy = true;
|
||||||
gpsSol.numSat = 10;
|
gpsSol.numSat = 10;
|
||||||
|
|
||||||
displayClearScreen(&testDisplayPort);
|
displayClearScreen(&testDisplayPort, DISPLAY_CLEAR_WAIT);
|
||||||
osdRefresh();
|
osdRefresh();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
|
|
@ -48,9 +48,10 @@ static int displayPortTestRelease(displayPort_t *displayPort)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int displayPortTestClearScreen(displayPort_t *displayPort)
|
static int displayPortTestClearScreen(displayPort_t *displayPort, displayClearOption_e options)
|
||||||
{
|
{
|
||||||
UNUSED(displayPort);
|
UNUSED(displayPort);
|
||||||
|
UNUSED(options);
|
||||||
memset(testDisplayPortBuffer, ' ', UNITTEST_DISPLAYPORT_BUFFER_LEN);
|
memset(testDisplayPortBuffer, ' ', UNITTEST_DISPLAYPORT_BUFFER_LEN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue