T12 to use 9x navigation + navigation refactoring (#6474)

* Move T12 to more suited 9x navigation

* Navigation refactoring

* Navigation refactoring continued

* Channels count in ACCESS mode fix (24 channels max)
This commit is contained in:
3djc
2019-06-04 08:49:39 +02:00
committed by Andre Bernet
parent d7330afb59
commit af9fe7fb63
11 changed files with 101 additions and 270 deletions
+3 -60
View File
@@ -37,44 +37,7 @@ INIT_STOPS(stops100, 3, -100, 0, 100)
INIT_STOPS(stops1000, 3, -1000, 0, 1000)
INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST)
int checkIncDecSelection = 0;
void onSourceLongEnterPress(const char * result)
{
if (result == STR_MENU_INPUTS)
checkIncDecSelection = getFirstAvailable(MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, isInputAvailable)+1;
#if defined(LUA_MODEL_SCRIPTS)
else if (result == STR_MENU_LUA)
checkIncDecSelection = getFirstAvailable(MIXSRC_FIRST_LUA, MIXSRC_LAST_LUA, isSourceAvailable);
#endif
else if (result == STR_MENU_STICKS)
checkIncDecSelection = MIXSRC_FIRST_STICK;
else if (result == STR_MENU_POTS)
checkIncDecSelection = MIXSRC_FIRST_POT;
else if (result == STR_MENU_MAX)
checkIncDecSelection = MIXSRC_MAX;
else if (result == STR_MENU_HELI)
checkIncDecSelection = MIXSRC_FIRST_HELI;
else if (result == STR_MENU_TRIMS)
checkIncDecSelection = MIXSRC_FIRST_TRIM;
else if (result == STR_MENU_SWITCHES)
checkIncDecSelection = MIXSRC_FIRST_SWITCH;
else if (result == STR_MENU_TRAINER)
checkIncDecSelection = MIXSRC_FIRST_TRAINER;
else if (result == STR_MENU_CHANNELS)
checkIncDecSelection = getFirstAvailable(MIXSRC_FIRST_CH, MIXSRC_LAST_CH, isSourceAvailable);
else if (result == STR_MENU_GVARS)
checkIncDecSelection = MIXSRC_FIRST_GVAR;
else if (result == STR_MENU_TELEMETRY) {
for (int i = 0; i < MAX_TELEMETRY_SENSORS; i++) {
TelemetrySensor * sensor = & g_model.telemetrySensors[i];
if (sensor->isAvailable()) {
checkIncDecSelection = MIXSRC_FIRST_TELEM + 3*i;
break;
}
}
}
}
extern int checkIncDecSelection;
void onSwitchLongEnterPress(const char * result)
{
@@ -258,7 +221,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
case EVT_KEY_LONG(KEY_PAGE):
if (s_editMode>0)
break;
if (curr > 0)
cc = curr - 1;
else
@@ -269,7 +232,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
case EVT_KEY_BREAK(KEY_PAGE):
if (s_editMode>0)
break;
if (curr < (menuTabSize-1))
cc = curr + 1;
else
@@ -465,23 +428,3 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
menuVerticalPosition = l_posVert;
menuHorizontalPosition = l_posHorz;
}
void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, vertpos_t maxrow)
{
check(event, curr, menuTab, menuTabSize, 0, 0, maxrow);
}
void check_submenu_simple(event_t event, uint8_t maxrow)
{
check_simple(event, 0, 0, 0, maxrow);
}
void repeatLastCursorMove(event_t event)
{
if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) {
putEvent(event);
}
else {
menuHorizontalPosition = 0;
}
}