From 4c201da3b6cbcee8d980a8737f177592947a70d7 Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 23 May 2014 23:12:59 +0200 Subject: [PATCH] A3 and A4 now configurable in Companion --- companion/src/eeprominterface.h | 2 +- .../src/firmwares/opentx/opentxeeprom.cpp | 2 +- companion/src/modeledit/telemetry.cpp | 17 +- companion/src/modeledit/telemetry.h | 2 +- companion/src/modeledit/telemetry.ui | 782 +++++++++--------- 5 files changed, 426 insertions(+), 379 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 39c4fa830..f3df6471a 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -859,7 +859,7 @@ class FrSkyScreenData { class FrSkyData { public: FrSkyData() { clear(); } - FrSkyChannelData channels[2]; + FrSkyChannelData channels[4]; unsigned int usrProto; unsigned int imperial; int blades; diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 02ed2ec2b..bff2c6919 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -2197,7 +2197,7 @@ class FrskyField: public StructField { rssiConversionTable[1] = RSSIConversionTable(1); if (IS_ARM(board)) { - for (int i=0; i < ((version >= 216) ? 4 : 2); i++) { + for (int i=0; i<((version >= 216) ? 4 : 2); i++) { Append(new UnsignedField<8>(frsky.channels[i].ratio, "Ratio")); Append(new SignedField<12>(frsky.channels[i].offset, "Offset")); Append(new UnsignedField<4>(frsky.channels[i].type, "Type")); diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 50e629086..099853bdb 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -266,7 +266,8 @@ void TelemetryAnalog::on_alarm2ValueSB_editingFinished() } else if (alarm2value>(ratio+(calib*ratio)/255)) { analog.alarms[1].value=255; - } else { + } + else { analog.alarms[1].value = round((alarm2value-((calib*ratio)/255))/ratio*255); } update(); @@ -483,6 +484,20 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin ui->A2Layout->addWidget(analogs[1]); connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified())); + if (IS_ARM(GetEepromInterface()->getBoard())) { + analogs[2] = new TelemetryAnalog(this, model.frsky.channels[2], model, generalSettings, firmware); + ui->A3Layout->addWidget(analogs[2]); + connect(analogs[2], SIGNAL(modified()), this, SLOT(onAnalogModified())); + + analogs[3] = new TelemetryAnalog(this, model.frsky.channels[3], model, generalSettings, firmware); + ui->A4Layout->addWidget(analogs[3]); + connect(analogs[3], SIGNAL(modified()), this, SLOT(onAnalogModified())); + } + else { + ui->A3GB->hide(); + ui->A4GB->hide(); + } + for (int i=0; igetCapability(TelemetryCustomScreens); i++) { TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware); ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1)); diff --git a/companion/src/modeledit/telemetry.h b/companion/src/modeledit/telemetry.h index 3c949b524..a0d6419c2 100644 --- a/companion/src/modeledit/telemetry.h +++ b/companion/src/modeledit/telemetry.h @@ -110,7 +110,7 @@ class TelemetryPanel : public ModelPanel private: Ui::Telemetry *ui; - TelemetryAnalog * analogs[2]; + TelemetryAnalog * analogs[4]; void setup(); void telBarUpdate(); diff --git a/companion/src/modeledit/telemetry.ui b/companion/src/modeledit/telemetry.ui index 2f5b14a62..7b68fa532 100644 --- a/companion/src/modeledit/telemetry.ui +++ b/companion/src/modeledit/telemetry.ui @@ -13,16 +13,13 @@ - + 0 - - - QLayout::SetMinimumSize - - + + @@ -68,19 +65,12 @@ - - - - Qt::Vertical - - - - - + + false - + 0 @@ -94,7 +84,7 @@ 3 - + 75 @@ -102,32 +92,31 @@ - A2 + A4 - - - - Qt::Vertical - - - - - + + 0 0 + + true + + + + false - + 0 @@ -140,191 +129,8 @@ 3 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - Alarm 1 - - - - - - - - 0 - 0 - - - - - ---- - - - - - Yellow - - - - - Orange - - - - - Red - - - - - - - - true - - - - 0 - 0 - - - - - - - 20 - - - 80 - - - 1 - - - 50 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Alarm 2 - - - - - - - - 0 - 0 - - - - - ---- - - - - - Yellow - - - - - Orange - - - - - Red - - - - - - - - true - - - - 0 - 0 - - - - - - - 20 - - - 80 - - - 1 - - - 50 - - - - - + + 75 @@ -332,31 +138,14 @@ - RSSI + A3 - - - - - - Qt::Horizontal - - - - - - - 0 - - - QLayout::SetMinimumSize - - + @@ -611,14 +400,251 @@ - - - - Qt::Vertical + + + + false + + + 0 + + + 0 + + + 3 + + + 3 + + + + + + 75 + true + + + + A2 + + + + - + + + + + 0 + 0 + + + + false + + + + 0 + + + 0 + + + 3 + + + 3 + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + Alarm 1 + + + + + + + + 0 + 0 + + + + + ---- + + + + + Yellow + + + + + Orange + + + + + Red + + + + + + + + true + + + + 0 + 0 + + + + + + + 20 + + + 80 + + + 1 + + + 50 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Alarm 2 + + + + + + + + 0 + 0 + + + + + ---- + + + + + Yellow + + + + + Orange + + + + + Red + + + + + + + + true + + + + 0 + 0 + + + + + + + 20 + + + 80 + + + 1 + + + 50 + + + + + + + + 75 + true + + + + RSSI + + + + + + + @@ -919,152 +945,158 @@ + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 3 + + + 9 + + + 0 + + + + + 3 + + + 0 + + + + + mAh count + + + + + + + + 0 + 0 + + + + mAh + + + 32767 + + + + + + + + 0 + 0 + + + + A + + + 1 + + + -1.500000000000000 + + + 1.500000000000000 + + + 0.100000000000000 + + + + + + + + 0 + 0 + + + + FAS Offset + + + + + + + Persistent mAh + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Various + + + + + + + + - + + + + 0 + 20 + + Qt::Horizontal - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 3 - - - 9 - - - 0 - - - - - 6 - - - 0 - - - - - mAh count - - - - - - - - 0 - 0 - - - - mAh - - - 32767 - - - - - - - - 0 - 0 - - - - A - - - 1 - - - -1.500000000000000 - - - 1.500000000000000 - - - 0.100000000000000 - - - - - - - - 0 - 0 - - - - FAS Offset - - - - - - - Persistent mAh - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Various - - - - - - - -