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:
@@ -182,8 +182,12 @@ bool isSourceAvailable(int source)
|
||||
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
if (source >= MIXSRC_FIRST_LUA && source <= MIXSRC_LAST_LUA) {
|
||||
div_t qr = div(source - MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
||||
return (qr.rem<scriptInputsOutputs[qr.quot].outputsCount);
|
||||
if (modelCustomScriptsEnabled()) {
|
||||
div_t qr = div(source - MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
||||
return (qr.rem<scriptInputsOutputs[qr.quot].outputsCount);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#elif defined(LUA_INPUTS)
|
||||
if (source >= MIXSRC_FIRST_LUA && source <= MIXSRC_LAST_LUA)
|
||||
@@ -215,6 +219,9 @@ bool isSourceAvailable(int source)
|
||||
#if !defined(HELI)
|
||||
if (source >= MIXSRC_CYC1 && source <= MIXSRC_CYC3)
|
||||
return false;
|
||||
#else
|
||||
if (!modelHeliEnabled() && source >= MIXSRC_CYC1 && source <= MIXSRC_CYC3)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (source >= MIXSRC_FIRST_CH && source <= MIXSRC_LAST_CH) {
|
||||
@@ -229,6 +236,9 @@ bool isSourceAvailable(int source)
|
||||
#if !defined(GVARS)
|
||||
if (source >= MIXSRC_GVAR1 && source <= MIXSRC_LAST_GVAR)
|
||||
return false;
|
||||
#else
|
||||
if (!modelGVEnabled() && source >= MIXSRC_GVAR1 && source <= MIXSRC_LAST_GVAR)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (source >= MIXSRC_FIRST_RESERVE && source <= MIXSRC_LAST_RESERVE)
|
||||
@@ -238,6 +248,8 @@ bool isSourceAvailable(int source)
|
||||
return g_model.trainerData.mode > 0;
|
||||
|
||||
if (source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
if (!modelTelemetryEnabled())
|
||||
return false;
|
||||
div_t qr = div(source - MIXSRC_FIRST_TELEM, 3);
|
||||
if (qr.rem == 0)
|
||||
return isTelemetryFieldAvailable(qr.quot);
|
||||
@@ -260,7 +272,7 @@ bool isSourceAvailableInCustomSwitches(int source)
|
||||
{
|
||||
bool result = isSourceAvailable(source);
|
||||
|
||||
if (result && source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
if (result && modelTelemetryEnabled() && source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source - MIXSRC_FIRST_TELEM, 3);
|
||||
result = isTelemetryFieldComparisonAvailable(qr.quot);
|
||||
}
|
||||
@@ -298,12 +310,12 @@ bool isSourceAvailableInInputs(int source)
|
||||
if (source >= MIXSRC_FIRST_TRAINER && source <= MIXSRC_LAST_TRAINER)
|
||||
return g_model.trainerData.mode > 0;
|
||||
|
||||
if (source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
if (modelTelemetryEnabled() && source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source - MIXSRC_FIRST_TELEM, 3);
|
||||
return isTelemetryFieldAvailable(qr.quot) && isTelemetryFieldComparisonAvailable(qr.quot);
|
||||
}
|
||||
|
||||
if (source >= MIXSRC_FIRST_GVAR && source <= MIXSRC_LAST_GVAR)
|
||||
if (modelGVEnabled() && source >= MIXSRC_FIRST_GVAR && source <= MIXSRC_LAST_GVAR)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user