From 9b002b94ca5e834d78894f95e3d9c2b423711419 Mon Sep 17 00:00:00 2001 From: Andre Bernet Date: Fri, 24 Jul 2015 21:54:46 +0200 Subject: [PATCH] GF enabled checkbox was missing (Fix #2558) Number of GF in setup panel was not aligned with the radio --- companion/src/eeprominterface.h | 1 + companion/src/firmwares/opentx/opentxinterface.cpp | 2 ++ companion/src/modeledit/customfunctions.cpp | 5 +++-- companion/src/modeledit/setup.cpp | 11 +++++++++++ companion/src/modeledit/setup.h | 1 + companion/src/modeledit/setup.ui | 7 +++++++ 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index f5d3dff35..7f8deef4a 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -1312,6 +1312,7 @@ enum Capability { LCDWidth, GetThrSwitch, HasDisplayText, + GlobalFunctions, VirtualInputs, TrainerInputs, RtcTime, diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 90769bd92..0904ae641 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -731,6 +731,8 @@ int OpenTxFirmware::getCapability(const Capability capability) return (IS_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR) ; case HasDisplayText: return IS_ARM(board) ? 1 : 0; + case GlobalFunctions: + return IS_ARM(board) ? 64 : 0; case VirtualInputs: return IS_TARANIS(board) ? 32 : 0; case TrainerInputs: diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index c2b8f0430..5442f2e6b 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -61,7 +61,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, addEmptyLabel(gridLayout, 5 ); lock = true; - int num_fsw = firmware->getCapability(CustomFunctions); + int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions); if (!firmware->getCapability(VoicesAsNumbers)) { tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength)); @@ -514,7 +514,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) void CustomFunctionsPanel::update() { lock = true; - for (int i=0; igetCapability(CustomFunctions); i++) { + int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions); + for (int i=0; igetCapability(HasDisplayText)) { ui->displayText->hide(); } + + if (!firmware->getCapability(GlobalFunctions)) { + ui->gfEnabled->hide(); + } // Beep Center checkboxes prevFocus = ui->trimsDisplay; @@ -774,6 +778,7 @@ void SetupPanel::update() ui->extendedLimits->setChecked(model->extendedLimits); ui->extendedTrims->setChecked(model->extendedTrims); ui->displayText->setChecked(model->displayChecklist); + ui->gfEnabled->setChecked(!model->noGlobalFunctions); updateBeepCenter(); updateStartupSwitches(); @@ -915,6 +920,12 @@ void SetupPanel::on_displayText_toggled(bool checked) emit modified(); } +void SetupPanel::on_gfEnabled_toggled(bool checked) +{ + model->noGlobalFunctions = !checked; + emit modified(); +} + void SetupPanel::on_throttleTrim_toggled(bool checked) { model->thrTrim = checked; diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 3e4b1926b..2f732be1a 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -101,6 +101,7 @@ class SetupPanel : public ModelPanel void on_throttleWarning_toggled(bool checked); void on_throttleReverse_toggled(bool checked); void on_displayText_toggled(bool checked); + void on_gfEnabled_toggled(bool checked); void on_image_currentIndexChanged(int index); void on_trimIncrement_currentIndexChanged(int index); void onBeepCenterToggled(bool checked); diff --git a/companion/src/modeledit/setup.ui b/companion/src/modeledit/setup.ui index 28f5469f3..825579534 100644 --- a/companion/src/modeledit/setup.ui +++ b/companion/src/modeledit/setup.ui @@ -215,6 +215,13 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi + + + + Global Functions + + +