1
0
Fork 0
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:
Bertrand Songis 2016-03-16 21:55:03 +01:00
parent 5a7c9311de
commit 14673dd7bb
5 changed files with 25 additions and 58 deletions

View file

@ -121,7 +121,7 @@ bool menuModelFlightModesAll(evt_t event)
} }
char s[32]; char s[32];
sprintf(s, "Check FM%d Trims", mixerCurrentFlightMode); sprintf(s, "Check FM%d Trims", mixerCurrentFlightMode);
// lcd_putsCenter(y, s, attr); lcdDrawText(LCD_W/2, y, s, CENTERED|attr);
return true; return true;
} }

View file

@ -250,8 +250,6 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
killEvents(event); killEvents(event);
checkIncDecSelection = MIXSRC_NONE; checkIncDecSelection = MIXSRC_NONE;
TRACE("count items avant = %d", popupMenuNoItems);
if (i_min <= MIXSRC_FIRST_INPUT && i_max >= MIXSRC_FIRST_INPUT) { if (i_min <= MIXSRC_FIRST_INPUT && i_max >= MIXSRC_FIRST_INPUT) {
if (getFirstAvailable(MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, isInputAvailable) != MIXSRC_NONE) { if (getFirstAvailable(MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, isInputAvailable) != MIXSRC_NONE) {
POPUP_MENU_ADD_ITEM(STR_MENU_INPUTS); 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) { if (menuTab && !calibrationState) {
int cc = curr; int cc = curr;
switch (event) { switch (event) {
case EVT_ROTARY_RIGHT:
if (menuVerticalPosition >= 0)
break;
// no break
case EVT_KEY_BREAK(KEY_PGDN): case EVT_KEY_BREAK(KEY_PGDN):
if (++cc == menuTabSize) if (++cc == menuTabSize)
cc = 0; cc = 0;
break; break;
case EVT_ROTARY_LEFT:
if (menuVerticalPosition >= 0)
break;
// no break
case EVT_KEY_BREAK(KEY_PGUP): case EVT_KEY_BREAK(KEY_PGUP):
if (cc-- == 0) if (cc-- == 0)
cc = menuTabSize-1; cc = menuTabSize-1;
break; break;
case EVT_KEY_BREAK(KEY_ENTER):
if (menuVerticalPosition < 0 && rowcount > 0) {
menuVerticalPosition = MENU_FIRST_LINE_EDIT;
event = 0;
}
break;
} }
if (cc != curr) { if (cc != curr) {
@ -451,9 +435,9 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
switch(event) { switch(event) {
case EVT_ENTRY: case EVT_ENTRY:
menuVerticalPosition = (menuTab ? -1 : MENU_FIRST_LINE_EDIT);
menuHorizontalPosition = POS_HORZ_INIT(0);
s_editMode = EDIT_MODE_INIT; s_editMode = EDIT_MODE_INIT;
menuVerticalPosition = MENU_FIRST_LINE_EDIT;
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
break; break;
case EVT_ENTRY_UP: 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()) { if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
menuHorizontalPosition = 0; menuHorizontalPosition = 0;
} }
else if (READ_ONLY_UNLOCKED()) { else if (READ_ONLY_UNLOCKED() && rowcount > 0) {
s_editMode = (s_editMode<=0); s_editMode = (s_editMode<=0);
} }
break; 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)) { if (menuHorizontalPosition >= 0 && (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
menuHorizontalPosition = -1; menuHorizontalPosition = -1;
} }
else if (menuTab && menuVerticalPosition >= 0) { else {
menuVerticalPosition = -1; uint8_t posVertInit = MENU_FIRST_LINE_EDIT;
menuHorizontalPosition = 0;
#if 0
int posVertInit = -1;
if (menuVerticalOffset != 0 || menuVerticalPosition != posVertInit) { if (menuVerticalOffset != 0 || menuVerticalPosition != posVertInit) {
menuVerticalOffset = 0; menuVerticalOffset = 0;
menuVerticalPosition = posVertInit; menuVerticalPosition = posVertInit;
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition); menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
} }
#endif else if (!calibrationState) {
} popMenu();
else if (!calibrationState) { }
popMenu();
} }
break; break;

View file

@ -175,24 +175,13 @@ void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_
{ {
drawScreenTemplate(title, icons[0], OPTION_MENU_TITLE_BAR); 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_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);
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++) { for (int i=0; i<menuPageCount; i++) {
lcdDrawBitmapPattern(50+i*MENU_ICONS_SPACING, 7, icons[i+1], MENU_TITLE_COLOR); 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) 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)

View file

@ -349,7 +349,7 @@ void onLongMenuPress(const char *result)
tmr10ms_t menuEntryTime; 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; vertpos_t l_posVert = menuVerticalPosition;
horzpos_t l_posHorz = menuHorizontalPosition; 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: case EVT_ENTRY:
menuEntryTime = get_tmr10ms(); menuEntryTime = get_tmr10ms();
s_editMode = EDIT_MODE_INIT;
l_posVert = MENU_FIRST_LINE_EDIT; l_posVert = MENU_FIRST_LINE_EDIT;
l_posHorz = POS_HORZ_INIT(l_posVert); l_posHorz = POS_HORZ_INIT(l_posVert);
SET_SCROLLBAR_X(LCD_W-1); SET_SCROLLBAR_X(LCD_W-1);
s_editMode = EDIT_MODE_INIT;
break; break;
case EVT_ENTRY_UP: 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 (s_editMode > 1) break;
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) { if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
l_posHorz = 0; l_posHorz = 0;
break;
} }
if (READ_ONLY_UNLOCKED()) { else if (READ_ONLY_UNLOCKED()) {
s_editMode = (s_editMode<=0); s_editMode = (s_editMode<=0);
} }
break; break;
@ -436,7 +435,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuHandle
break; break;
case EVT_KEY_BREAK(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):
if (s_editMode>0) { if (s_editMode > 0) {
s_editMode = 0; s_editMode = 0;
break; 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)) { if (l_posHorz >= 0 && (COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) {
l_posHorz = -1; l_posHorz = -1;
} }
else else {
{
uint8_t posVertInit = MENU_FIRST_LINE_EDIT; uint8_t posVertInit = MENU_FIRST_LINE_EDIT;
if (menuVerticalOffset != 0 || l_posVert != posVertInit) { if (menuVerticalOffset != 0 || l_posVert != posVertInit) {
menuVerticalOffset = 0; menuVerticalOffset = 0;

View file

@ -921,13 +921,13 @@ const luaR_value_entry opentxConstants[] = {
{ "HEADER_CURRENT_BGCOLOR", HEADER_CURRENT_BGCOLOR }, { "HEADER_CURRENT_BGCOLOR", HEADER_CURRENT_BGCOLOR },
{ "OVERLAY_COLOR", OVERLAY_COLOR }, { "OVERLAY_COLOR", OVERLAY_COLOR },
{ "MENU_HEADER_HEIGHT", MENU_HEADER_HEIGHT }, { "MENU_HEADER_HEIGHT", MENU_HEADER_HEIGHT },
{ "WHITE", WHITE }, { "WHITE", (double)WHITE },
{ "GREY", GREY }, { "GREY", (double)GREY },
{ "DARKGREY", DARKGREY }, { "DARKGREY", (double)DARKGREY },
{ "BLACK", BLACK }, { "BLACK", (double)BLACK },
{ "YELLOW", YELLOW }, { "YELLOW", (double)YELLOW },
{ "BLUE", BLUE }, { "BLUE", (double)BLUE },
{ "LIGHTGREY", LIGHTGREY }, { "LIGHTGREY", (double)LIGHTGREY },
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
{ "EVT_PAGE_BREAK", EVT_KEY_BREAK(KEY_PAGE) }, { "EVT_PAGE_BREAK", EVT_KEY_BREAK(KEY_PAGE) },