From 6ec64b227c7b9c98e3462d177ba3842da669a0c7 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 29 Apr 2018 22:17:27 +0200 Subject: [PATCH] 3djc/xlite sf nav (#5855) * Another nav * Fix popup * Cosmetics --- .../gui/128x64/model_special_functions.cpp | 19 ++++++++++++++----- radio/src/gui/128x64/navigation.cpp | 9 +++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/radio/src/gui/128x64/model_special_functions.cpp b/radio/src/gui/128x64/model_special_functions.cpp index 4f5421e05..8e85779bb 100644 --- a/radio/src/gui/128x64/model_special_functions.cpp +++ b/radio/src/gui/128x64/model_special_functions.cpp @@ -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= 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)