From 367ca4dfa7a7cd1ec3d7677ae373278ebd33f977 Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Fri, 17 May 2013 17:46:51 +0000 Subject: [PATCH] [Taranis] Code cleaning --- src/gui/menu_model.cpp | 67 ------------------------------------------ src/gui/menus.cpp | 8 +++++ src/gui/menus.h | 8 ++--- src/opentx.h | 4 +++ 4 files changed, 16 insertions(+), 71 deletions(-) diff --git a/src/gui/menu_model.cpp b/src/gui/menu_model.cpp index da61a3bdf..cb280c71a 100644 --- a/src/gui/menu_model.cpp +++ b/src/gui/menu_model.cpp @@ -928,11 +928,6 @@ void menuModelSetup(uint8_t event) pxxFlag[INTERNAL_MODULE] = 0; pxxFlag[EXTERNAL_MODULE] = 0; } - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } #endif #if defined(PCBTARANIS) @@ -1713,14 +1708,6 @@ void editPhaseTrims(uint8_t x, uint8_t y, uint8_t phase, uint8_t event, uint8_t void menuModelFlightModesAll(uint8_t event) { -#if defined(PCBTARANIS) - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } -#endif - MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, 1+MAX_PHASES+1, {0, NAVIGATION_LINE_BY_LINE|(ITEM_PHASES_LAST-2), NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_PHASES_LAST, 0}); int8_t sub = m_posVert - 1; @@ -2064,14 +2051,6 @@ enum menuModelHeliItems { void menuModelHeli(uint8_t event) { -#if defined(PCBTARANIS) - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } -#endif - SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, 7); uint8_t sub = m_posVert - 1; @@ -3023,14 +3002,6 @@ void onExpoMixMenu(const char *result) void menuModelExpoMix(uint8_t expo, uint8_t event) { -#if defined(PCBTARANIS) - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } -#endif - uint8_t sub = m_posVert; if (s_editMode > 0) @@ -3411,14 +3382,6 @@ void menuModelLimits(uint8_t event) { uint8_t sub = m_posVert - 1; -#if defined(PCBTARANIS) - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } -#endif - if (sub < NUM_CHNOUT) { #if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US) lcd_outdezAtt(13*FW, 0, PPM_CH_CENTER(sub)+channelOutputs[sub]/2, 0); @@ -3616,12 +3579,6 @@ void menuModelCurvesAll(uint8_t event) pushMenu(menuModelCurveOne); } break; -#if defined(PCBTARANIS) - case EVT_KEY_LONG(KEY_MENU): - pushMenu(menuChannelsView); - killEvents(event); - return; -#endif } for (uint8_t i=0; i= 212 && defined(GVARS) && defined(FLIGHT_MODES) void menuModelGVars(uint8_t event) { -#if defined(PCBTARANIS) - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } -#endif - MENU(STR_MENUGLOBALVARS, menuTabModel, e_GVars, 1+MAX_GVARS, {0, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES, NAVIGATION_LINE_BY_LINE|MAX_PHASES}); uint8_t sub = m_posVert - 1; @@ -3949,14 +3898,6 @@ void menuModelCustomSwitches(uint8_t event) #define CHECK_INCDEC_CSPARAM(event, var, min, max) var=checkIncDec(event,var,min,max,incdecFlag) #endif -#if defined(PCBTARANIS) - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } -#endif - MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1, {0, NAVIGATION_LINE_BY_LINE|CSW_FIELD_LAST/*repeated...*/}); uint8_t y = 0; @@ -4130,14 +4071,6 @@ void onCustomFunctionsMenu(const char *result) void menuModelCustomFunctions(uint8_t event) { -#if defined(PCBTARANIS) - if (event == EVT_KEY_LONG(KEY_MENU)) { - pushMenu(menuChannelsView); - killEvents(event); - return; - } -#endif - MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|3/*repeated*/}); uint8_t y; diff --git a/src/gui/menus.cpp b/src/gui/menus.cpp index b4a85f02b..efe52c9e7 100644 --- a/src/gui/menus.cpp +++ b/src/gui/menus.cpp @@ -327,6 +327,14 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t #if defined(PCBTARANIS) int8_t cc = curr; switch(event) { + case EVT_KEY_LONG(KEY_MENU): + if (menuTab == menuTabModel) { + pushMenu(menuChannelsView); + killEvents(event); + return false; + } + break; + case EVT_KEY_LONG(KEY_PAGE): if (curr > 0) cc = curr - 1; diff --git a/src/gui/menus.h b/src/gui/menus.h index acce88d0b..941d857b3 100644 --- a/src/gui/menus.h +++ b/src/gui/menus.h @@ -39,8 +39,6 @@ #define NO_HI_LEN 25 -typedef void (*MenuFuncP)(uint8_t event); - void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr); inline void displayColumnHeader(const char **headers, uint8_t index) { @@ -87,6 +85,10 @@ extern uint8_t s_noScroll; void menu_lcd_onoff(uint8_t x, uint8_t y, uint8_t value, LcdFlags attr); +typedef void (*MenuFuncP)(uint8_t event); +typedef void (*MenuFuncP_PROGMEM)(uint8_t event); +extern const MenuFuncP_PROGMEM menuTabModel[]; + extern MenuFuncP g_menuStack[5]; extern uint8_t g_menuStackPtr; @@ -198,8 +200,6 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow); bool check_submenu_simple(check_event_t event, uint8_t maxrow); -typedef void (*MenuFuncP_PROGMEM)(uint8_t event); - void title(const pm_char * s); #define TITLE(str) title(str) diff --git a/src/opentx.h b/src/opentx.h index 377cf5fdf..d88468e0c 100644 --- a/src/opentx.h +++ b/src/opentx.h @@ -675,6 +675,10 @@ enum CswFunctions { #endif extern uint8_t heartbeat; +#if defined(CPUARM) +void watchdogSetTimeout(uint32_t timeout); +#endif + #define MAX_ALERT_TIME 60 extern uint8_t inacPrescale;