mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 16:55:15 +03:00
[Horus] Navigation enhancements
This commit is contained in:
parent
5a7c9311de
commit
14673dd7bb
5 changed files with 25 additions and 58 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,21 +473,17 @@ 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();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
for (int i=0; i<menuPageCount; i++) {
|
||||
lcdDrawBitmapPattern(50+i*MENU_ICONS_SPACING, 7, icons[i+1], MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
if (menuVerticalPosition < 0) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, evt_t event)
|
||||
|
|
|
@ -349,7 +349,7 @@ void onLongMenuPress(const char *result)
|
|||
|
||||
tmr10ms_t menuEntryTime;
|
||||
|
||||
void check(const char *name, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
void check(const char * name, check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
{
|
||||
vertpos_t l_posVert = menuVerticalPosition;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
|
@ -406,10 +406,10 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuHandle
|
|||
{
|
||||
case EVT_ENTRY:
|
||||
menuEntryTime = get_tmr10ms();
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
l_posVert = MENU_FIRST_LINE_EDIT;
|
||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||
SET_SCROLLBAR_X(LCD_W-1);
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
break;
|
||||
|
||||
case EVT_ENTRY_UP:
|
||||
|
@ -423,9 +423,8 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuHandle
|
|||
if (s_editMode > 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;
|
||||
|
|
|
@ -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) },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue