mirror of
https://github.com/opentx/opentx.git
synced 2025-07-17 21:35:27 +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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FrSkyScreenData::clear()
|
||||||
|
{
|
||||||
|
memset(this, 0, sizeof(FrSkyScreenData));
|
||||||
|
if (!IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||||
|
type = TELEMETRY_SCREEN_NUMBERS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FrSkyData::clear()
|
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[0].clear(2, 45);
|
||||||
rssiAlarms[1].clear(3, 42);
|
rssiAlarms[1].clear(3, 42);
|
||||||
|
for (int i=0; i<4; i++)
|
||||||
|
screens[i].clear();
|
||||||
varioSource = 2/*VARIO*/;
|
varioSource = 2/*VARIO*/;
|
||||||
blades = 2;
|
blades = 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -725,7 +725,7 @@ class FrSkyScreenData {
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
FrSkyScreenBody body;
|
FrSkyScreenBody body;
|
||||||
|
|
||||||
void clear() { memset(this, 0, sizeof(FrSkyScreenData)); }
|
void clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TelemetryVarioSources {
|
enum TelemetryVarioSources {
|
||||||
|
@ -1252,7 +1252,6 @@ enum Capability {
|
||||||
Haptic,
|
Haptic,
|
||||||
HasBeeper,
|
HasBeeper,
|
||||||
ModelTrainerEnable,
|
ModelTrainerEnable,
|
||||||
Timer2ThrTrig,
|
|
||||||
HasExpoNames,
|
HasExpoNames,
|
||||||
HasNoExpo,
|
HasNoExpo,
|
||||||
HasMixerNames,
|
HasMixerNames,
|
||||||
|
@ -1265,7 +1264,6 @@ enum Capability {
|
||||||
OptrexDisplay,
|
OptrexDisplay,
|
||||||
PPMExtCtrl,
|
PPMExtCtrl,
|
||||||
PPMFrameLength,
|
PPMFrameLength,
|
||||||
DSM2Indexes,
|
|
||||||
Telemetry,
|
Telemetry,
|
||||||
TelemetryUnits,
|
TelemetryUnits,
|
||||||
TelemetryBars,
|
TelemetryBars,
|
||||||
|
@ -1301,6 +1299,8 @@ enum Capability {
|
||||||
HasDisplayText,
|
HasDisplayText,
|
||||||
VirtualInputs,
|
VirtualInputs,
|
||||||
TrainerInputs,
|
TrainerInputs,
|
||||||
|
RtcTime,
|
||||||
|
SportTelemetry,
|
||||||
LuaScripts,
|
LuaScripts,
|
||||||
LuaInputsPerScript,
|
LuaInputsPerScript,
|
||||||
LuaOutputsPerScript,
|
LuaOutputsPerScript,
|
||||||
|
|
|
@ -662,8 +662,6 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||||
return 500;
|
return 500;
|
||||||
case Simulation:
|
case Simulation:
|
||||||
return 1;
|
return 1;
|
||||||
case DSM2Indexes:
|
|
||||||
return 1;
|
|
||||||
case NumCurves:
|
case NumCurves:
|
||||||
return (IS_TARANIS(board) ? 32 : (IS_ARM(board) ? 16 : 8));
|
return (IS_TARANIS(board) ? 32 : (IS_ARM(board) ? 16 : 8));
|
||||||
case HasMixerNames:
|
case HasMixerNames:
|
||||||
|
@ -737,8 +735,10 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||||
return IS_TARANIS(board) ? 32 : 0;
|
return IS_TARANIS(board) ? 32 : 0;
|
||||||
case TrainerInputs:
|
case TrainerInputs:
|
||||||
return IS_ARM(board) ? 16 : 8;
|
return IS_ARM(board) ? 16 : 8;
|
||||||
|
case RtcTime:
|
||||||
|
return IS_ARM(board) || IS_2560(board) ? 1 : 0;
|
||||||
case LuaScripts:
|
case LuaScripts:
|
||||||
return IS_TARANIS(board) ? 7 : 0;
|
return IS_TARANIS(board) && id.contains("lua") ? 7 : 0;
|
||||||
case LuaInputsPerScript:
|
case LuaInputsPerScript:
|
||||||
return IS_TARANIS(board) ? 10 : 0;
|
return IS_TARANIS(board) ? 10 : 0;
|
||||||
case LuaOutputsPerScript:
|
case LuaOutputsPerScript:
|
||||||
|
@ -763,6 +763,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||||
return 0;
|
return 0;
|
||||||
case MavlinkTelemetry:
|
case MavlinkTelemetry:
|
||||||
return id.contains("mavlink") ? 1 : 0;
|
return id.contains("mavlink") ? 1 : 0;
|
||||||
|
case SportTelemetry:
|
||||||
|
return IS_ARM(board) ? 1 : 0;
|
||||||
case HasInputDiff:
|
case HasInputDiff:
|
||||||
case HasMixerExpo:
|
case HasMixerExpo:
|
||||||
return (IS_TARANIS(board) ? true : false);
|
return (IS_TARANIS(board) ? true : false);
|
||||||
|
|
|
@ -627,8 +627,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
if (flags & POPULATE_TELEMETRY) {
|
||||||
if ((flags & POPULATE_TELEMETRY) || (flags & POPULATE_TELEMETRYEXT)) {
|
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||||
for (int i=0; i<5; ++i) {
|
for (int i=0; i<5; ++i) {
|
||||||
item = RawSource(SOURCE_TYPE_SPECIAL, i);
|
item = RawSource(SOURCE_TYPE_SPECIAL, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
|
@ -645,25 +645,20 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else if (flags & POPULATE_TELEMETRYEXT) {
|
for (int i=0; i<(flags & POPULATE_TELEMETRYEXT ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_COUNT); i++) {
|
||||||
for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) {
|
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board))
|
||||||
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board))
|
continue;
|
||||||
continue;
|
if (i==TELEMETRY_SOURCE_TX_TIME && !GetCurrentFirmware()->getCapability(RtcTime))
|
||||||
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
|
continue;
|
||||||
b->addItem(item.toString(model), item.toValue());
|
if (i==TELEMETRY_SOURCE_SWR && !GetCurrentFirmware()->getCapability(SportTelemetry))
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
continue;
|
||||||
}
|
if (i==TELEMETRY_SOURCE_TIMER3 && !IS_ARM(board))
|
||||||
}
|
continue;
|
||||||
else if (flags & POPULATE_TELEMETRY) {
|
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
|
||||||
for (int i=0; i<TELEMETRY_SOURCES_COUNT; i++) {
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board))
|
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS);
|
||||||
}
|
}
|
||||||
else if (function==FuncPlayValue) {
|
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) {
|
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
|
||||||
switch (adjustmode) {
|
switch (adjustmode) {
|
||||||
|
|
|
@ -330,6 +330,14 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
|
||||||
|
|
||||||
disableMouseScrolling();
|
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();
|
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));
|
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 {
|
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;
|
lock = true;
|
||||||
|
|
||||||
ui->screenType->setCurrentIndex(screen.type);
|
|
||||||
ui->screenNums->setVisible(screen.type == TELEMETRY_SCREEN_NUMBERS);
|
ui->screenNums->setVisible(screen.type == TELEMETRY_SCREEN_NUMBERS);
|
||||||
ui->screenBars->setVisible(screen.type == TELEMETRY_SCREEN_BARS);
|
ui->screenBars->setVisible(screen.type == TELEMETRY_SCREEN_BARS);
|
||||||
|
|
||||||
|
@ -379,11 +386,8 @@ void TelemetryCustomScreen::updateBar(int line)
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
#if 0
|
RawSource source = screen.body.bars[line].source;
|
||||||
int index = screen.body.bars[line].source;
|
if (source.type != SOURCE_TYPE_NONE) {
|
||||||
barsCB[line]->setCurrentIndex(index);
|
|
||||||
if (index) {
|
|
||||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1);
|
|
||||||
RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION);
|
RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION);
|
||||||
int max = round((range.max - range.min) / range.step);
|
int max = round((range.max - range.min) / range.step);
|
||||||
if (int(255-screen.body.bars[line].barMax) > max)
|
if (int(255-screen.body.bars[line].barMax) > max)
|
||||||
|
@ -405,7 +409,6 @@ void TelemetryCustomScreen::updateBar(int line)
|
||||||
minSB[line]->setDisabled(true);
|
minSB[line]->setDisabled(true);
|
||||||
maxSB[line]->setDisabled(true);
|
maxSB[line]->setDisabled(true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +417,6 @@ void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
memset(&screen.body, 0, sizeof(screen.body));
|
memset(&screen.body, 0, sizeof(screen.body));
|
||||||
screen.type = index;
|
|
||||||
update();
|
update();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,14 @@
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>TelemetryCustomScreen</class>
|
<class>TelemetryCustomScreen</class>
|
||||||
<widget class="QWidget" name="TelemetryCustomScreen">
|
<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">
|
<property name="windowTitle">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -28,7 +36,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="screenType">
|
<widget class="AutoComboBox" name="screenType">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -41,26 +49,6 @@
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -131,6 +119,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>AutoComboBox</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>autocombobox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue