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:
philmoz
2023-05-22 20:08:16 +10:00
committed by GitHub
parent 04359757c4
commit 5327c890f2
98 changed files with 2459 additions and 452 deletions
@@ -74,7 +74,7 @@ static const YamlLookupTable potsWarningModeLut = {
{ 2, "WARN_AUTO" },
};
static const YamlLookupTable jitterFilterLut = {
static const YamlLookupTable globalOnOffFilterLut = {
{ 0, "GLOBAL" },
{ 1, "OFF" },
{ 2, "ON" },
@@ -782,6 +782,8 @@ Node convert<ModelData>::encode(const ModelData& rhs)
Node node;
auto board = getCurrentBoard();
bool hasColorLcd = Boards::getCapability(board, Board::HasColorLcd);
node["semver"] = VERSION;
Node header;
@@ -896,7 +898,7 @@ Node convert<ModelData>::encode(const ModelData& rhs)
node["thrTrimSw"] = rhs.thrTrimSwitch;
node["potsWarnMode"] = potsWarningModeLut << rhs.potsWarningMode;
node["jitterFilter"] = jitterFilterLut << rhs.jitterFilter;
node["jitterFilter"] = globalOnOffFilterLut << rhs.jitterFilter;
YamlPotsWarnEnabled potsWarnEnabled(&rhs.potsWarnEnabled[0]);
node["potsWarnEnabled"] = potsWarnEnabled.value;
@@ -943,7 +945,7 @@ Node convert<ModelData>::encode(const ModelData& rhs)
node["varioData"] = vario;
node["rssiSource"] = YamlTelemSource(rhs.rssiSource);
if (IS_TARANIS_X9(getCurrentBoard())) {
if (IS_TARANIS_X9(board)) {
node["voltsSource"] = YamlTelemSource(rhs.frsky.voltsSource);
node["altitudeSource"] = YamlTelemSource(rhs.frsky.altitudeSource);
}
@@ -986,7 +988,7 @@ Node convert<ModelData>::encode(const ModelData& rhs)
node["toplcdTimer"] = rhs.toplcdTimer;
}
if (IS_FAMILY_HORUS_OR_T16(getCurrentBoard())) {
if (IS_FAMILY_HORUS_OR_T16(board)) {
for (int i=0; i<MAX_CUSTOM_SCREENS; i++) {
const auto& csd = rhs.customScreens.customScreenData[i];
if (!csd.isEmpty()) {
@@ -1003,7 +1005,7 @@ Node convert<ModelData>::encode(const ModelData& rhs)
node["modelRegistrationID"] = rhs.registrationId;
if (Boards::getCapability(getCurrentBoard(), Board::FunctionSwitches)) {
if (Boards::getCapability(board, Board::FunctionSwitches)) {
node["functionSwitchConfig"] = rhs.functionSwitchConfig;
node["functionSwitchGroup"] = rhs.functionSwitchGroup;
node["functionSwitchStartConfig"] = rhs.functionSwitchStartConfig;
@@ -1026,6 +1028,21 @@ Node convert<ModelData>::encode(const ModelData& rhs)
}
}
// Radio level tabs control (global settings)
if (hasColorLcd)
node["radioThemesDisabled"] = globalOnOffFilterLut << rhs.radioThemesDisabled;
node["radioGFDisabled"] = globalOnOffFilterLut << rhs.radioGFDisabled;
node["radioTrainerDisabled"] = globalOnOffFilterLut << rhs.radioTrainerDisabled;
// Model level tabs control (global setting)
node["modelHeliDisabled"] = globalOnOffFilterLut << rhs.modelHeliDisabled;
node["modelFMDisabled"] = globalOnOffFilterLut << rhs.modelFMDisabled;
node["modelCurvesDisabled"] = globalOnOffFilterLut << rhs.modelCurvesDisabled;
node["modelGVDisabled"] = globalOnOffFilterLut << rhs.modelGVDisabled;
node["modelLSDisabled"] = globalOnOffFilterLut << rhs.modelLSDisabled;
node["modelSFDisabled"] = globalOnOffFilterLut << rhs.modelSFDisabled;
node["modelCustomScriptsDisabled"] = globalOnOffFilterLut << rhs.modelCustomScriptsDisabled;
node["modelTelemetryDisabled"] = globalOnOffFilterLut << rhs.modelTelemetryDisabled;
return node;
}
@@ -1099,7 +1116,7 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
node["thrTrimSw"] >> rhs.thrTrimSwitch;
node["potsWarnMode"] >> potsWarningModeLut >> rhs.potsWarningMode;
node["jitterFilter"] >> jitterFilterLut >> rhs.jitterFilter;
node["jitterFilter"] >> globalOnOffFilterLut >> rhs.jitterFilter;
YamlPotsWarnEnabled potsWarnEnabled;
node["potsWarnEnabled"] >> potsWarnEnabled.value;
@@ -1219,6 +1236,20 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
node["usbJoystickCircularCut"] >> rhs.usbJoystickCircularCut;
node["usbJoystickCh"] >> rhs.usbJoystickCh;
// Radio level tabs control (global settings)
node["radioThemesDisabled"] >> globalOnOffFilterLut >> rhs.radioThemesDisabled;
node["radioGFDisabled"] >> globalOnOffFilterLut >> rhs.radioGFDisabled;
node["radioTrainerDisabled"] >> globalOnOffFilterLut >> rhs.radioTrainerDisabled;
// Model level tabs control (global setting)
node["modelHeliDisabled"] >> globalOnOffFilterLut >> rhs.modelHeliDisabled;
node["modelFMDisabled"] >> globalOnOffFilterLut >> rhs.modelFMDisabled;
node["modelCurvesDisabled"] >> globalOnOffFilterLut >> rhs.modelCurvesDisabled;
node["modelGVDisabled"] >> globalOnOffFilterLut >> rhs.modelGVDisabled;
node["modelLSDisabled"] >> globalOnOffFilterLut >> rhs.modelLSDisabled;
node["modelSFDisabled"] >> globalOnOffFilterLut >> rhs.modelSFDisabled;
node["modelCustomScriptsDisabled"] >> globalOnOffFilterLut >> rhs.modelCustomScriptsDisabled;
node["modelTelemetryDisabled"] >> globalOnOffFilterLut >> rhs.modelTelemetryDisabled;
// preferably perform conversions here to avoid cluttering the field decodes
if (SemanticVersion(QString(rhs.semver)) < SemanticVersion("2.8.0")) {