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

Trial for displaying optional string on right column for submenus

This commit is contained in:
jflyper 2016-11-24 16:33:21 +09:00
parent 457afbcaf0
commit ed09ee4a9b
3 changed files with 27 additions and 1 deletions

View file

@ -234,6 +234,13 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, OSD_Entry *p, uint8_t row)
case OME_Funcall:
if (IS_PRINTVALUE(p)) {
cnt = displayWrite(pDisplay, RIGHT_MENU_COLUMN(pDisplay), row, ">");
// Special case of sub menu entry with func used as a function
// returning a string to print on the right column.
if (p->type == OME_Submenu && p->func) {
if (p->flags & OPTSTRING)
cnt += displayWrite(pDisplay, RIGHT_MENU_COLUMN(pDisplay) + 1, row, ((CMSMenuOptFuncPtr)p->func)());
}
CLR_PRINTVALUE(p);
}
break;
@ -645,6 +652,11 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key)
switch (p->type) {
case OME_Submenu:
if (p->func && key == KEY_RIGHT) {
cmsMenuChange(pDisplay, p->data);
res = BUTTON_PAUSE;
}
break;
case OME_Funcall:
case OME_OSD_Exit:
if (p->func && key == KEY_RIGHT) {