From 9c0dc91667d73840b349de1250237dd9127ce689 Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 2 Dec 2014 19:16:37 +0100 Subject: [PATCH] Trims display parameter added to Companion --- companion/src/eeprominterface.h | 1 + .../src/firmwares/opentx/opentxeeprom.cpp | 8 +- companion/src/modeledit/setup.cpp | 9 ++ companion/src/modeledit/setup.ui | 102 +++++++++++++----- 4 files changed, 91 insertions(+), 29 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 81bd274e0..7ac4ac633 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -994,6 +994,7 @@ class ModelData { bool noGlobalFunctions; bool thrTrim; // Enable Throttle Trim int trimInc; // Trim Increments + unsigned int trimsDisplay; bool disableThrottleWarning; unsigned int beepANACenter; // 1<<0->A1.. 1<<6->A7 diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index aa046575f..93510b2a2 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -2794,9 +2794,13 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne internalField.Append(new BoolField<1>(modelData.thrTrim)); - if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216)) { + if (IS_ARM(board) && version >= 217) { internalField.Append(new BoolField<1>(modelData.noGlobalFunctions)); - internalField.Append(new SpareBitsField<3>()); + internalField.Append(new UnsignedField<2>(modelData.trimsDisplay)); + internalField.Append(new SpareBitsField<1>()); + } + else if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216)) { + internalField.Append(new SpareBitsField<4>()); } else { internalField.Append(new ConversionField< SignedField<4> >(modelData.moduleData[0].channelsCount, &channelsConversionTable, "Channels number", ::QObject::tr("OpenTX doesn't allow this number of channels"))); diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 4dbfe3fcb..53eef2007 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -520,6 +520,15 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen ui->potWarningMode->hide(); } + if (IS_ARM(board)) { + ui->trimsDisplay->setField(model.trimsDisplay, this); + } + else { + ui->labelTrimsDisplay->hide(); + ui->trimsDisplay->hide(); + } + + disableMouseScrolling(); lock = false; diff --git a/companion/src/modeledit/setup.ui b/companion/src/modeledit/setup.ui index b6dd9291b..bade33288 100644 --- a/companion/src/modeledit/setup.ui +++ b/companion/src/modeledit/setup.ui @@ -66,6 +66,36 @@ + + + + Qt::LeftToRight + + + Extended Trims + + + + + + + Qt::LeftToRight + + + Display Checklist + + + + + + + Qt::LeftToRight + + + Extended Limits + + + @@ -82,16 +112,6 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi - - - - Qt::LeftToRight - - - Extended Limits - - - @@ -102,16 +122,6 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi - - - - Qt::LeftToRight - - - Extended Trims - - - @@ -180,14 +190,29 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi - - - - Qt::LeftToRight - - - Display Checklist + + + + + 0 + 0 + + + + Never + + + + + On change + + + + + Always + + @@ -226,6 +251,22 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi + + + + + 50 + false + + + + Trims Display + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -548,6 +589,13 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi + + + AutoComboBox + QComboBox +
autocombobox.h
+
+