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:
@@ -106,6 +106,18 @@ enum {
|
||||
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)
|
||||
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
|
||||
};
|
||||
|
||||
@@ -115,6 +127,12 @@ enum {
|
||||
#define COL_TX_MODE LABEL(TX_MODE)
|
||||
#endif
|
||||
|
||||
uint8_t viewOptCheckBox(coord_t y, const char* title, uint8_t value, uint8_t attr, event_t event)
|
||||
{
|
||||
lcdDrawText(INDENT_WIDTH, y, title);
|
||||
return !editCheckBox(!value, 110, y, nullptr, attr, event ) ;
|
||||
}
|
||||
|
||||
void menuRadioSetup(event_t event)
|
||||
{
|
||||
#if defined(RTCLOCK)
|
||||
@@ -180,7 +198,9 @@ void menuRadioSetup(event_t event)
|
||||
0, // USB mode
|
||||
CASE_JACK_DETECT(0) // Jack mode
|
||||
CASE_ROTARY_ENCODER(0)
|
||||
0, COL_TX_MODE, 0, 1/*to force edit mode*/});
|
||||
0, COL_TX_MODE, 0,
|
||||
LABEL(ViewOptions), LABEL(RadioMenuTabs), 0, 0, LABEL(ModelMenuTabs), CASE_HELI(0) CASE_FLIGHT_MODES(0) 0, 0, 0, CASE_LUA_MODEL_SCRIPTS(0) 0,
|
||||
1/*to force edit mode*/});
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode;
|
||||
@@ -701,6 +721,49 @@ 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-2, 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-2, 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;
|
||||
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