From 7140eec2dfb0356ffee6e2c0d0f49887e1367be3 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 22 Jan 2017 09:08:34 +0100 Subject: [PATCH] [Companion] 9XR-PRO EEPROM import fix + cosmetics + compilation error fixed on Manjaro --- companion/src/eeprominterface.h | 1 + companion/src/firmwares/opentx/opentxeeprom.cpp | 4 ++-- companion/src/firmwares/opentx/opentxinterface.cpp | 2 ++ companion/src/modeledit/expodialog.cpp | 5 +++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 4b6b0b1e1..5ba348219 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -161,6 +161,7 @@ enum Capability { HasTopLcd, GlobalFunctions, VirtualInputs, + InputsLength, TrainerInputs, RtcTime, SportTelemetry, diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 8d33e0018..189877add 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -234,7 +234,7 @@ class SourcesConversionTable: public ConversionTable { addConversion(RawSource(SOURCE_TYPE_NONE), val++); } - if (IS_STM32(board) && version >= 216) { + if ((IS_ARM(board) && version >= 218) || (IS_STM32(board) && version >= 216)) { for (int i=0; i<32; i++) { addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++); } @@ -776,7 +776,7 @@ class HeliField: public StructField { public: HeliField(SwashRingData & heli, BoardEnum board, unsigned int version, unsigned int variant) { - if (IS_STM32(board) && version >= 217) { + if ((IS_ARM(board) && version >= 218) || (IS_STM32(board) && version >= 217)) { Append(new UnsignedField<8>(heli.type)); Append(new UnsignedField<8>(heli.value)); Append(new SourceField<8>(heli.collectiveSource, board, version, variant)); diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index ea72521da..b34a20ad0 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -714,6 +714,8 @@ int OpenTxFirmware::getCapability(Capability capability) return IS_ARM(board) ? 64 : 0; case VirtualInputs: return IS_ARM(board) ? 64 : 0; + case InputsLength: + return HAS_LARGE_LCD(board) ? 4 : 3; case TrainerInputs: return IS_ARM(board) ? 16 : 8; case RtcTime: diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp index 168ddb50c..2b350e4bf 100644 --- a/companion/src/modeledit/expodialog.cpp +++ b/companion/src/modeledit/expodialog.cpp @@ -82,7 +82,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G } if (firmware->getCapability(VirtualInputs)) { - ui->inputName->setMaxLength(4); + ui->inputName->setMaxLength(firmware->getCapability(InputsLength)); populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY); ui->sourceCB->removeItem(0); @@ -127,8 +127,9 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G for (int i=0; i<9; i++) { connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged())); } - if (firmware->getCapability(VirtualInputs)) + if (firmware->getCapability(VirtualInputs)) { connect(ui->inputName, SIGNAL(editingFinished()), this, SLOT(valuesChanged())); + } QTimer::singleShot(0, this, SLOT(shrink())); }