diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index a9d62183e..e8d47a139 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -1201,11 +1201,31 @@ RawSourceRange FrSkyChannelData::getRange() const return result; } +void FrSkyScreenData::clear() +{ + memset(this, 0, sizeof(FrSkyScreenData)); + if (!IS_ARM(GetCurrentFirmware()->getBoard())) { + type = TELEMETRY_SCREEN_NUMBERS; + } +} + void FrSkyData::clear() { - memset(this, 0, sizeof(FrSkyData)); + usrProto = 0; + voltsSource = 0; + altitudeSource = 0; + currentSource = 0; + varioMin = 0; + varioCenterMin = 0; // if increment in 0.2m/s = 3.0m/s max + varioCenterMax = 0; + varioMax = 0; + mAhPersistent = 0; + storedMah = 0; + fasOffset = 0; rssiAlarms[0].clear(2, 45); rssiAlarms[1].clear(3, 42); + for (int i=0; i<4; i++) + screens[i].clear(); varioSource = 2/*VARIO*/; blades = 2; } diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 057978de5..c20edeeda 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -725,7 +725,7 @@ class FrSkyScreenData { unsigned int type; FrSkyScreenBody body; - void clear() { memset(this, 0, sizeof(FrSkyScreenData)); } + void clear(); }; enum TelemetryVarioSources { @@ -1252,7 +1252,6 @@ enum Capability { Haptic, HasBeeper, ModelTrainerEnable, - Timer2ThrTrig, HasExpoNames, HasNoExpo, HasMixerNames, @@ -1265,7 +1264,6 @@ enum Capability { OptrexDisplay, PPMExtCtrl, PPMFrameLength, - DSM2Indexes, Telemetry, TelemetryUnits, TelemetryBars, @@ -1301,6 +1299,8 @@ enum Capability { HasDisplayText, VirtualInputs, TrainerInputs, + RtcTime, + SportTelemetry, LuaScripts, LuaInputsPerScript, LuaOutputsPerScript, diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 8ce20f065..241177273 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -662,8 +662,6 @@ int OpenTxFirmware::getCapability(const Capability capability) return 500; case Simulation: return 1; - case DSM2Indexes: - return 1; case NumCurves: return (IS_TARANIS(board) ? 32 : (IS_ARM(board) ? 16 : 8)); case HasMixerNames: @@ -737,8 +735,10 @@ int OpenTxFirmware::getCapability(const Capability capability) return IS_TARANIS(board) ? 32 : 0; case TrainerInputs: return IS_ARM(board) ? 16 : 8; + case RtcTime: + return IS_ARM(board) || IS_2560(board) ? 1 : 0; case LuaScripts: - return IS_TARANIS(board) ? 7 : 0; + return IS_TARANIS(board) && id.contains("lua") ? 7 : 0; case LuaInputsPerScript: return IS_TARANIS(board) ? 10 : 0; case LuaOutputsPerScript: @@ -763,6 +763,8 @@ int OpenTxFirmware::getCapability(const Capability capability) return 0; case MavlinkTelemetry: return id.contains("mavlink") ? 1 : 0; + case SportTelemetry: + return IS_ARM(board) ? 1 : 0; case HasInputDiff: case HasMixerExpo: return (IS_TARANIS(board) ? true : false); diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 8bb4199eb..a5d00d0a3 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -627,8 +627,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti } } - if (IS_ARM(GetCurrentFirmware()->getBoard())) { - if ((flags & POPULATE_TELEMETRY) || (flags & POPULATE_TELEMETRYEXT)) { + if (flags & POPULATE_TELEMETRY) { + if (IS_ARM(GetCurrentFirmware()->getBoard())) { for (int i=0; i<5; ++i) { item = RawSource(SOURCE_TYPE_SPECIAL, i); b->addItem(item.toString(model), item.toValue()); @@ -645,25 +645,20 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti } } } - } - else if (flags & POPULATE_TELEMETRYEXT) { - for (int i=0; iaddItem(item.toString(model), item.toValue()); - if (item == source) b->setCurrentIndex(b->count()-1); - } - } - else if (flags & POPULATE_TELEMETRY) { - for (int i=0; iaddItem(item.toString(model), item.toValue()); - if (item == source) b->setCurrentIndex(b->count()-1); + else { + for (int i=0; i<(flags & POPULATE_TELEMETRYEXT ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_COUNT); i++) { + if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board)) + continue; + if (i==TELEMETRY_SOURCE_TX_TIME && !GetCurrentFirmware()->getCapability(RtcTime)) + continue; + if (i==TELEMETRY_SOURCE_SWR && !GetCurrentFirmware()->getCapability(SportTelemetry)) + continue; + if (i==TELEMETRY_SOURCE_TIMER3 && !IS_ARM(board)) + continue; + item = RawSource(SOURCE_TYPE_TELEMETRY, i); + b->addItem(item.toString(model), item.toValue()); + if (item == source) b->setCurrentIndex(b->count()-1); + } } } diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index da6c7f3d4..a7b6c08b3 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -718,7 +718,7 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsi populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS); } else if (function==FuncPlayValue) { - populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT); + populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRY|POPULATE_TELEMETRYEXT); } else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) { switch (adjustmode) { diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index e21bae6ca..b891ad5da 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -330,6 +330,14 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, disableMouseScrolling(); + if (IS_ARM(firmware->getBoard())) + ui->screenType->addItem(tr("None"), TELEMETRY_SCREEN_NONE); + ui->screenType->addItem(tr("Numbers"), TELEMETRY_SCREEN_NUMBERS); + ui->screenType->addItem(tr("Bars"), TELEMETRY_SCREEN_BARS); + if (IS_TARANIS(firmware->getBoard())) + ui->screenType->addItem(tr("Script"), TELEMETRY_SCREEN_SCRIPT); + ui->screenType->setField(screen.type, this); + update(); } @@ -339,7 +347,7 @@ void TelemetryCustomScreen::populateTelemetrySourceCB(QComboBox * b, RawSource & populateSourceCB(b, source, generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); } else { - populateSourceCB(b, source, generalSettings, model, POPULATE_NONE | (last ? POPULATE_TELEMETRYEXT : POPULATE_TELEMETRY)); + populateSourceCB(b, source, generalSettings, model, POPULATE_NONE | POPULATE_TELEMETRY | (last ? POPULATE_TELEMETRYEXT : 0)); } } @@ -352,7 +360,6 @@ void TelemetryCustomScreen::update() { lock = true; - ui->screenType->setCurrentIndex(screen.type); ui->screenNums->setVisible(screen.type == TELEMETRY_SCREEN_NUMBERS); ui->screenBars->setVisible(screen.type == TELEMETRY_SCREEN_BARS); @@ -379,11 +386,8 @@ void TelemetryCustomScreen::updateBar(int line) { lock = true; -#if 0 - int index = screen.body.bars[line].source; - barsCB[line]->setCurrentIndex(index); - if (index) { - RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1); + RawSource source = screen.body.bars[line].source; + if (source.type != SOURCE_TYPE_NONE) { RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION); int max = round((range.max - range.min) / range.step); if (int(255-screen.body.bars[line].barMax) > max) @@ -405,7 +409,6 @@ void TelemetryCustomScreen::updateBar(int line) minSB[line]->setDisabled(true); maxSB[line]->setDisabled(true); } -#endif lock = false; } @@ -414,7 +417,6 @@ void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index) { if (!lock) { memset(&screen.body, 0, sizeof(screen.body)); - screen.type = index; update(); emit modified(); } diff --git a/companion/src/modeledit/telemetry_customscreen.ui b/companion/src/modeledit/telemetry_customscreen.ui index 5f92139d6..ea5498e03 100644 --- a/companion/src/modeledit/telemetry_customscreen.ui +++ b/companion/src/modeledit/telemetry_customscreen.ui @@ -2,6 +2,14 @@ TelemetryCustomScreen + + + 0 + 0 + 283 + 86 + + @@ -28,7 +36,7 @@ - + 0 @@ -41,26 +49,6 @@ 0 - - - None - - - - - Numbers - - - - - Bars - - - - - Script - - @@ -131,6 +119,13 @@ + + + AutoComboBox + QComboBox +
autocombobox.h
+
+