mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 04:45:24 +03:00
Add OME_Funcall to call a function.
With the introduction of the CME_Menu, OME_Submenu became unsuitable for general function calls. Actually, it works and call the designated function, but attempt to externally traverse the menu structure fail because it expects CME_Menu * as data for OME_Submenu.
This commit is contained in:
parent
c12942ed41
commit
576ad19914
3 changed files with 4 additions and 1 deletions
|
@ -246,6 +246,7 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, OSD_Entry *p, uint8_t row)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OME_Submenu:
|
case OME_Submenu:
|
||||||
|
case OME_Funcall:
|
||||||
if (IS_PRINTVALUE(p)) {
|
if (IS_PRINTVALUE(p)) {
|
||||||
cnt = displayWrite(pDisplay, RIGHT_MENU_COLUMN(pDisplay), row, ">");
|
cnt = displayWrite(pDisplay, RIGHT_MENU_COLUMN(pDisplay), row, ">");
|
||||||
CLR_PRINTVALUE(p);
|
CLR_PRINTVALUE(p);
|
||||||
|
@ -639,6 +640,7 @@ static uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key)
|
||||||
|
|
||||||
switch (p->type) {
|
switch (p->type) {
|
||||||
case OME_Submenu:
|
case OME_Submenu:
|
||||||
|
case OME_Funcall:
|
||||||
case OME_OSD_Exit:
|
case OME_OSD_Exit:
|
||||||
if (p->func && key == KEY_RIGHT) {
|
if (p->func && key == KEY_RIGHT) {
|
||||||
p->func(pDisplay, p->data);
|
p->func(pDisplay, p->data);
|
||||||
|
|
|
@ -93,7 +93,7 @@ static OSD_Entry cmsx_menuBlackboxEntries[] =
|
||||||
{ "RATE DENOM", OME_UINT8, NULL, &(OSD_UINT8_t){ &masterConfig.blackbox_rate_denom,1,32,1 }, 0 },
|
{ "RATE DENOM", OME_UINT8, NULL, &(OSD_UINT8_t){ &masterConfig.blackbox_rate_denom,1,32,1 }, 0 },
|
||||||
|
|
||||||
#ifdef USE_FLASHFS
|
#ifdef USE_FLASHFS
|
||||||
{ "ERASE FLASH", OME_Submenu, cmsx_EraseFlash, NULL, 0 },
|
{ "ERASE FLASH", OME_Funcall, cmsx_EraseFlash, NULL, 0 },
|
||||||
#endif // USE_FLASHFS
|
#endif // USE_FLASHFS
|
||||||
|
|
||||||
{ "BACK", OME_Back, NULL, NULL, 0 },
|
{ "BACK", OME_Back, NULL, NULL, 0 },
|
||||||
|
|
|
@ -32,6 +32,7 @@ typedef enum
|
||||||
OME_Back,
|
OME_Back,
|
||||||
OME_OSD_Exit,
|
OME_OSD_Exit,
|
||||||
OME_Submenu,
|
OME_Submenu,
|
||||||
|
OME_Funcall,
|
||||||
OME_Bool,
|
OME_Bool,
|
||||||
OME_INT8,
|
OME_INT8,
|
||||||
OME_UINT8,
|
OME_UINT8,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue