1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Add up/down page indicator to CMS menu display

Often the user doesn't realize that there are more menu items then displayed and the only way to tell was to try and move the selection to the bottom to see if another page appears.

This PR adds page up/down indicators if there are more menu items than those visible on the current display.

Uses the OSD arrow symbols when possible (for OSD supporting devices), otherwise the `^` (carat) and `V` are used for text-only represenatations.

To determine if the device was capable of displaying symbols the `displayPort` structure has a new `deviceType` set when it is initialized. There have been other times when knowing the type of device would have been useful so that's now supported. Then this is abstracted by a new `displaySupportsOsdSymbols()` function. Devices that support OSD are assumed to support the OSD symbols as the OSD element drawing code always uses them. For devices that don't support OSD function we have to presume the sybols aren't available.
This commit is contained in:
Bruce Luckcuck 2021-01-16 13:29:35 -05:00
parent 35de1c8229
commit 07598d824c
11 changed files with 60 additions and 14 deletions

View file

@ -20,6 +20,16 @@
#pragma once
typedef enum {
DISPLAYPORT_DEVICE_TYPE_MAX7456 = 0,
DISPLAYPORT_DEVICE_TYPE_OLED,
DISPLAYPORT_DEVICE_TYPE_MSP,
DISPLAYPORT_DEVICE_TYPE_FRSKYOSD,
DISPLAYPORT_DEVICE_TYPE_CRSF,
DISPLAYPORT_DEVICE_TYPE_HOTT,
DISPLAYPORT_DEVICE_TYPE_SRXL,
} displayPortDeviceType_e;
typedef enum {
DISPLAYPORT_ATTR_NONE = 0,
DISPLAYPORT_ATTR_INFO,
@ -69,6 +79,9 @@ typedef struct displayPort_s {
// Displayport device capability
bool useDeviceBlink;
// The type of display device
displayPortDeviceType_e deviceType;
} displayPort_t;
typedef struct displayPortVTable_s {
@ -115,8 +128,9 @@ bool displayCheckReady(displayPort_t *instance, bool rescan);
void displayBeginTransaction(displayPort_t *instance, displayTransactionOption_e opts);
void displayCommitTransaction(displayPort_t *instance);
bool displayGetCanvas(struct displayCanvas_s *canvas, const displayPort_t *instance);
void displayInit(displayPort_t *instance, const displayPortVTable_t *vTable);
void displayInit(displayPort_t *instance, const displayPortVTable_t *vTable, displayPortDeviceType_e deviceType);
bool displayLayerSupported(displayPort_t *instance, displayPortLayer_e layer);
bool displayLayerSelect(displayPort_t *instance, displayPortLayer_e layer);
bool displayLayerCopy(displayPort_t *instance, displayPortLayer_e destLayer, displayPortLayer_e sourceLayer);
void displaySetBackgroundType(displayPort_t *instance, displayPortBackground_e backgroundType);
bool displaySupportsOsdSymbols(displayPort_t *instance);