From 62f921404ee5625bdba4e6a1eca817c3554f68f4 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 23 Feb 2014 09:22:51 +0100 Subject: [PATCH] Indication of current flight mode in global vars - 1st part: the 2 seconds --- radio/src/gui/menu_model.cpp | 10 +++++++++- radio/src/gui/menus.cpp | 8 ++++++++ radio/src/gui/menus.h | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/menu_model.cpp index d1dd68a46..527f147a0 100644 --- a/radio/src/gui/menu_model.cpp +++ b/radio/src/gui/menu_model.cpp @@ -4087,7 +4087,15 @@ void onGVARSMenu(const char *result) void menuModelGVars(uint8_t event) { - 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}); + tmr10ms_t tmr10ms = get_tmr10ms(); + const char * menuTitle; + + if (tmr10ms - menuEntryTime > 200/*2 seconds*/) + menuTitle = "GLOBAL V."; // TODO translate + else + menuTitle = STR_MENUGLOBALVARS; + + MENU(menuTitle, 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; diff --git a/radio/src/gui/menus.cpp b/radio/src/gui/menus.cpp index dfc74980e..51577c47a 100644 --- a/radio/src/gui/menus.cpp +++ b/radio/src/gui/menus.cpp @@ -358,6 +358,10 @@ void onLongMenuPress(const char *result) } #endif +#if defined(CPUARM) +tmr10ms_t menuEntryTime; +#endif + bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow) { vertpos_t l_posVert = m_posVert; @@ -522,6 +526,9 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t switch(event) { case EVT_ENTRY: +#if defined(CPUARM) + menuEntryTime = get_tmr10ms(); +#endif l_posVert = POS_VERT_INIT; l_posHorz = POS_HORZ_INIT(l_posVert); SET_SCROLLBAR_X(LCD_W-1); @@ -538,6 +545,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t #if defined(PCBTARANIS) case EVT_ENTRY_UP: + menuEntryTime = get_tmr10ms(); s_editMode = 0; l_posHorz = POS_HORZ_INIT(l_posVert); SET_SCROLLBAR_X(LCD_W-1); diff --git a/radio/src/gui/menus.h b/radio/src/gui/menus.h index 02ae64ca6..479be9039 100644 --- a/radio/src/gui/menus.h +++ b/radio/src/gui/menus.h @@ -88,6 +88,10 @@ inline void displayColumnHeader(const char **headers, uint8_t index) #define horzpos_t uint8_t #endif +#if defined(CPUARM) + extern tmr10ms_t menuEntryTime; +#endif + extern vertpos_t m_posVert; extern horzpos_t m_posHorz; extern vertpos_t s_pgOfs;