mirror of
https://github.com/opentx/opentx.git
synced 2025-07-17 05:15:18 +03:00
Telemetry fixes
This commit is contained in:
parent
33de4e903e
commit
0f99e07d9a
7 changed files with 73 additions and 59 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -627,8 +627,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
}
|
||||
}
|
||||
|
||||
if (flags & POPULATE_TELEMETRY) {
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
if ((flags & POPULATE_TELEMETRY) || (flags & POPULATE_TELEMETRYEXT)) {
|
||||
for (int i=0; i<5; ++i) {
|
||||
item = RawSource(SOURCE_TYPE_SPECIAL, i);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
|
@ -645,19 +645,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & POPULATE_TELEMETRYEXT) {
|
||||
for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) {
|
||||
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;
|
||||
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
else if (flags & POPULATE_TELEMETRY) {
|
||||
for (int i=0; i<TELEMETRY_SOURCES_COUNT; i++) {
|
||||
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board))
|
||||
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;
|
||||
|
@ -666,6 +660,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & POPULATE_GVARS) {
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(Gvars); i++) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
<ui version="4.0">
|
||||
<class>TelemetryCustomScreen</class>
|
||||
<widget class="QWidget" name="TelemetryCustomScreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>283</width>
|
||||
<height>86</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -28,7 +36,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="screenType">
|
||||
<widget class="AutoComboBox" name="screenType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -41,26 +49,6 @@
|
|||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Numbers</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bars</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Script</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -131,6 +119,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AutoComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>autocombobox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue