Menus refactoring (idea taken from er9x). Saves around 200bytes flash on
9X stock
This commit is contained in:
@@ -1636,10 +1636,12 @@ void menuCommonCalib(uint8_t event)
|
|||||||
|
|
||||||
void menuGeneralCalib(uint8_t event)
|
void menuGeneralCalib(uint8_t event)
|
||||||
{
|
{
|
||||||
if (!check_simple(event, e_Calib, menuTabDiag, DIM(menuTabDiag), 0)) {
|
check_simple(event, e_Calib, menuTabDiag, DIM(menuTabDiag), 0);
|
||||||
|
|
||||||
|
if (menuEvent) {
|
||||||
calibrationState = 0;
|
calibrationState = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TITLE(STR_MENUCALIBRATION);
|
TITLE(STR_MENUCALIBRATION);
|
||||||
menuCommonCalib(READ_ONLY() ? 0 : event);
|
menuCommonCalib(READ_ONLY() ? 0 : event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ void menuModelSelect(uint8_t event)
|
|||||||
|
|
||||||
int8_t oldSub = m_posVert;
|
int8_t oldSub = m_posVert;
|
||||||
|
|
||||||
if (!check_submenu_simple(_event_, MAX_MODELS-1)) return;
|
check_submenu_simple(_event_, MAX_MODELS-1);
|
||||||
|
|
||||||
#if defined(NAVIGATION_POT2)
|
#if defined(NAVIGATION_POT2)
|
||||||
if (event==0 && p2valdiff<0) {
|
if (event==0 && p2valdiff<0) {
|
||||||
@@ -405,7 +405,7 @@ void menuModelSelect(uint8_t event)
|
|||||||
killEvents(event);
|
killEvents(event);
|
||||||
if (s_editMode < 0) {
|
if (s_editMode < 0) {
|
||||||
popMenu();
|
popMenu();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
else if (!s_copyMode) {
|
else if (!s_copyMode) {
|
||||||
m_posVert = sub = g_eeGeneral.currModel;
|
m_posVert = sub = g_eeGeneral.currModel;
|
||||||
@@ -427,7 +427,6 @@ void menuModelSelect(uint8_t event)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
popMenu();
|
popMenu();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -530,7 +529,7 @@ void menuModelSelect(uint8_t event)
|
|||||||
case EVT_KEY_LONG(KEY_PAGE):
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
chainMenu(event == EVT_KEY_BREAK(KEY_PAGE) ? menuModelSetup : menuTabModel[DIM(menuTabModel)-1]);
|
chainMenu(event == EVT_KEY_BREAK(KEY_PAGE) ? menuModelSetup : menuTabModel[DIM(menuTabModel)-1]);
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return;
|
break;
|
||||||
#else
|
#else
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
case EVT_ROTARY_LEFT:
|
case EVT_ROTARY_LEFT:
|
||||||
@@ -543,9 +542,10 @@ void menuModelSelect(uint8_t event)
|
|||||||
#endif
|
#endif
|
||||||
if (sub == g_eeGeneral.currModel) {
|
if (sub == g_eeGeneral.currModel) {
|
||||||
chainMenu((IS_ROTARY_RIGHT(event) || event == EVT_KEY_FIRST(KEY_RIGHT)) ? menuModelSetup : menuTabModel[DIM(menuTabModel)-1]);
|
chainMenu((IS_ROTARY_RIGHT(event) || event == EVT_KEY_FIRST(KEY_RIGHT)) ? menuModelSetup : menuTabModel[DIM(menuTabModel)-1]);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
AUDIO_WARNING2();
|
else {
|
||||||
|
AUDIO_WARNING2();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
}
|
}
|
||||||
@@ -1038,7 +1038,9 @@ void menuModelSetup(uint8_t event)
|
|||||||
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, NUM_SWITCHES, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, CASE_PCBSKY9X(1) CASE_PCBSKY9X(2) });
|
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, NUM_SWITCHES, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, CASE_PCBSKY9X(1) CASE_PCBSKY9X(2) });
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!MENU_CHECK(menuTabModel, e_ModelSetup, MODEL_SETUP_MAX_LINES)) {
|
MENU_CHECK(menuTabModel, e_ModelSetup, MODEL_SETUP_MAX_LINES);
|
||||||
|
|
||||||
|
if (menuEvent) {
|
||||||
#if defined(DSM2)
|
#if defined(DSM2)
|
||||||
dsm2Flag = 0;
|
dsm2Flag = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -1048,7 +1050,6 @@ void menuModelSetup(uint8_t event)
|
|||||||
#if defined(CPUARM) && defined(PXX)
|
#if defined(CPUARM) && defined(PXX)
|
||||||
pxxFlag[EXTERNAL_MODULE] = 0;
|
pxxFlag[EXTERNAL_MODULE] = 0;
|
||||||
#endif
|
#endif
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TITLE(STR_MENUSETUP);
|
TITLE(STR_MENUSETUP);
|
||||||
@@ -2609,7 +2610,6 @@ void menuModelCurveOne(uint8_t event)
|
|||||||
case EVT_KEY_LONG(KEY_MENU):
|
case EVT_KEY_LONG(KEY_MENU):
|
||||||
pushMenu(menuChannelsView);
|
pushMenu(menuChannelsView);
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawCurve(FW);
|
DrawCurve(FW);
|
||||||
@@ -3026,7 +3026,6 @@ void menuModelExpoOne(uint8_t event)
|
|||||||
if (event == EVT_KEY_LONG(KEY_MENU)) {
|
if (event == EVT_KEY_LONG(KEY_MENU)) {
|
||||||
pushMenu(menuChannelsView);
|
pushMenu(menuChannelsView);
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3226,7 +3225,6 @@ void menuModelMixOne(uint8_t event)
|
|||||||
if (event == EVT_KEY_LONG(KEY_MENU)) {
|
if (event == EVT_KEY_LONG(KEY_MENU)) {
|
||||||
pushMenu(menuChannelsView);
|
pushMenu(menuChannelsView);
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3660,7 +3658,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
|||||||
if (READ_ONLY()) {
|
if (READ_ONLY()) {
|
||||||
if (!s_currCh) {
|
if (!s_currCh) {
|
||||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -3671,7 +3668,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
|||||||
insertExpoMix(expo, s_currIdx);
|
insertExpoMix(expo, s_currIdx);
|
||||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||||
s_copyMode = 0;
|
s_copyMode = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
event = 0;
|
event = 0;
|
||||||
@@ -3691,7 +3687,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
|||||||
}
|
}
|
||||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||||
s_copyMode = 0;
|
s_copyMode = 0;
|
||||||
return;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3706,7 +3701,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
|||||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||||
s_copyMode = 0;
|
s_copyMode = 0;
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
|||||||
+12
-26
@@ -299,14 +299,14 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow)
|
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow)
|
||||||
{
|
{
|
||||||
return check(event, curr, menuTab, menuTabSize, 0, 0, maxrow);
|
check(event, curr, menuTab, menuTabSize, 0, 0, maxrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_submenu_simple(check_event_t event, uint8_t maxrow)
|
void check_submenu_simple(check_event_t event, uint8_t maxrow)
|
||||||
{
|
{
|
||||||
return check_simple(event, 0, 0, 0, maxrow);
|
check_simple(event, 0, 0, 0, maxrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void title(const pm_char * s)
|
void title(const pm_char * s)
|
||||||
@@ -344,7 +344,6 @@ bool modelHasNotes()
|
|||||||
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
|
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
|
||||||
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
||||||
strcpy(buf, TEXT_EXT);
|
strcpy(buf, TEXT_EXT);
|
||||||
|
|
||||||
return isFileAvailable(filename);
|
return isFileAvailable(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +373,7 @@ tmr10ms_t menuEntryTime;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
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, uint8_t flags)
|
void 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, uint8_t flags)
|
||||||
{
|
{
|
||||||
vertpos_t l_posVert = m_posVert;
|
vertpos_t l_posVert = m_posVert;
|
||||||
horzpos_t l_posHorz = m_posHorz;
|
horzpos_t l_posHorz = m_posHorz;
|
||||||
@@ -398,7 +397,6 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pushMenu(menuChannelsView);
|
pushMenu(menuChannelsView);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -421,7 +419,6 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
|
|
||||||
if (!calibrationState && cc != curr) {
|
if (!calibrationState && cc != curr) {
|
||||||
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) {
|
if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) {
|
||||||
@@ -496,7 +493,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
case EVT_KEY_LONG(KEY_EXIT):
|
case EVT_KEY_LONG(KEY_EXIT):
|
||||||
s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same
|
s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same
|
||||||
popMenu();
|
popMenu();
|
||||||
return false;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_EXIT):
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
@@ -522,7 +519,6 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
popMenu();
|
popMenu();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -640,13 +636,11 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
|
|
||||||
m_posVert = l_posVert;
|
m_posVert = l_posVert;
|
||||||
m_posHorz = l_posHorz;
|
m_posHorz = l_posHorz;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // defined(PCBTARANIS)
|
#else // defined(PCBTARANIS)
|
||||||
|
|
||||||
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)
|
void 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;
|
vertpos_t l_posVert = m_posVert;
|
||||||
horzpos_t l_posHorz = m_posHorz;
|
horzpos_t l_posHorz = m_posHorz;
|
||||||
@@ -738,7 +732,6 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
|
|
||||||
if (cc != curr) {
|
if (cc != curr) {
|
||||||
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
@@ -817,7 +810,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
case EVT_KEY_LONG(KEY_EXIT):
|
case EVT_KEY_LONG(KEY_EXIT):
|
||||||
s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same
|
s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same
|
||||||
popMenu();
|
popMenu();
|
||||||
return false;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_EXIT):
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
@@ -832,7 +825,6 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
|
|
||||||
if (l_posVert==0 || !menuTab) {
|
if (l_posVert==0 || !menuTab) {
|
||||||
popMenu(); // beeps itself
|
popMenu(); // beeps itself
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AUDIO_MENUS();
|
AUDIO_MENUS();
|
||||||
@@ -979,11 +971,11 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MenuFuncP g_menuStack[5];
|
MenuFuncP g_menuStack[5];
|
||||||
|
uint8_t menuEvent = 0;
|
||||||
uint8_t g_menuPos[4];
|
uint8_t g_menuPos[4];
|
||||||
uint8_t g_menuStackPtr = 0;
|
uint8_t g_menuStackPtr = 0;
|
||||||
vertpos_t m_posVert;
|
vertpos_t m_posVert;
|
||||||
@@ -992,19 +984,14 @@ horzpos_t m_posHorz;
|
|||||||
void popMenu()
|
void popMenu()
|
||||||
{
|
{
|
||||||
assert(g_menuStackPtr>0);
|
assert(g_menuStackPtr>0);
|
||||||
|
|
||||||
g_menuStackPtr = g_menuStackPtr-1;
|
g_menuStackPtr = g_menuStackPtr-1;
|
||||||
AUDIO_KEYPAD_UP();
|
menuEvent = EVT_ENTRY_UP;
|
||||||
m_posHorz = 0;
|
|
||||||
m_posVert = g_menuPos[g_menuStackPtr];
|
|
||||||
(*g_menuStack[g_menuStackPtr])(EVT_ENTRY_UP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void chainMenu(MenuFuncP newMenu)
|
void chainMenu(MenuFuncP newMenu)
|
||||||
{
|
{
|
||||||
g_menuStack[g_menuStackPtr] = newMenu;
|
g_menuStack[g_menuStackPtr] = newMenu;
|
||||||
(*newMenu)(EVT_ENTRY);
|
menuEvent = EVT_ENTRY;
|
||||||
AUDIO_MENUS();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushMenu(MenuFuncP newMenu)
|
void pushMenu(MenuFuncP newMenu)
|
||||||
@@ -1025,9 +1012,8 @@ void pushMenu(MenuFuncP newMenu)
|
|||||||
|
|
||||||
assert(g_menuStackPtr < DIM(g_menuStack));
|
assert(g_menuStackPtr < DIM(g_menuStack));
|
||||||
|
|
||||||
AUDIO_MENUS();
|
|
||||||
g_menuStack[g_menuStackPtr] = newMenu;
|
g_menuStack[g_menuStackPtr] = newMenu;
|
||||||
(*newMenu)(EVT_ENTRY);
|
menuEvent = EVT_ENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pm_char * s_warning = NULL;
|
const pm_char * s_warning = NULL;
|
||||||
|
|||||||
+13
-11
@@ -105,7 +105,9 @@ typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
|||||||
extern const MenuFuncP_PROGMEM menuTabModel[];
|
extern const MenuFuncP_PROGMEM menuTabModel[];
|
||||||
|
|
||||||
extern MenuFuncP g_menuStack[5];
|
extern MenuFuncP g_menuStack[5];
|
||||||
|
extern uint8_t g_menuPos[4];
|
||||||
extern uint8_t g_menuStackPtr;
|
extern uint8_t g_menuStackPtr;
|
||||||
|
extern uint8_t menuEvent;
|
||||||
|
|
||||||
/// goto given Menu, but substitute current menu in menuStack
|
/// goto given Menu, but substitute current menu in menuStack
|
||||||
void chainMenu(MenuFuncP newMenu);
|
void chainMenu(MenuFuncP newMenu);
|
||||||
@@ -267,13 +269,13 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
|||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
||||||
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, uint8_t flags=0);
|
void 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, uint8_t flags=0);
|
||||||
#else
|
#else
|
||||||
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);
|
void 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);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
void 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);
|
void check_submenu_simple(check_event_t event, uint8_t maxrow);
|
||||||
|
|
||||||
void title(const pm_char * s);
|
void title(const pm_char * s);
|
||||||
#define TITLE(str) title(str)
|
#define TITLE(str) title(str)
|
||||||
@@ -292,32 +294,32 @@ void title(const pm_char * s);
|
|||||||
|
|
||||||
#define MENU(title, tab, menu, lines_count, ...) \
|
#define MENU(title, tab, menu, lines_count, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
if (!MENU_CHECK(tab, menu, lines_count)) return; \
|
MENU_CHECK(tab, menu, lines_count); \
|
||||||
TITLE(title)
|
TITLE(title)
|
||||||
|
|
||||||
#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
|
#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
if (!MENU_CHECK_FLAGS(tab, menu, flags, lines_count)) return; \
|
MENU_CHECK_FLAGS(tab, menu, flags, lines_count)); \
|
||||||
TITLE(title)
|
TITLE(title)
|
||||||
|
|
||||||
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
||||||
if (!check_simple(event,menu,tab,DIM(tab),(lines_count)-1)) return;
|
check_simple(event, menu, tab, DIM(tab), (lines_count)-1);
|
||||||
|
|
||||||
#define SIMPLE_MENU(title, tab, menu, lines_count) \
|
#define SIMPLE_MENU(title, tab, menu, lines_count) \
|
||||||
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
|
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
|
||||||
TITLE(title)
|
TITLE(title)
|
||||||
|
|
||||||
#define SUBMENU_NOTITLE(lines_count, ...) { \
|
#define SUBMENU_NOTITLE(lines_count, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
if (!check(event,0,NULL,0,mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; }
|
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1);
|
||||||
|
|
||||||
#define SUBMENU(title, lines_count, ...) \
|
#define SUBMENU(title, lines_count, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
if (!check(event,0,NULL,0,mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; \
|
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1); \
|
||||||
TITLE(title)
|
TITLE(title)
|
||||||
|
|
||||||
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
||||||
if (!check_submenu_simple(event,(lines_count)-1)) return;
|
check_submenu_simple(event, (lines_count)-1);
|
||||||
|
|
||||||
#define SIMPLE_SUBMENU(title, lines_count) \
|
#define SIMPLE_SUBMENU(title, lines_count) \
|
||||||
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void menuAboutView(uint8_t event)
|
|||||||
break;
|
break;
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
case EVT_KEY_FIRST(KEY_EXIT):
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void menuChannelsView(uint8_t event)
|
|||||||
{
|
{
|
||||||
case EVT_KEY_BREAK(KEY_EXIT):
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
popMenu();
|
popMenu();
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||||
case EVT_KEY_FIRST(KEY_LEFT):
|
case EVT_KEY_FIRST(KEY_LEFT):
|
||||||
secondPage = !secondPage;
|
secondPage = !secondPage;
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ void menuMainViewChannelsMonitor(uint8_t event)
|
|||||||
case EVT_KEY_BREAK(KEY_PAGE):
|
case EVT_KEY_BREAK(KEY_PAGE):
|
||||||
case EVT_KEY_BREAK(KEY_EXIT):
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return menuChannelsView(event);
|
return menuChannelsView(event);
|
||||||
@@ -632,7 +632,6 @@ void menuMainView(uint8_t event)
|
|||||||
if (g_eeGeneral.view >= VIEW_COUNT) {
|
if (g_eeGeneral.view >= VIEW_COUNT) {
|
||||||
g_eeGeneral.view = 0;
|
g_eeGeneral.view = 0;
|
||||||
chainMenu(menuMainViewChannelsMonitor);
|
chainMenu(menuMainViewChannelsMonitor);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
@@ -648,7 +647,7 @@ void menuMainView(uint8_t event)
|
|||||||
case EVT_KEY_STATISTICS:
|
case EVT_KEY_STATISTICS:
|
||||||
chainMenu(menuStatisticsView);
|
chainMenu(menuStatisticsView);
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case EVT_KEY_TELEMETRY:
|
case EVT_KEY_TELEMETRY:
|
||||||
@@ -670,7 +669,7 @@ void menuMainView(uint8_t event)
|
|||||||
chainMenu(menuStatisticsDebug);
|
chainMenu(menuStatisticsDebug);
|
||||||
#endif
|
#endif
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
case EVT_KEY_FIRST(KEY_EXIT):
|
||||||
#if defined(GVARS) && !defined(PCBSTD)
|
#if defined(GVARS) && !defined(PCBSTD)
|
||||||
|
|||||||
@@ -62,24 +62,19 @@ void menuTelemetryMavlink(uint8_t event) {
|
|||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_UP):
|
case EVT_KEY_FIRST(KEY_UP):
|
||||||
if (MAVLINK_menu > 0)
|
if (MAVLINK_menu > 0)
|
||||||
{
|
MAVLINK_menu--;
|
||||||
MAVLINK_menu--;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
chainMenu(menuMainView);
|
||||||
chainMenu(menuMainView);
|
break;
|
||||||
return;
|
|
||||||
}
|
|
||||||
case EVT_KEY_FIRST(KEY_DOWN):
|
case EVT_KEY_FIRST(KEY_DOWN):
|
||||||
if (MAVLINK_menu < MAX_MAVLINK_MENU - 1)
|
if (MAVLINK_menu < MAX_MAVLINK_MENU - 1)
|
||||||
MAVLINK_menu++;
|
MAVLINK_menu++;
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_FIRST(KEY_MENU):
|
case EVT_KEY_FIRST(KEY_MENU):
|
||||||
return;
|
return;
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
case EVT_KEY_FIRST(KEY_EXIT):
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (MAVLINK_menu) {
|
switch (MAVLINK_menu) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ void menuStatisticsView(uint8_t event)
|
|||||||
{
|
{
|
||||||
case EVT_KEY_FIRST(KEY_UP):
|
case EVT_KEY_FIRST(KEY_UP):
|
||||||
chainMenu(menuStatisticsDebug);
|
chainMenu(menuStatisticsDebug);
|
||||||
return;
|
break;
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
case EVT_KEY_LONG(KEY_MENU):
|
case EVT_KEY_LONG(KEY_MENU):
|
||||||
@@ -55,7 +55,7 @@ void menuStatisticsView(uint8_t event)
|
|||||||
#endif
|
#endif
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
case EVT_KEY_FIRST(KEY_EXIT):
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcd_puts( 1*FW, FH*0, STR_TOTTM1TM2THRTHP);
|
lcd_puts( 1*FW, FH*0, STR_TOTTM1TM2THRTHP);
|
||||||
@@ -132,10 +132,10 @@ void menuStatisticsDebug(uint8_t event)
|
|||||||
break;
|
break;
|
||||||
case EVT_KEY_FIRST(KEY_DOWN):
|
case EVT_KEY_FIRST(KEY_DOWN):
|
||||||
chainMenu(menuStatisticsView);
|
chainMenu(menuStatisticsView);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
case EVT_KEY_FIRST(KEY_EXIT):
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ void menuTelemetryFrsky(uint8_t event)
|
|||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
case EVT_KEY_FIRST(KEY_EXIT):
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
case EVT_KEY_LONG(KEY_PAGE):
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void menuTextView(uint8_t event)
|
|||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_EXIT):
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
popMenu();
|
popMenu();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<LCD_LINES-1; i++) {
|
for (int i=0; i<LCD_LINES-1; i++) {
|
||||||
|
|||||||
@@ -2839,6 +2839,13 @@ void perMain()
|
|||||||
|
|
||||||
if (!LCD_LOCKED()) {
|
if (!LCD_LOCKED()) {
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
|
if (menuEvent) {
|
||||||
|
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
|
||||||
|
m_posHorz = 0;
|
||||||
|
evt = menuEvent;
|
||||||
|
menuEvent = 0;
|
||||||
|
AUDIO_MENUS();
|
||||||
|
}
|
||||||
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -396,18 +396,18 @@ void menuTelemetryNMEA1(uint8_t event)
|
|||||||
{
|
{
|
||||||
case EVT_KEY_BREAK(KEY_LEFT):
|
case EVT_KEY_BREAK(KEY_LEFT):
|
||||||
chainMenu(menuTelemetryNMEA4);
|
chainMenu(menuTelemetryNMEA4);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||||
chainMenu(menuTelemetryNMEA2);
|
chainMenu(menuTelemetryNMEA2);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_UP):
|
case EVT_KEY_LONG(KEY_UP):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuStatisticsView);
|
chainMenu(menuStatisticsView);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_DOWN):
|
case EVT_KEY_LONG(KEY_DOWN):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_FIRST(KEY_MENU):
|
case EVT_KEY_FIRST(KEY_MENU):
|
||||||
if (show_timer == 0) {
|
if (show_timer == 0) {
|
||||||
show_timer = 1;
|
show_timer = 1;
|
||||||
@@ -509,21 +509,21 @@ void menuTelemetryNMEA2(uint8_t event)
|
|||||||
ignore_break=0;
|
ignore_break=0;
|
||||||
break;}
|
break;}
|
||||||
chainMenu(menuTelemetryNMEA1);
|
chainMenu(menuTelemetryNMEA1);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||||
if (ignore_break==1) {
|
if (ignore_break==1) {
|
||||||
ignore_break=0;
|
ignore_break=0;
|
||||||
break;}
|
break;}
|
||||||
chainMenu(menuTelemetryNMEA3);
|
chainMenu(menuTelemetryNMEA3);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_UP):
|
case EVT_KEY_LONG(KEY_UP):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuStatisticsView);
|
chainMenu(menuStatisticsView);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_DOWN):
|
case EVT_KEY_LONG(KEY_DOWN):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
|
|
||||||
//Beep setting
|
//Beep setting
|
||||||
case EVT_KEY_LONG(KEY_LEFT):
|
case EVT_KEY_LONG(KEY_LEFT):
|
||||||
@@ -664,18 +664,18 @@ void menuTelemetryNMEA3(uint8_t event)
|
|||||||
{
|
{
|
||||||
case EVT_KEY_BREAK(KEY_LEFT):
|
case EVT_KEY_BREAK(KEY_LEFT):
|
||||||
chainMenu(menuTelemetryNMEA2);
|
chainMenu(menuTelemetryNMEA2);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||||
chainMenu(menuTelemetryNMEA4);
|
chainMenu(menuTelemetryNMEA4);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_UP):
|
case EVT_KEY_LONG(KEY_UP):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuStatisticsView);
|
chainMenu(menuStatisticsView);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_DOWN):
|
case EVT_KEY_LONG(KEY_DOWN):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
initval (LONG_BUF(0), PACK_RMC, SOG);
|
initval (LONG_BUF(0), PACK_RMC, SOG);
|
||||||
initval (LONG_BUF(1), PACK_RMC, COG);
|
initval (LONG_BUF(1), PACK_RMC, COG);
|
||||||
@@ -713,18 +713,18 @@ void menuTelemetryNMEA4(uint8_t event)
|
|||||||
{
|
{
|
||||||
case EVT_KEY_BREAK(KEY_LEFT):
|
case EVT_KEY_BREAK(KEY_LEFT):
|
||||||
chainMenu(menuTelemetryNMEA3);
|
chainMenu(menuTelemetryNMEA3);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||||
chainMenu(menuTelemetryNMEA1);
|
chainMenu(menuTelemetryNMEA1);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_UP):
|
case EVT_KEY_LONG(KEY_UP):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuStatisticsView);
|
chainMenu(menuStatisticsView);
|
||||||
return;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_DOWN):
|
case EVT_KEY_LONG(KEY_DOWN):
|
||||||
NMEA_DisableRXD();
|
NMEA_DisableRXD();
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
// expecting LAT value in POS packet to be stored in the first buffer
|
// expecting LAT value in POS packet to be stored in the first buffer
|
||||||
initval (LONG_BUF(0), PACK_GGA, LAT);
|
initval (LONG_BUF(0), PACK_GGA, LAT);
|
||||||
|
|||||||
Reference in New Issue
Block a user