1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 09:15:38 +03:00

3djc/xlite sf nav (#5855)

* Another nav

* Fix popup

* Cosmetics
This commit is contained in:
3djc 2018-04-29 22:17:27 +02:00 committed by Bertrand Songis
parent 5ca7cbc91e
commit 6ec64b227c
2 changed files with 21 additions and 7 deletions

View file

@ -70,7 +70,7 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
}
#endif // CPUARM && SDCARD
#if defined(PCBX7)
#if defined(PCBTARANIS)
void onAdjustGvarSourceLongEnterPress(const char * result)
{
@ -103,7 +103,7 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
void onCustomFunctionsMenu(const char * result)
{
int sub = menuVerticalPosition;
int sub = menuVerticalPosition - HEADER_LINE;
CustomFunctionData * cfn;
uint8_t eeFlags;
@ -139,7 +139,7 @@ void onCustomFunctionsMenu(const char * result)
storageDirty(eeFlags);
}
}
#endif // CPUARM
#endif // PCBTARANIS
void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{
@ -151,8 +151,14 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
uint8_t eeFlags = EE_MODEL;
#endif
#if defined(PCBX7)
#if defined(PCBTARANIS)
#if defined(PCBXLITE)
if (menuHorizontalPosition==0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
killEvents(KEY_ENTER);
if (IS_SHIFT_PRESSED()) { // ENT LONG on xlite brings up switch type menu, so this menu is activated with SHIT + ENT LONG
#else
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
#endif
killEvents(event);
CustomFunctionData *cfn = &functions[sub];
if (!CFN_EMPTY(cfn))
@ -171,7 +177,10 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
}
POPUP_MENU_START(onCustomFunctionsMenu);
}
#endif // PCBX7
#if defined(PCBXLITE)
}
#endif
#endif // PCBTARANIS
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;

View file

@ -438,7 +438,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
#if defined(PCBXLITE)
if (i_flags & INCDEC_SOURCE) {
if (event == EVT_KEY_LONG(KEY_ENTER)) {
if (event == EVT_KEY_LONG(KEY_ENTER) && !IS_SHIFT_PRESSED()) {
killEvents(event);
checkIncDecSelection = MIXSRC_NONE;
@ -487,7 +487,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
}
}
else if (i_flags & INCDEC_SWITCH) {
if (event == EVT_KEY_LONG(KEY_ENTER)) {
if (event == EVT_KEY_LONG(KEY_ENTER) && !IS_SHIFT_PRESSED()) {
killEvents(event);
checkIncDecSelection = SWSRC_NONE;
if (i_min <= SWSRC_FIRST_SWITCH && i_max >= SWSRC_LAST_SWITCH) POPUP_MENU_ADD_ITEM(STR_MENU_SWITCHES);
@ -896,7 +896,12 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
menuHorizontalPosition = l_posHorz;
}
#else
#if defined(PCBXLITE)
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
#else
#define MAXCOL(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
#endif
#define POS_HORZ_INIT(posVert) 0
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)