feat: Add options to disable radio and model menu tabs (#3484)
* Add options to disable radio and model menu tabs. - Update radio and model data structs - UI for color LCD radios - Convert existing 'noGlobalFunctions' property. - Language strings. * Make 'theme' control specific to color LCD radios. * Add B&W radio UI. * Simplify code, reduce compiled code size. Fix page count display on model select tab. Fix GVARS for 212x64 radios. * Collapse timer sections if timer is off. * Remove 'Use global functions' checkbox from B&W model setup. * Make preflight checks, throttle and view options sections expand & collapse (default collapsed). * Fix build. * Add view options to companion data classes, save and load values in YAML files. Fix scrolling for radio setup view options. * Add Companion UI for view option settings. * Remove 'Mixes' from list of tabs that can be hidden. * Updated Companion UI from elecpower. * Use view options flags to enable/disable functionality: - skip heli mixer logic if heli not enabled - Remove heli, gvars and telemetry options from source selection if not enabled * Remove 'flight mode', 'curve' and 'global variable' settings from input & mix editors if option disabled. * Rename 'View Options' to 'Enabled Features'. Put GVAR option under Flight Mode and indent text. Make relationship between FM and GV more obvious. * Remove global variable option dependency on flight modes. Hide FM1-FM8 in global variables if flight modes hidden. * Hide 'Custom Mixer Scripts' in source selection menu popup if disabled. * Add translation strings for Hebrew language file. * Fix typo. Add comment for double call to setCurrentTab.
This commit is contained in:
@@ -99,9 +99,28 @@ enum MenuRadioSetupItems {
|
||||
CASE_ROTARY_ENCODER(ITEM_RADIO_SETUP_ROTARY_ENC_MODE)
|
||||
ITEM_RADIO_SETUP_STICK_MODE_LABELS,
|
||||
ITEM_RADIO_SETUP_STICK_MODE,
|
||||
ITEM_VIEW_OPTIONS_LABEL,
|
||||
ITEM_VIEW_OPTIONS_RADIO_TAB,
|
||||
ITEM_VIEW_OPTIONS_GF,
|
||||
ITEM_VIEW_OPTIONS_TRAINER,
|
||||
ITEM_VIEW_OPTIONS_MODEL_TAB,
|
||||
CASE_HELI(ITEM_VIEW_OPTIONS_HELI)
|
||||
CASE_FLIGHT_MODES(ITEM_VIEW_OPTIONS_FM)
|
||||
CASE_GVARS(ITEM_VIEW_OPTIONS_GV)
|
||||
ITEM_VIEW_OPTIONS_CURVES,
|
||||
ITEM_VIEW_OPTIONS_LS,
|
||||
ITEM_VIEW_OPTIONS_SF,
|
||||
CASE_LUA_MODEL_SCRIPTS(ITEM_VIEW_OPTIONS_CUSTOM_SCRIPTS)
|
||||
ITEM_VIEW_OPTIONS_TELEMETRY,
|
||||
ITEM_RADIO_SETUP_MAX
|
||||
};
|
||||
|
||||
uint8_t viewOptCheckBox(coord_t y, const char* title, uint8_t value, uint8_t attr, event_t event)
|
||||
{
|
||||
lcdDrawText(INDENT_WIDTH*2, y, title);
|
||||
return !editCheckBox(!value, RADIO_SETUP_2ND_COLUMN, y, nullptr, attr, event );
|
||||
}
|
||||
|
||||
void menuRadioSetup(event_t event)
|
||||
{
|
||||
#if defined(RTCLOCK)
|
||||
@@ -181,6 +200,7 @@ void menuRadioSetup(event_t event)
|
||||
CASE_ROTARY_ENCODER(0) // Invert rotary encoder
|
||||
LABEL(TX_MODE),
|
||||
0, // sticks mode
|
||||
LABEL(ViewOptions), LABEL(RadioMenuTabs), 0, 0, LABEL(ModelMenuTabs), CASE_HELI(0) CASE_FLIGHT_MODES(0) CASE_GVARS(0) 0, 0, 0, CASE_LUA_MODEL_SCRIPTS(0) 0,
|
||||
1 /*to force edit mode*/
|
||||
});
|
||||
|
||||
@@ -196,6 +216,11 @@ void menuRadioSetup(event_t event)
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
for (int j = 0; j <= k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
}
|
||||
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
|
||||
@@ -631,6 +656,54 @@ void menuRadioSetup(event_t event)
|
||||
waitKeysReleased();
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_VIEW_OPTIONS_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_VIEW_OPTIONS);
|
||||
break;
|
||||
case ITEM_VIEW_OPTIONS_RADIO_TAB:
|
||||
lcdDrawText(INDENT_WIDTH, y, TR_RADIO_MENU_TABS);
|
||||
break;
|
||||
case ITEM_VIEW_OPTIONS_GF:
|
||||
g_eeGeneral.radioGFDisabled = viewOptCheckBox(y, STR_MENUSPECIALFUNCS, g_eeGeneral.radioGFDisabled, attr, event);
|
||||
break;
|
||||
case ITEM_VIEW_OPTIONS_TRAINER:
|
||||
g_eeGeneral.radioTrainerDisabled = viewOptCheckBox(y, STR_MENUTRAINER, g_eeGeneral.radioTrainerDisabled, attr, event);
|
||||
break;
|
||||
case ITEM_VIEW_OPTIONS_MODEL_TAB:
|
||||
lcdDrawText(INDENT_WIDTH, y, TR_MODEL_MENU_TABS);
|
||||
break;
|
||||
#if defined(HELI)
|
||||
case ITEM_VIEW_OPTIONS_HELI:
|
||||
g_eeGeneral.modelHeliDisabled = viewOptCheckBox(y, STR_MENUHELISETUP, g_eeGeneral.modelHeliDisabled, attr, event);
|
||||
break;
|
||||
#endif
|
||||
#if defined(FLIGHT_MODES)
|
||||
case ITEM_VIEW_OPTIONS_FM:
|
||||
g_eeGeneral.modelFMDisabled = viewOptCheckBox(y, STR_MENUFLIGHTMODES, g_eeGeneral.modelFMDisabled, attr, event);
|
||||
break;
|
||||
#endif
|
||||
case ITEM_VIEW_OPTIONS_CURVES:
|
||||
g_eeGeneral.modelCurvesDisabled = viewOptCheckBox(y, STR_MENUCURVES, g_eeGeneral.modelCurvesDisabled, attr, event);
|
||||
break;
|
||||
#if defined(GVARS)
|
||||
case ITEM_VIEW_OPTIONS_GV:
|
||||
g_model.modelGVDisabled = viewOptCheckBox(y, STR_MENU_GLOBAL_VARS, g_model.modelGVDisabled, attr, event);
|
||||
break;
|
||||
#endif
|
||||
case ITEM_VIEW_OPTIONS_LS:
|
||||
g_eeGeneral.modelLSDisabled = viewOptCheckBox(y, STR_MENULOGICALSWITCHES, g_eeGeneral.modelLSDisabled, attr, event);
|
||||
break;
|
||||
case ITEM_VIEW_OPTIONS_SF:
|
||||
g_eeGeneral.modelSFDisabled = viewOptCheckBox(y, STR_MENUCUSTOMFUNC, g_eeGeneral.modelSFDisabled, attr, event);
|
||||
break;
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
case ITEM_VIEW_OPTIONS_CUSTOM_SCRIPTS:
|
||||
g_eeGeneral.modelCustomScriptsDisabled = viewOptCheckBox(y, STR_MENUCUSTOMSCRIPTS, g_eeGeneral.modelCustomScriptsDisabled, attr, event);
|
||||
break;
|
||||
#endif
|
||||
case ITEM_VIEW_OPTIONS_TELEMETRY:
|
||||
g_eeGeneral.modelTelemetryDisabled = viewOptCheckBox(y, STR_MENUTELEMETRY, g_eeGeneral.modelTelemetryDisabled, attr, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user