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

Add HD OSD system elements for VTX temp and goggle fan speed (#11999)

* Add HD OSD system elements for VTX temp and goggle fan speed

* Update src/main/osd/osd_elements.c

Co-authored-by: haslinghuis <mark@numloq.nl>

Co-authored-by: haslinghuis <mark@numloq.nl>
This commit is contained in:
Steve Evans 2022-12-05 03:23:15 +00:00 committed by GitHub
parent f8bd0b5388
commit 23602e6a89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 1 deletions

View file

@ -116,6 +116,8 @@ typedef enum {
DISPLAYPORT_SYS_GOGGLE_DVR = 6,
DISPLAYPORT_SYS_VTX_DVR = 7,
DISPLAYPORT_SYS_WARNINGS = 8,
DISPLAYPORT_SYS_VTX_TEMP = 9,
DISPLAYPORT_SYS_FAN_SPEED = 10,
DISPLAYPORT_SYS_COUNT,
} displayPortSystemElement_e;
```

View file

@ -1440,6 +1440,8 @@ const clivalue_t valueTable[] = {
{ "osd_sys_goggle_dvr_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SYS_GOGGLE_DVR]) },
{ "osd_sys_vtx_dvr_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SYS_VTX_DVR]) },
{ "osd_sys_warnings_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SYS_WARNINGS]) },
{ "osd_sys_vtx_temp_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SYS_VTX_TEMP]) },
{ "osd_sys_fan_speed_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SYS_FAN_SPEED]) },
#endif
// OSD stats enabled flags are stored as bitmapped values inside a 32bit parameter

View file

@ -51,6 +51,8 @@ typedef enum {
DISPLAYPORT_SYS_GOGGLE_DVR = 6,
DISPLAYPORT_SYS_VTX_DVR = 7,
DISPLAYPORT_SYS_WARNINGS = 8,
DISPLAYPORT_SYS_VTX_TEMP = 9,
DISPLAYPORT_SYS_FAN_SPEED = 10,
DISPLAYPORT_SYS_COUNT,
} displayPortSystemElement_e;

View file

@ -181,6 +181,8 @@ typedef enum {
OSD_SYS_GOGGLE_DVR,
OSD_SYS_VTX_DVR,
OSD_SYS_WARNINGS,
OSD_SYS_VTX_TEMP,
OSD_SYS_FAN_SPEED,
OSD_ITEM_COUNT // MUST BE LAST
} osd_items_e;

View file

@ -1725,6 +1725,8 @@ static const uint8_t osdElementDisplayOrder[] = {
OSD_SYS_GOGGLE_DVR,
OSD_SYS_VTX_DVR,
OSD_SYS_WARNINGS,
OSD_SYS_VTX_TEMP,
OSD_SYS_FAN_SPEED,
};
// Define the mapping between the OSD element id and the function to draw it
@ -1856,6 +1858,8 @@ const osdElementDrawFn osdElementDrawFunction[OSD_ITEM_COUNT] = {
[OSD_SYS_GOGGLE_DVR] = osdElementSys,
[OSD_SYS_VTX_DVR] = osdElementSys,
[OSD_SYS_WARNINGS] = osdElementSys,
[OSD_SYS_VTX_TEMP] = osdElementSys,
[OSD_SYS_FAN_SPEED] = osdElementSys,
#endif
};
@ -1950,7 +1954,7 @@ static void osdDrawSingleElement(displayPort_t *osdDisplayPort, uint8_t item)
element.attr = DISPLAYPORT_ATTR_NORMAL;
// Call the element drawing function
if ((item >= OSD_SYS_GOGGLE_VOLTAGE) && (item < OSD_SYS_WARNINGS)) {
if ((item >= OSD_SYS_GOGGLE_VOLTAGE) && (item < OSD_ITEM_COUNT)) {
displaySys(osdDisplayPort, elemPosX, elemPosY, (displayPortSystemElement_e)(item - OSD_SYS_GOGGLE_VOLTAGE + DISPLAYPORT_SYS_GOGGLE_VOLTAGE));
} else {
osdElementDrawFunction[item](&element);