diff --git a/radio/src/gui/horus/menu_model_flightmodes.cpp b/radio/src/gui/horus/menu_model_flightmodes.cpp index d5b11fc4d..27912e0c2 100644 --- a/radio/src/gui/horus/menu_model_flightmodes.cpp +++ b/radio/src/gui/horus/menu_model_flightmodes.cpp @@ -121,7 +121,7 @@ bool menuModelFlightModesAll(evt_t event) } char s[32]; sprintf(s, "Check FM%d Trims", mixerCurrentFlightMode); - // lcd_putsCenter(y, s, attr); + lcdDrawText(LCD_W/2, y, s, CENTERED|attr); return true; } diff --git a/radio/src/gui/horus/navigation.cpp b/radio/src/gui/horus/navigation.cpp index fca97dd51..906e28d59 100644 --- a/radio/src/gui/horus/navigation.cpp +++ b/radio/src/gui/horus/navigation.cpp @@ -250,8 +250,6 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags killEvents(event); checkIncDecSelection = MIXSRC_NONE; - TRACE("count items avant = %d", popupMenuNoItems); - if (i_min <= MIXSRC_FIRST_INPUT && i_max >= MIXSRC_FIRST_INPUT) { if (getFirstAvailable(MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, isInputAvailable) != MIXSRC_NONE) { POPUP_MENU_ADD_ITEM(STR_MENU_INPUTS); @@ -414,30 +412,16 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u if (menuTab && !calibrationState) { int cc = curr; switch (event) { - case EVT_ROTARY_RIGHT: - if (menuVerticalPosition >= 0) - break; - // no break case EVT_KEY_BREAK(KEY_PGDN): if (++cc == menuTabSize) cc = 0; break; - case EVT_ROTARY_LEFT: - if (menuVerticalPosition >= 0) - break; - // no break + case EVT_KEY_BREAK(KEY_PGUP): if (cc-- == 0) cc = menuTabSize-1; break; - - case EVT_KEY_BREAK(KEY_ENTER): - if (menuVerticalPosition < 0 && rowcount > 0) { - menuVerticalPosition = MENU_FIRST_LINE_EDIT; - event = 0; - } - break; } if (cc != curr) { @@ -451,9 +435,9 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u switch(event) { case EVT_ENTRY: - menuVerticalPosition = (menuTab ? -1 : MENU_FIRST_LINE_EDIT); - menuHorizontalPosition = POS_HORZ_INIT(0); s_editMode = EDIT_MODE_INIT; + menuVerticalPosition = MENU_FIRST_LINE_EDIT; + menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition); break; case EVT_ENTRY_UP: @@ -466,7 +450,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) { menuHorizontalPosition = 0; } - else if (READ_ONLY_UNLOCKED()) { + else if (READ_ONLY_UNLOCKED() && rowcount > 0) { s_editMode = (s_editMode<=0); } break; @@ -489,20 +473,16 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u if (menuHorizontalPosition >= 0 && (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) { menuHorizontalPosition = -1; } - else if (menuTab && menuVerticalPosition >= 0) { - menuVerticalPosition = -1; - menuHorizontalPosition = 0; -#if 0 - int posVertInit = -1; + else { + uint8_t posVertInit = MENU_FIRST_LINE_EDIT; if (menuVerticalOffset != 0 || menuVerticalPosition != posVertInit) { menuVerticalOffset = 0; menuVerticalPosition = posVertInit; menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition); } -#endif - } - else if (!calibrationState) { - popMenu(); + else if (!calibrationState) { + popMenu(); + } } break; diff --git a/radio/src/gui/horus/widgets.cpp b/radio/src/gui/horus/widgets.cpp index cf4a83c6a..c6feb3b11 100644 --- a/radio/src/gui/horus/widgets.cpp +++ b/radio/src/gui/horus/widgets.cpp @@ -175,24 +175,13 @@ void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_ { drawScreenTemplate(title, icons[0], OPTION_MENU_TITLE_BAR); - if (menuVerticalPosition < 0) { - lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, HEADER_CURRENT_BGCOLOR); - - lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TRIM_SHADOW_COLOR); - lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR); - } - else { - lcdDrawSolidFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, HEADER_CURRENT_BGCOLOR); - lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR); - } + lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, HEADER_CURRENT_BGCOLOR); + lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TRIM_SHADOW_COLOR); + lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR); for (int i=0; i 1) break; if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) { l_posHorz = 0; - break; } - if (READ_ONLY_UNLOCKED()) { + else if (READ_ONLY_UNLOCKED()) { s_editMode = (s_editMode<=0); } break; @@ -436,7 +435,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuHandle break; case EVT_KEY_BREAK(KEY_EXIT): - if (s_editMode>0) { + if (s_editMode > 0) { s_editMode = 0; break; } @@ -444,8 +443,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuHandle if (l_posHorz >= 0 && (COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) { l_posHorz = -1; } - else - { + else { uint8_t posVertInit = MENU_FIRST_LINE_EDIT; if (menuVerticalOffset != 0 || l_posVert != posVertInit) { menuVerticalOffset = 0; diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index fbb75cdd4..5b04c0978 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -921,13 +921,13 @@ const luaR_value_entry opentxConstants[] = { { "HEADER_CURRENT_BGCOLOR", HEADER_CURRENT_BGCOLOR }, { "OVERLAY_COLOR", OVERLAY_COLOR }, { "MENU_HEADER_HEIGHT", MENU_HEADER_HEIGHT }, - { "WHITE", WHITE }, - { "GREY", GREY }, - { "DARKGREY", DARKGREY }, - { "BLACK", BLACK }, - { "YELLOW", YELLOW }, - { "BLUE", BLUE }, - { "LIGHTGREY", LIGHTGREY }, + { "WHITE", (double)WHITE }, + { "GREY", (double)GREY }, + { "DARKGREY", (double)DARKGREY }, + { "BLACK", (double)BLACK }, + { "YELLOW", (double)YELLOW }, + { "BLUE", (double)BLUE }, + { "LIGHTGREY", (double)LIGHTGREY }, #endif #if defined(PCBTARANIS) { "EVT_PAGE_BREAK", EVT_KEY_BREAK(KEY_PAGE) },