qMerge branch 'next' into driver33/PL_translation
@@ -302,3 +302,11 @@ Dan Neelands
|
||||
Yashiro Masayuki
|
||||
Isaac Sloan
|
||||
Harold Baird
|
||||
Roy Bender
|
||||
Bradley Murchie
|
||||
Maximilian Süß
|
||||
Dean Jansa
|
||||
Ronald Donker
|
||||
Paul Oldenkamp
|
||||
Dietmar Drees
|
||||
Bradley Murchie
|
||||
|
||||
@@ -1260,6 +1260,7 @@ void compareDialog::printFrSky()
|
||||
color=getColor1(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value);
|
||||
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>");
|
||||
str.append("</table>");
|
||||
#if 0
|
||||
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
|
||||
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
|
||||
if (cols==0) cols=2;
|
||||
@@ -1315,6 +1316,7 @@ void compareDialog::printFrSky()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
str.append("</td><td width=\"50%\">");
|
||||
str.append("<table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
|
||||
@@ -1377,7 +1379,7 @@ void compareDialog::printFrSky()
|
||||
color=getColor2(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value);
|
||||
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>");
|
||||
str.append("</table></br>");
|
||||
|
||||
#if 0
|
||||
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
|
||||
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
|
||||
if (cols==0) cols=2;
|
||||
@@ -1433,6 +1435,7 @@ void compareDialog::printFrSky()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
str.append("</td></tr></table>");
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
@@ -67,18 +67,15 @@ RawSourceRange RawSource::getRange(bool singleprec)
|
||||
case TELEMETRY_SOURCE_A1:
|
||||
case TELEMETRY_SOURCE_A2:
|
||||
if (model) {
|
||||
if (model->frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) {
|
||||
result.step = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio / 2550.0);
|
||||
result.min = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 2550.0;
|
||||
result.max = model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio - (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 2550.0;
|
||||
const FrSkyChannelData & channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1];
|
||||
float ratio = channel.getRatio();
|
||||
if (channel.type==0 || channel.type==1 || channel.type==2)
|
||||
result.decimals = 2;
|
||||
}
|
||||
else {
|
||||
result.step = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio / 255.0);
|
||||
result.min = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 255.0;
|
||||
result.max = model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio - (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 255.0;
|
||||
else
|
||||
result.decimals = 0;
|
||||
}
|
||||
result.step = ratio / 255;
|
||||
result.min = channel.offset * result.step;
|
||||
result.max = ratio + result.min;
|
||||
}
|
||||
break;
|
||||
case TELEMETRY_SOURCE_ALT:
|
||||
@@ -242,26 +239,34 @@ QString SwitchDn(const char sw)
|
||||
|
||||
QString RawSwitch::toString()
|
||||
{
|
||||
static const QString switches9X[] = { QObject::tr("THR"), QObject::tr("RUD"), QObject::tr("ELE"),
|
||||
QObject::tr("ID0"), QObject::tr("ID1"), QObject::tr("ID2"),
|
||||
QObject::tr("AIL"), QObject::tr("GEA"), QObject::tr("TRN")
|
||||
};
|
||||
static const QString switches9X[] = {
|
||||
QString("THR"), QString("RUD"), QString("ELE"),
|
||||
QString("ID0"), QString("ID1"), QString("ID2"),
|
||||
QString("AIL"), QString("GEA"), QString("TRN")
|
||||
};
|
||||
|
||||
static const QString switchesX9D[] = { SwitchUp('A'), QString::fromUtf8("SA-"), SwitchDn('A'),
|
||||
SwitchUp('B'), QString::fromUtf8("SB-"), SwitchDn('B'),
|
||||
SwitchUp('C'), QString::fromUtf8("SC-"), SwitchDn('C'),
|
||||
SwitchUp('D'), QString::fromUtf8("SD-"), SwitchDn('D'),
|
||||
SwitchUp('E'), QString::fromUtf8("SE-"), SwitchDn('E'),
|
||||
SwitchUp('F'), SwitchDn('F'),
|
||||
SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'),
|
||||
SwitchUp('H'), SwitchDn('H'),
|
||||
};
|
||||
static const QString switchesX9D[] = {
|
||||
SwitchUp('A'), QString::fromUtf8("SA-"), SwitchDn('A'),
|
||||
SwitchUp('B'), QString::fromUtf8("SB-"), SwitchDn('B'),
|
||||
SwitchUp('C'), QString::fromUtf8("SC-"), SwitchDn('C'),
|
||||
SwitchUp('D'), QString::fromUtf8("SD-"), SwitchDn('D'),
|
||||
SwitchUp('E'), QString::fromUtf8("SE-"), SwitchDn('E'),
|
||||
SwitchUp('F'), SwitchDn('F'),
|
||||
SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'),
|
||||
SwitchUp('H'), SwitchDn('H'),
|
||||
};
|
||||
|
||||
static const QString virtualSwitches[] = { QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
|
||||
QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
|
||||
QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
|
||||
QObject::tr("LSV"), QObject::tr("LSW")
|
||||
};
|
||||
static const QString virtualSwitches[] = {
|
||||
QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
|
||||
QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
|
||||
QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
|
||||
QObject::tr("LSV"), QObject::tr("LSW")
|
||||
};
|
||||
|
||||
static const QString multiposPots[] = {
|
||||
QObject::tr("S11"), QObject::tr("S12"), QObject::tr("S13"), QObject::tr("S14"), QObject::tr("S15"), QObject::tr("S16"),
|
||||
QObject::tr("S21"), QObject::tr("S22"), QObject::tr("S23"), QObject::tr("S24"), QObject::tr("S25"), QObject::tr("S26")
|
||||
};
|
||||
|
||||
switch(type) {
|
||||
case SWITCH_TYPE_SWITCH:
|
||||
@@ -271,6 +276,8 @@ QString RawSwitch::toString()
|
||||
return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1) : QString("!") + CHECK_IN_ARRAY(switches9X, -index-1);
|
||||
case SWITCH_TYPE_VIRTUAL:
|
||||
return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1) : QString("!") + CHECK_IN_ARRAY(virtualSwitches, -index-1);
|
||||
case SWITCH_TYPE_MULTIPOS_POT:
|
||||
return CHECK_IN_ARRAY(multiposPots, index);
|
||||
case SWITCH_TYPE_ON:
|
||||
return QObject::tr("ON");
|
||||
case SWITCH_TYPE_ONM:
|
||||
|
||||
@@ -296,7 +296,7 @@ class RawSourceRange
|
||||
}
|
||||
|
||||
float getValue(int value) {
|
||||
return round(float(value) * step);
|
||||
return min + float(value) * step;
|
||||
}
|
||||
|
||||
int decimals;
|
||||
@@ -356,6 +356,7 @@ enum RawSwitchType {
|
||||
SWITCH_TYPE_NONE,
|
||||
SWITCH_TYPE_SWITCH,
|
||||
SWITCH_TYPE_VIRTUAL,
|
||||
SWITCH_TYPE_MULTIPOS_POT,
|
||||
SWITCH_TYPE_MOMENT_SWITCH,
|
||||
SWITCH_TYPE_MOMENT_VIRTUAL,
|
||||
SWITCH_TYPE_ON,
|
||||
@@ -503,6 +504,7 @@ class GeneralSettings {
|
||||
unsigned int mavbaud;
|
||||
unsigned int switchUnlockStates;
|
||||
unsigned int hw_uartMode;
|
||||
unsigned int potsType[8];
|
||||
};
|
||||
|
||||
class CurveReference {
|
||||
@@ -737,6 +739,14 @@ class FrSkyChannelData {
|
||||
unsigned int multiplier;
|
||||
FrSkyAlarmData alarms[2];
|
||||
|
||||
float getRatio() const
|
||||
{
|
||||
if (type==0 || type==1 || type==2)
|
||||
return float(ratio << multiplier) / 10.0;
|
||||
else
|
||||
return ratio << multiplier;
|
||||
}
|
||||
|
||||
void clear() { memset(this, 0, sizeof(FrSkyChannelData)); }
|
||||
};
|
||||
|
||||
@@ -1007,8 +1017,8 @@ enum Capability {
|
||||
GvarsHaveSources,
|
||||
GvarsName,
|
||||
NoTelemetryProtocol,
|
||||
TelemetryCSFields,
|
||||
TelemetryColsCSFields,
|
||||
TelemetryCustomScreens,
|
||||
TelemetryCustomScreensFieldsPerLine,
|
||||
TelemetryRSSIModel,
|
||||
TelemetryAlarm,
|
||||
TelemetryInternalAlarm,
|
||||
@@ -1044,7 +1054,9 @@ enum Capability {
|
||||
EnhancedCurves,
|
||||
TelemetryInternalAlarms,
|
||||
HasFasOffset,
|
||||
HasMahPersistent
|
||||
HasMahPersistent,
|
||||
MultiposPots,
|
||||
MultiposPotsPositions
|
||||
};
|
||||
|
||||
enum UseContext {
|
||||
|
||||
@@ -56,21 +56,29 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++);
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
for (int i=0; i<2; i++) {
|
||||
for (int j=0; j<6; j++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*6+j), val++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||
|
||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
||||
int s = switchIndex(i, board, version);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, -s), -val);
|
||||
// addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, -s), -val);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, s), val++);
|
||||
}
|
||||
|
||||
for (int i=1; i<=MAX_CUSTOM_SWITCHES(board, version); i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, -i), -val);
|
||||
// addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, -i), -val);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, i), val++);
|
||||
}
|
||||
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONM, 1 ), -val);
|
||||
// addConversion(RawSwitch(SWITCH_TYPE_ONM, 1 ), -val);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONM, 0 ), val++);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_TRN, 0), val++);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_TRN, 1), val++);
|
||||
@@ -2011,12 +2019,21 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
|
||||
if (version >= 213 || (!IS_ARM(board) && version >= 212))
|
||||
internalField.Append(new UnsignedField<16>(generalData.variant));
|
||||
|
||||
for (int i=0; i<inputsCount; i++)
|
||||
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
|
||||
for (int i=0; i<inputsCount; i++)
|
||||
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
|
||||
for (int i=0; i<inputsCount; i++)
|
||||
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
|
||||
if (version >= 216) {
|
||||
for (int i=0; i<inputsCount; i++) {
|
||||
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
|
||||
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
|
||||
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<inputsCount; i++)
|
||||
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
|
||||
for (int i=0; i<inputsCount; i++)
|
||||
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
|
||||
for (int i=0; i<inputsCount; i++)
|
||||
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
|
||||
}
|
||||
|
||||
internalField.Append(new UnsignedField<16>(chkSum));
|
||||
internalField.Append(new UnsignedField<8>(generalData.currModel));
|
||||
@@ -2110,8 +2127,11 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
|
||||
internalField.Append(new SignedField<8>(generalData.varioVolume));
|
||||
internalField.Append(new SignedField<8>(generalData.backgroundVolume));
|
||||
}
|
||||
if (version >= 216) {
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
|
||||
for (int i=0; i<8; i++) {
|
||||
internalField.Append(new UnsignedField<1>(generalData.potsType[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,24 +610,12 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
|
||||
case TelemetryBars:
|
||||
return 1;
|
||||
case TelemetryCSFields:
|
||||
if (IS_TARANIS(board)) {
|
||||
return 36;
|
||||
} else {
|
||||
return IS_ARM(board) ? 24 : 16;
|
||||
}
|
||||
case TelemetryColsCSFields:
|
||||
if (IS_TARANIS(board)) {
|
||||
return 3;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
case TelemetryCustomScreens:
|
||||
return IS_TARANIS(board) ? 3 : 2;
|
||||
case TelemetryCustomScreensFieldsPerLine:
|
||||
return IS_TARANIS(board) ? 3 : 2;
|
||||
case NoTelemetryProtocol:
|
||||
if (IS_TARANIS(board)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return IS_TARANIS(board) ? 1 : 0;
|
||||
case TelemetryUnits:
|
||||
return 0;
|
||||
case TelemetryBlades:
|
||||
@@ -694,6 +682,10 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return (IS_STOCK(board) ? false : true);
|
||||
case HasMahPersistent:
|
||||
return (IS_ARM(board) ? true : false);
|
||||
case MultiposPots:
|
||||
return IS_TARANIS(board) ? 2 : 0;
|
||||
case MultiposPotsPositions:
|
||||
return IS_TARANIS(board) ? 6 : 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
||||
}
|
||||
this->layout()->removeItem(ui->TaranisReadOnlyUnlock);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (int i=0; pmsl[i]; i++) {
|
||||
pmsl[i]->hide();
|
||||
}
|
||||
@@ -373,6 +374,18 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
||||
for (int i=0; tpmsld[i]; i++) {
|
||||
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(MultiposPots)) {
|
||||
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
|
||||
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
|
||||
}
|
||||
else {
|
||||
ui->potsTypeSeparator->hide();
|
||||
ui->pot1Type->hide();
|
||||
ui->pot1TypeLabel->hide();
|
||||
ui->pot2Type->hide();
|
||||
ui->pot2TypeLabel->hide();
|
||||
}
|
||||
}
|
||||
|
||||
GeneralEdit::~GeneralEdit()
|
||||
@@ -380,6 +393,18 @@ GeneralEdit::~GeneralEdit()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void GeneralEdit::on_pot1Type_currentIndexChanged(int index)
|
||||
{
|
||||
g_eeGeneral.potsType[0] = index;
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
|
||||
{
|
||||
g_eeGeneral.potsType[1] = index;
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
void GeneralEdit::unlockSwitchEdited()
|
||||
{
|
||||
int i=0;
|
||||
|
||||
@@ -119,6 +119,9 @@ private slots:
|
||||
void on_varioVolume_SL_valueChanged();
|
||||
void on_wavVolume_SL_valueChanged();
|
||||
|
||||
void on_pot1Type_currentIndexChanged(int index);
|
||||
void on_pot2Type_currentIndexChanged(int index);
|
||||
|
||||
void on_stickmodeCB_currentIndexChanged(int index);
|
||||
void on_channelorderCB_currentIndexChanged(int index);
|
||||
void on_beeperCB_currentIndexChanged(int index);
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
These will be relevant for all models in the same EEPROM.</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabSetup">
|
||||
<attribute name="title">
|
||||
@@ -3494,6 +3494,91 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="4">
|
||||
<widget class="Line" name="potsTypeSeparator">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="pot1Type">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Beeper volume
|
||||
|
||||
0 - Quiet. No beeps at all.
|
||||
1 - No Keys. Normal beeps but menu keys do not beep.
|
||||
2 - Normal.
|
||||
3 - Loud.
|
||||
4 - Extra loud.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="pot1TypeLabel">
|
||||
<property name="text">
|
||||
<string>S1 Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="pot2Type">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Beeper volume
|
||||
|
||||
0 - Quiet. No beeps at all.
|
||||
1 - No Keys. Normal beeps but menu keys do not beep.
|
||||
2 - Normal.
|
||||
3 - Loud.
|
||||
4 - Extra loud.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="pot2TypeLabel">
|
||||
<property name="text">
|
||||
<string>S2 Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -842,6 +842,8 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO check ... I removed negative toggle switches in the FW, no?
|
||||
if (attr & POPULATE_MSWITCHES) {
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
item = RawSwitch(SWITCH_TYPE_ONM, 1);
|
||||
@@ -860,6 +862,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
item = RawSwitch(SWITCH_TYPE_OFF);
|
||||
@@ -905,6 +908,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
item = RawSwitch(SWITCH_TYPE_ON);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
@@ -1086,7 +1097,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
} else if (flags & POPULATE_TELEMETRY) {
|
||||
}
|
||||
else if (flags & POPULATE_TELEMETRY) {
|
||||
for (int i=0; i<TELEMETRY_SOURCES_COUNT; i++) {
|
||||
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
for file in $(ls *png)
|
||||
do
|
||||
convert $file \( +clone \
|
||||
-channel A -morphology EdgeOut Diamond +channel \
|
||||
+level-colors black \
|
||||
\) -compose DstOver -composite $file
|
||||
done
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ set(modeledit_UIS
|
||||
setup_module.ui
|
||||
flightmode.ui
|
||||
telemetry_analog.ui
|
||||
telemetry_customscreen.ui
|
||||
)
|
||||
|
||||
foreach(name ${modeledit_NAMES})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "telemetry.h"
|
||||
#include "ui_telemetry.h"
|
||||
#include "ui_telemetry_analog.h"
|
||||
#include "ui_telemetry_customscreen.h"
|
||||
#include "helpers.h"
|
||||
|
||||
TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
|
||||
@@ -11,15 +12,13 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
float ratio;
|
||||
float ratio = analog.getRatio();
|
||||
|
||||
if (analog.type==0 || analog.type==1 || analog.type==2) {
|
||||
ratio = (analog.ratio<<analog.multiplier)/10.0;
|
||||
ui->RatioSB->setDecimals(1);
|
||||
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
|
||||
}
|
||||
else {
|
||||
ratio = analog.ratio<<analog.multiplier;
|
||||
ui->RatioSB->setDecimals(0);
|
||||
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
|
||||
}
|
||||
@@ -44,69 +43,44 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
|
||||
|
||||
void TelemetryAnalog::update()
|
||||
{
|
||||
float ratio, alarm1value, alarm2value;
|
||||
if (analog.ratio==0) {
|
||||
ui->alarm1ValueSB->setMinimum(0);
|
||||
ui->alarm1ValueSB->setMaximum(0);
|
||||
ui->alarm2ValueSB->setMinimum(0);
|
||||
ui->alarm2ValueSB->setMaximum(0);
|
||||
ui->CalibSB->setMinimum(0);
|
||||
ui->CalibSB->setMaximum(0);
|
||||
ui->CalibSB->setValue(0);
|
||||
ui->alarm1ValueSB->setValue(0);
|
||||
ui->alarm2ValueSB->setValue(0);
|
||||
return;
|
||||
}
|
||||
float ratio = analog.getRatio();
|
||||
float step = ratio / 255;
|
||||
float mini = (ratio * analog.offset) / 255;
|
||||
float maxi = mini + ratio;
|
||||
|
||||
if (analog.type==0 || analog.type==1 || analog.type==2) {
|
||||
ratio=(analog.ratio<<analog.multiplier)/10.0;
|
||||
ui->alarm1ValueSB->setDecimals(2);
|
||||
ui->alarm1ValueSB->setSingleStep(ratio/255.0);
|
||||
ui->alarm2ValueSB->setDecimals(2);
|
||||
ui->alarm2ValueSB->setSingleStep(ratio/255.0);
|
||||
ui->alarm1ValueSB->setMinimum((analog.ratio*1.0*analog.offset)/2550.0);
|
||||
ui->alarm1ValueSB->setMaximum(ratio+(analog.ratio*1.0*analog.offset)/2550.0);
|
||||
ui->alarm2ValueSB->setMinimum((analog.offset*1.0*analog.ratio)/2550.0);
|
||||
ui->alarm2ValueSB->setMaximum(ratio+(analog.offset*1.0*analog.ratio)/2550.0);
|
||||
}
|
||||
else {
|
||||
ratio=analog.ratio<<analog.multiplier;
|
||||
ui->alarm1ValueSB->setDecimals(2);
|
||||
ui->alarm1ValueSB->setSingleStep(ratio/255.0);
|
||||
ui->alarm2ValueSB->setDecimals(2);
|
||||
ui->alarm2ValueSB->setSingleStep(ratio/255.0);
|
||||
ui->alarm1ValueSB->setMinimum((analog.offset*1.0*analog.ratio)/255.0);
|
||||
ui->alarm1ValueSB->setMaximum(ratio+(analog.offset*1.0*analog.ratio)/255.0);
|
||||
ui->alarm2ValueSB->setMinimum((analog.offset*1.0*analog.ratio)/255.0);
|
||||
ui->alarm2ValueSB->setMaximum(ratio+(analog.offset*1.0*analog.ratio)/255.0);
|
||||
}
|
||||
ui->CalibSB->setDecimals(2);
|
||||
ui->CalibSB->setMaximum((ratio*127)/255.0);
|
||||
ui->CalibSB->setMinimum((-ratio*128)/255.0);
|
||||
ui->CalibSB->setSingleStep(ratio/255.0);
|
||||
ui->CalibSB->setValue((analog.offset*ratio)/255);
|
||||
alarm1value=ratio*(analog.alarms[0].value/255.0+analog.offset/255.0);
|
||||
alarm2value=ratio*(analog.alarms[1].value/255.0+analog.offset/255.0);;
|
||||
ui->alarm1ValueSB->setValue(alarm1value);
|
||||
ui->alarm2ValueSB->setValue(alarm2value);
|
||||
ui->alarm1ValueSB->setDecimals(2);
|
||||
ui->alarm1ValueSB->setSingleStep(step);
|
||||
ui->alarm1ValueSB->setMinimum(mini);
|
||||
ui->alarm1ValueSB->setMaximum(maxi);
|
||||
ui->alarm1ValueSB->setValue(mini + step*analog.alarms[0].value);
|
||||
|
||||
ui->alarm2ValueSB->setDecimals(2);
|
||||
ui->alarm2ValueSB->setSingleStep(step);
|
||||
ui->alarm2ValueSB->setMinimum(mini);
|
||||
ui->alarm2ValueSB->setMaximum(maxi);
|
||||
ui->alarm2ValueSB->setValue(mini + step*analog.alarms[1].value);
|
||||
|
||||
ui->CalibSB->setDecimals(2);
|
||||
ui->CalibSB->setMaximum(step*127);
|
||||
ui->CalibSB->setMinimum(-step*128);
|
||||
ui->CalibSB->setSingleStep(step);
|
||||
ui->CalibSB->setValue(mini);
|
||||
}
|
||||
|
||||
void TelemetryAnalog::on_UnitCB_currentIndexChanged(int index)
|
||||
{
|
||||
float ratio;
|
||||
analog.type=index;
|
||||
float ratio = analog.getRatio();
|
||||
analog.type = index;
|
||||
switch (index) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
ui->RatioSB->setDecimals(1);
|
||||
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
|
||||
ratio=(analog.ratio<<analog.multiplier)/10.0;
|
||||
break;
|
||||
default:
|
||||
ui->RatioSB->setDecimals(0);
|
||||
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
|
||||
ratio=(analog.ratio<<analog.multiplier);
|
||||
break;
|
||||
}
|
||||
ui->RatioSB->setValue(ratio);
|
||||
@@ -127,7 +101,7 @@ void TelemetryAnalog::on_RatioSB_valueChanged()
|
||||
}
|
||||
else {
|
||||
analog.multiplier = findmult(ui->RatioSB->value(), 255);
|
||||
float singlestep =(1<<analog.multiplier);
|
||||
float singlestep = (1<<analog.multiplier);
|
||||
lock = true;
|
||||
ui->RatioSB->setSingleStep(singlestep);
|
||||
ui->RatioSB->setValue(round(ui->RatioSB->value()/singlestep)*singlestep);
|
||||
@@ -139,15 +113,17 @@ void TelemetryAnalog::on_RatioSB_valueChanged()
|
||||
|
||||
void TelemetryAnalog::on_RatioSB_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
float ratio, calib, alarm1value,alarm2value;
|
||||
if (lock) return;
|
||||
|
||||
if (analog.type==0 || analog.type==1 || analog.type==2) {
|
||||
analog.multiplier = findmult(ui->RatioSB->value(), 25.5);
|
||||
ui->CalibSB->setSingleStep((1<<analog.multiplier)/10.0);
|
||||
ui->alarm1ValueSB->setSingleStep((1<<analog.multiplier)/10.0);
|
||||
ui->alarm2ValueSB->setSingleStep((1<<analog.multiplier)/10.0);
|
||||
analog.ratio = ((int)(round(ui->RatioSB->value()*10))/(1 <<analog.multiplier));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
analog.multiplier = findmult(ui->RatioSB->value(), 255);
|
||||
ui->CalibSB->setSingleStep(1<<analog.multiplier);
|
||||
ui->alarm1ValueSB->setSingleStep(1<<analog.multiplier);
|
||||
@@ -171,7 +147,8 @@ void TelemetryAnalog::on_RatioSB_editingFinished()
|
||||
if (calib>0) {
|
||||
if (calib>((ratio*127)/255)) {
|
||||
analog.offset=127;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
analog.offset=round(calib*255/ratio);
|
||||
}
|
||||
}
|
||||
@@ -185,18 +162,15 @@ void TelemetryAnalog::on_RatioSB_editingFinished()
|
||||
analog.alarms[0].value=round((alarm1value*255-analog.offset*(analog.ratio<<analog.multiplier))/(analog.ratio<<analog.multiplier));
|
||||
analog.alarms[1].value=round((alarm2value*255-analog.offset*(analog.ratio<<analog.multiplier))/(analog.ratio<<analog.multiplier));
|
||||
update();
|
||||
// TODO ? telBarUpdate();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryAnalog::on_CalibSB_editingFinished()
|
||||
{
|
||||
float ratio,calib,alarm1value,alarm2value;
|
||||
if (analog.type==0 || analog.type==1 || analog.type==2) {
|
||||
ratio=(analog.ratio<<analog.multiplier)/10.0;
|
||||
} else {
|
||||
ratio=analog.ratio<<analog.multiplier;
|
||||
}
|
||||
float ratio = analog.getRatio();
|
||||
float calib,alarm1value,alarm2value;
|
||||
|
||||
if (ratio!=0) {
|
||||
analog.offset = round((255*ui->CalibSB->value()/ratio));
|
||||
calib=ratio*analog.offset/255.0;
|
||||
@@ -204,7 +178,8 @@ void TelemetryAnalog::on_CalibSB_editingFinished()
|
||||
alarm2value=ui->alarm2ValueSB->value();
|
||||
if (alarm1value<calib) {
|
||||
alarm1value=calib;
|
||||
} else if (alarm1value>(ratio+calib)) {
|
||||
}
|
||||
else if (alarm1value>(ratio+calib)) {
|
||||
alarm1value=ratio+calib;
|
||||
}
|
||||
if (alarm2value<calib) {
|
||||
@@ -220,37 +195,37 @@ void TelemetryAnalog::on_CalibSB_editingFinished()
|
||||
analog.alarms[1].value=0;
|
||||
}
|
||||
update();
|
||||
// TODO ? telBarUpdate();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryAnalog::on_alarm1LevelCB_currentIndexChanged(int index)
|
||||
{
|
||||
analog.alarms[0].level = index;
|
||||
emit modified();
|
||||
analog.alarms[0].level = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
void TelemetryAnalog::on_alarm1GreaterCB_currentIndexChanged(int index)
|
||||
{
|
||||
analog.alarms[0].greater = index;
|
||||
emit modified();
|
||||
analog.alarms[0].greater = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryAnalog::on_alarm1ValueSB_editingFinished()
|
||||
{
|
||||
float ratio, calib, alarm1value;
|
||||
ratio=analog.ratio<<analog.multiplier;
|
||||
float ratio = analog.getRatio();
|
||||
float calib, alarm1value;
|
||||
|
||||
calib=analog.offset;
|
||||
alarm1value=ui->alarm1ValueSB->value();
|
||||
if (analog.type==0) {
|
||||
ratio/=10;
|
||||
}
|
||||
|
||||
if (alarm1value<((calib*ratio)/255)) {
|
||||
analog.alarms[0].value=0;
|
||||
} else if (alarm1value>(ratio+(calib*ratio)/255)) {
|
||||
}
|
||||
else if (alarm1value>(ratio+(calib*ratio)/255)) {
|
||||
analog.alarms[0].value=255;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
analog.alarms[0].value = round((alarm1value-((calib*ratio)/255))/ratio*255);
|
||||
}
|
||||
update();
|
||||
@@ -259,28 +234,26 @@ void TelemetryAnalog::on_alarm1ValueSB_editingFinished()
|
||||
|
||||
void TelemetryAnalog::on_alarm2LevelCB_currentIndexChanged(int index)
|
||||
{
|
||||
analog.alarms[1].level = index;
|
||||
emit modified();
|
||||
analog.alarms[1].level = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryAnalog::on_alarm2GreaterCB_currentIndexChanged(int index)
|
||||
{
|
||||
analog.alarms[1].greater = index;
|
||||
emit modified();
|
||||
analog.alarms[1].greater = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryAnalog::on_alarm2ValueSB_editingFinished()
|
||||
{
|
||||
float ratio, calib, alarm2value;
|
||||
ratio = analog.ratio<<analog.multiplier;
|
||||
float calib, alarm2value;
|
||||
float ratio = analog.getRatio();
|
||||
calib = analog.offset;
|
||||
alarm2value = ui->alarm2ValueSB->value();
|
||||
if (analog.type==0) {
|
||||
ratio/=10;
|
||||
}
|
||||
if (alarm2value<((calib*ratio)/255)) {
|
||||
analog.alarms[1].value=0;
|
||||
} else if (alarm2value>(ratio+(calib*ratio)/255)) {
|
||||
}
|
||||
else if (alarm2value>(ratio+(calib*ratio)/255)) {
|
||||
analog.alarms[1].value=255;
|
||||
} else {
|
||||
analog.alarms[1].value = round((alarm2value-((calib*ratio)/255))/ratio*255);
|
||||
@@ -296,41 +269,182 @@ TelemetryAnalog::~TelemetryAnalog()
|
||||
|
||||
/******************************************************/
|
||||
|
||||
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen):
|
||||
ModelPanel(parent, model),
|
||||
ui(new Ui::TelemetryCustomScreen),
|
||||
screen(screen)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
for (int l=0; l<4; l++) {
|
||||
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
|
||||
fieldsCB[l][c] = new QComboBox(this);
|
||||
fieldsCB[l][c]->setProperty("index", c + (l<<8));
|
||||
populateCustomScreenFieldCB(fieldsCB[l][c], screen.body.lines[l].source[c], (l<4), model.frsky.usrProto);
|
||||
ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
|
||||
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
|
||||
}
|
||||
}
|
||||
|
||||
for (int l=0; l<4; l++) {
|
||||
barsCB[l] = new QComboBox(this);
|
||||
barsCB[l]->setProperty("index", l);
|
||||
populateCustomScreenFieldCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
|
||||
connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
|
||||
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
|
||||
|
||||
minSB[l] = new QDoubleSpinBox(this);
|
||||
minSB[l]->setProperty("index", l);
|
||||
connect(minSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMinChanged(double)));
|
||||
ui->screenBarsLayout->addWidget(minSB[l], l, 1, 1, 1);
|
||||
|
||||
QLabel * label = new QLabel(this);
|
||||
label->setAutoFillBackground(false);
|
||||
label->setStyleSheet(QString::fromUtf8("Background:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 128, 255), stop:0.339795 rgba(0, 0, 128, 255), stop:0.339799 rgba(255, 255, 255, 255), stop:0.662444 rgba(255, 255, 255, 255),)\n"""));
|
||||
label->setFrameShape(QFrame::Panel);
|
||||
label->setFrameShadow(QFrame::Raised);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
ui->screenBarsLayout->addWidget(label, l, 2, 1, 1);
|
||||
|
||||
maxSB[l] = new QDoubleSpinBox(this);
|
||||
maxSB[l]->setProperty("index", l);
|
||||
connect(maxSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMaxChanged(double)));
|
||||
ui->screenBarsLayout->addWidget(maxSB[l], l, 3, 1, 1);
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
TelemetryCustomScreen::~TelemetryCustomScreen()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::update()
|
||||
{
|
||||
lock = true;
|
||||
|
||||
ui->screenType->setCurrentIndex(screen.type);
|
||||
ui->screenNums->setVisible(screen.type == 0);
|
||||
ui->screenBars->setVisible(screen.type != 0);
|
||||
|
||||
if (screen.type == 0) {
|
||||
for (int l=0; l<4; l++) {
|
||||
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
|
||||
fieldsCB[l][c]->setCurrentIndex(screen.body.lines[l].source[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<4; i++) {
|
||||
updateBar(i);
|
||||
}
|
||||
}
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::updateBar(int line)
|
||||
{
|
||||
int index = screen.body.bars[line].source;
|
||||
barsCB[line]->setCurrentIndex(index);
|
||||
if (index) {
|
||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
|
||||
RawSourceRange range = source.getRange(true);
|
||||
int max = round((range.max - range.min) / range.step);
|
||||
if (255-screen.body.bars[line].barMax > max)
|
||||
screen.body.bars[line].barMax = 255 - max;
|
||||
minSB[line]->setEnabled(true);
|
||||
minSB[line]->setDecimals(range.decimals);
|
||||
minSB[line]->setMinimum(range.min);
|
||||
minSB[line]->setMaximum(range.max);
|
||||
minSB[line]->setSingleStep(range.step);
|
||||
minSB[line]->setValue(range.getValue(screen.body.bars[line].barMin));
|
||||
maxSB[line]->setEnabled(true);
|
||||
maxSB[line]->setDecimals(range.decimals);
|
||||
maxSB[line]->setMinimum(range.min);
|
||||
maxSB[line]->setMaximum(range.max);
|
||||
maxSB[line]->setSingleStep(range.step);
|
||||
maxSB[line]->setValue(range.getValue(255 - screen.body.bars[line].barMax));
|
||||
}
|
||||
else {
|
||||
minSB[line]->setDisabled(true);
|
||||
maxSB[line]->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
memset(&screen.body, 0, sizeof(screen.body));
|
||||
screen.type = index;
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::customFieldChanged(int value)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
screen.body.lines[index/256].source[index%256] = value;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::barSourceChanged(int index)
|
||||
{
|
||||
QComboBox * cb = qobject_cast<QComboBox*>(sender());
|
||||
int line = cb->property("index").toInt();
|
||||
screen.body.bars[line].source = index;
|
||||
screen.body.bars[line].barMin = 0;
|
||||
screen.body.bars[line].barMax = 0;
|
||||
updateBar(line);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::barMinChanged(double value)
|
||||
{
|
||||
if (!lock) {
|
||||
int line = sender()->property("index").toInt();
|
||||
screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep());
|
||||
// TODO set min (maxSB)
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::barMaxChanged(double value)
|
||||
{
|
||||
if (!lock) {
|
||||
int line = sender()->property("index").toInt();
|
||||
screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep());
|
||||
// TODO set max (minSB)
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************/
|
||||
|
||||
TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model):
|
||||
ModelPanel(parent, model),
|
||||
ui(new Ui::Telemetry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
|
||||
model.frsky.usrProto = 1;
|
||||
}
|
||||
|
||||
analogs[0] = new TelemetryAnalog(this, model.frsky.channels[0]);
|
||||
ui->A1Layout->addWidget(analogs[0]);
|
||||
connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
||||
|
||||
analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1]);
|
||||
ui->A2Layout->addWidget(analogs[1]);
|
||||
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
||||
|
||||
QGroupBox* barsgb[3] = { ui->CS1Bars, ui->CS2Bars, ui->CS3Bars };
|
||||
QGroupBox* numsgb[3] = { ui->CS1Nums, ui->CS2Nums, ui->CS3Nums };
|
||||
|
||||
QComboBox* barscb[12] = { ui->telBarCS1B1_CB, ui->telBarCS1B2_CB, ui->telBarCS1B3_CB, ui->telBarCS1B4_CB,
|
||||
ui->telBarCS2B1_CB, ui->telBarCS2B2_CB, ui->telBarCS2B3_CB, ui->telBarCS2B4_CB,
|
||||
ui->telBarCS3B1_CB, ui->telBarCS3B2_CB, ui->telBarCS3B3_CB, ui->telBarCS3B4_CB};
|
||||
QDoubleSpinBox* minSB[12] = { ui->telMinCS1SB1, ui->telMinCS1SB2, ui->telMinCS1SB3, ui->telMinCS1SB4,
|
||||
ui->telMinCS2SB1, ui->telMinCS2SB2, ui->telMinCS2SB3, ui->telMinCS2SB4,
|
||||
ui->telMinCS3SB1, ui->telMinCS3SB2, ui->telMinCS3SB3, ui->telMinCS3SB4};
|
||||
QDoubleSpinBox* maxSB[12] = { ui->telMaxCS1SB1, ui->telMaxCS1SB2, ui->telMaxCS1SB3, ui->telMaxCS1SB4,
|
||||
ui->telMaxCS2SB1, ui->telMaxCS2SB2, ui->telMaxCS2SB3, ui->telMaxCS2SB4,
|
||||
ui->telMaxCS3SB1, ui->telMaxCS3SB2, ui->telMaxCS3SB3, ui->telMaxCS3SB4};
|
||||
QComboBox* tmp[36] = { ui->telemetryCS1F1_CB, ui->telemetryCS1F2_CB, ui->telemetryCS1F3_CB, ui->telemetryCS1F4_CB, ui->telemetryCS1F5_CB, ui->telemetryCS1F6_CB, ui->telemetryCS1F7_CB, ui->telemetryCS1F8_CB, ui->telemetryCS1F9_CB, ui->telemetryCS1F10_CB, ui->telemetryCS1F11_CB, ui->telemetryCS1F12_CB,
|
||||
ui->telemetryCS2F1_CB, ui->telemetryCS2F2_CB, ui->telemetryCS2F3_CB, ui->telemetryCS2F4_CB, ui->telemetryCS2F5_CB, ui->telemetryCS2F6_CB, ui->telemetryCS2F7_CB, ui->telemetryCS2F8_CB, ui->telemetryCS2F9_CB, ui->telemetryCS2F10_CB, ui->telemetryCS2F11_CB, ui->telemetryCS2F12_CB,
|
||||
ui->telemetryCS3F1_CB, ui->telemetryCS3F2_CB, ui->telemetryCS3F3_CB, ui->telemetryCS3F4_CB, ui->telemetryCS3F5_CB, ui->telemetryCS3F6_CB, ui->telemetryCS3F7_CB, ui->telemetryCS3F8_CB, ui->telemetryCS3F9_CB, ui->telemetryCS3F10_CB, ui->telemetryCS3F11_CB, ui->telemetryCS3F12_CB};
|
||||
|
||||
memcpy(barsGB, barsgb, sizeof(barsGB));
|
||||
memcpy(numsGB, numsgb, sizeof(numsGB));
|
||||
memcpy(barsCB, barscb, sizeof(barsCB));
|
||||
memcpy(this->maxSB, maxSB, sizeof(this->maxSB));
|
||||
memcpy(this->minSB, minSB, sizeof(this->minSB));
|
||||
memcpy(csf, tmp, sizeof(csf));
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCustomScreens); i++) {
|
||||
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i]);
|
||||
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
|
||||
}
|
||||
|
||||
setup();
|
||||
}
|
||||
@@ -346,19 +460,6 @@ void TelemetryPanel::setup()
|
||||
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
|
||||
|
||||
lock=true;
|
||||
ui->telemetryCSType1->setCurrentIndex(model.frsky.screens[0].type);
|
||||
ui->telemetryCSType2->setCurrentIndex(model.frsky.screens[1].type);
|
||||
ui->telemetryCSType3->setCurrentIndex(model.frsky.screens[2].type);
|
||||
|
||||
for (int i=0; i<3; i++) {
|
||||
bool isNum = (model.frsky.screens[i].type==0);
|
||||
barsGB[i]->setVisible(!isNum);
|
||||
numsGB[i]->setVisible(isNum);
|
||||
}
|
||||
|
||||
connect(ui->telemetryCSType1,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
|
||||
connect(ui->telemetryCSType2,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
|
||||
connect(ui->telemetryCSType3,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
|
||||
|
||||
//frsky Settings
|
||||
if (!GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
|
||||
@@ -397,7 +498,8 @@ void TelemetryPanel::setup()
|
||||
ui->VarioLabel_4->hide();
|
||||
ui->varioSourceCB->hide();
|
||||
ui->varioSource_label->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!GetEepromInterface()->getCapability(HasVarioSink)) {
|
||||
ui->varioLimitMinOff_ChkB->hide();
|
||||
ui->varioLimitMin_DSB->hide();
|
||||
@@ -431,44 +533,12 @@ void TelemetryPanel::setup()
|
||||
if (!(GetEepromInterface()->getCapability(HasAltitudeSel)||GetEepromInterface()->getCapability(HasVario))) {
|
||||
ui->altimetryGB->hide();
|
||||
}
|
||||
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
|
||||
model.frsky.usrProto=1;
|
||||
ui->frskyProtoCB->setDisabled(true);
|
||||
} else {
|
||||
ui->frskyProtoCB->setEnabled(true);
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(TelemetryCSFields)==0) {
|
||||
ui->groupBox_5->hide();
|
||||
} else {
|
||||
if (GetEepromInterface()->getCapability(TelemetryCSFields)==8) {
|
||||
ui->tabCsView->removeTab(1);
|
||||
ui->tabCsView->removeTab(2);
|
||||
}
|
||||
if (GetEepromInterface()->getCapability(TelemetryCSFields)==16) {
|
||||
ui->tabCsView->removeTab(2);
|
||||
}
|
||||
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
|
||||
if (cols==0) cols=2;
|
||||
for (int screen=0; screen<(GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols)); screen++) {
|
||||
for (int c=0; c<cols; c++) {
|
||||
for (int r=0; r<4; r++) {
|
||||
int index=screen*12+c*4+r;
|
||||
if (model.frsky.screens[screen].type==0) {
|
||||
populateCustomScreenFieldCB(csf[index], model.frsky.screens[screen].body.lines[r].source[c], (r<4), model.frsky.usrProto);
|
||||
} else {
|
||||
populateCustomScreenFieldCB(csf[index], 0, (r<4), model.frsky.usrProto);
|
||||
}
|
||||
connect(csf[index], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldEdited()));
|
||||
}
|
||||
}
|
||||
for (int c=cols; c<3; c++) {
|
||||
for (int r=0; r<4; r++) {
|
||||
int index=screen*12+c*4+r;
|
||||
csf[index]->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
|
||||
ui->frskyProtoCB->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
ui->frskyProtoCB->setEnabled(true);
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(TelemetryUnits)) {
|
||||
@@ -479,9 +549,11 @@ void TelemetryPanel::setup()
|
||||
}
|
||||
ui->frskyUnitsCB->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
if ((GetEepromInterface()->getCapability(Telemetry)&TM_HASWSHH)) {
|
||||
ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->frskyProtoCB->addItem(tr("Winged Shadow How High (not supported)"));
|
||||
}
|
||||
|
||||
@@ -517,40 +589,6 @@ void TelemetryPanel::setup()
|
||||
ui->frskyCurrentCB->setCurrentIndex(model.frsky.currentSource);
|
||||
ui->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource);
|
||||
|
||||
for (int screen=0; screen<2;screen++) {
|
||||
for (int rows=0; rows<4; rows++) {
|
||||
for (int cols=0; cols<3; cols++) {
|
||||
int index=screen*12+cols*4+rows;
|
||||
populateCustomScreenFieldCB(csf[index], model.frsky.screens[screen].body.lines[rows].source[cols], (rows<4), model.frsky.usrProto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int j=0; j<12; j++) {
|
||||
int screen = j/4;
|
||||
int field = j%4;
|
||||
populateCustomScreenFieldCB(barsCB[j], model.frsky.screens[screen].body.bars[field].source, false, model.frsky.usrProto);
|
||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, model.frsky.screens[screen].body.bars[field].source, &model);
|
||||
RawSourceRange range = source.getRange(true);
|
||||
minSB[j]->setDecimals(range.decimals);
|
||||
minSB[j]->setMinimum(range.min);
|
||||
minSB[j]->setMaximum(range.max);
|
||||
minSB[j]->setSingleStep(range.step);
|
||||
minSB[j]->setValue(range.getValue(model.frsky.screens[screen].body.bars[field].barMin));
|
||||
maxSB[j]->setDecimals(range.decimals);
|
||||
maxSB[j]->setMinimum(range.min);
|
||||
maxSB[j]->setMaximum(range.max);
|
||||
maxSB[j]->setSingleStep(range.step);
|
||||
maxSB[j]->setValue(range.getValue(255 - model.frsky.screens[screen].body.bars[field].barMax));
|
||||
if (model.frsky.screens[screen].body.bars[field].source==0 || model.frsky.screens[screen].type==0) {
|
||||
minSB[j]->setDisabled(true);
|
||||
maxSB[j]->setDisabled(true);
|
||||
}
|
||||
connect(barsCB[j], SIGNAL(currentIndexChanged(int)), this, SLOT(telBarCBcurrentIndexChanged(int)));
|
||||
connect(maxSB[j], SIGNAL(editingFinished()), this, SLOT(telMaxSBeditingFinished()));
|
||||
connect(minSB[j], SIGNAL(editingFinished()), this, SLOT(telMinSBeditingFinished()));
|
||||
}
|
||||
|
||||
lock=false;
|
||||
}
|
||||
|
||||
@@ -585,316 +623,119 @@ void TelemetryPanel::on_frskyVoltCB_currentIndexChanged(int index)
|
||||
|
||||
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
|
||||
{
|
||||
if (lock) return;
|
||||
int bindex[12];
|
||||
lock=true;
|
||||
for (int i=0; i<12; i++) {
|
||||
bindex[i]=barsCB[i]->currentIndex();
|
||||
model.frsky.usrProto=index;
|
||||
populateCustomScreenFieldCB(barsCB[i], bindex[i], false, model.frsky.usrProto);
|
||||
}
|
||||
if (!GetEepromInterface()->getCapability(TelemetryCSFields)) {
|
||||
ui->groupBox_5->hide();
|
||||
} else {
|
||||
for (int screen=0; screen<2;screen++) {
|
||||
for (int rows=0; rows<4; rows++) {
|
||||
for (int cols=0; cols<3; cols++) {
|
||||
int index=screen*12+cols*4+rows;
|
||||
populateCustomScreenFieldCB(csf[index], model.frsky.screens[screen].body.lines[rows].source[cols], (rows<4), model.frsky.usrProto);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lock=false;
|
||||
if (index==0) {
|
||||
for (int i=0; i<12; i++) {
|
||||
if (bindex[i]>2) {
|
||||
barsCB[i]->setCurrentIndex(0);
|
||||
} else {
|
||||
barsCB[i]->setCurrentIndex(bindex[i]);
|
||||
}
|
||||
}
|
||||
} else if (index==2) {
|
||||
for (int i=0; i<12; i++) {
|
||||
if (bindex[i]>3) {
|
||||
barsCB[i]->setCurrentIndex(0);
|
||||
} else {
|
||||
barsCB[i]->setCurrentIndex(bindex[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i=0; i<12; i++) {
|
||||
barsCB[i]->setCurrentIndex(bindex[i]);
|
||||
}
|
||||
}
|
||||
emit modified();
|
||||
model.frsky.usrProto = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm1CB_currentIndexChanged(int index) {
|
||||
if (lock) return;
|
||||
model.frsky.rssiAlarms[0].level=index;
|
||||
emit modified();
|
||||
void TelemetryPanel::on_rssiAlarm1CB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.rssiAlarms[0].level = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm2CB_currentIndexChanged(int index) {
|
||||
if (lock) return;
|
||||
model.frsky.rssiAlarms[1].level=index;
|
||||
emit modified();
|
||||
void TelemetryPanel::on_rssiAlarm2CB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.rssiAlarms[1].level = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm1SB_editingFinished()
|
||||
{
|
||||
if (lock) return;
|
||||
model.frsky.rssiAlarms[0].value=(ui->rssiAlarm1SB->value());
|
||||
emit modified();
|
||||
model.frsky.rssiAlarms[0].value = ui->rssiAlarm1SB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm2SB_editingFinished()
|
||||
{
|
||||
if (lock) return;
|
||||
model.frsky.rssiAlarms[1].value=(ui->rssiAlarm2SB->value());
|
||||
emit modified();
|
||||
model.frsky.rssiAlarms[1].value = ui->rssiAlarm2SB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_AltitudeGPS_ChkB_toggled(bool checked)
|
||||
{
|
||||
if (lock) return;
|
||||
model.frsky.FrSkyGpsAlt = checked;
|
||||
emit modified();
|
||||
model.frsky.FrSkyGpsAlt = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_AltitudeToolbar_ChkB_toggled(bool checked)
|
||||
{
|
||||
model.frsky.altitudeDisplayed = checked;
|
||||
emit modified();
|
||||
model.frsky.altitudeDisplayed = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioSourceCB_currentIndexChanged(int index)
|
||||
{
|
||||
if (lock) return;
|
||||
model.frsky.varioSource = index;
|
||||
emit modified();
|
||||
model.frsky.varioSource = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitMin_DSB_editingFinished()
|
||||
{
|
||||
if (lock) return;
|
||||
model.frsky.varioMin= round(ui->varioLimitMin_DSB->value()+10);
|
||||
emit modified();
|
||||
model.frsky.varioMin = round(ui->varioLimitMin_DSB->value()+10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitMax_DSB_editingFinished()
|
||||
{
|
||||
if (lock) return;
|
||||
model.frsky.varioMax= round(ui->varioLimitMax_DSB->value()-10);
|
||||
emit modified();
|
||||
model.frsky.varioMax = round(ui->varioLimitMax_DSB->value()-10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitCenterMin_DSB_editingFinished()
|
||||
{
|
||||
if (lock) return;
|
||||
if (!lock) {
|
||||
if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) {
|
||||
ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value());
|
||||
}
|
||||
model.frsky.varioCenterMin= round((ui->varioLimitCenterMin_DSB->value()+0.5)*10);
|
||||
model.frsky.varioCenterMin = round((ui->varioLimitCenterMin_DSB->value()+0.5)*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitMinOff_ChkB_toggled(bool checked)
|
||||
{
|
||||
if (lock) return;
|
||||
if (!lock) {
|
||||
model.frsky.varioCenterMin = -16;
|
||||
if (!checked) {
|
||||
lock=true;
|
||||
ui->varioLimitCenterMin_DSB->setValue(-2.0);
|
||||
ui->varioLimitCenterMin_DSB->setEnabled(true);
|
||||
lock=false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->varioLimitCenterMin_DSB->setValue(-2.0);
|
||||
ui->varioLimitCenterMin_DSB->setDisabled(true);
|
||||
}
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitCenterMax_DSB_editingFinished()
|
||||
{
|
||||
if (lock) return;
|
||||
if (!lock) {
|
||||
if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) {
|
||||
ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value());
|
||||
}
|
||||
model.frsky.varioCenterMax= round((ui->varioLimitCenterMax_DSB->value()-0.5)*10);
|
||||
model.frsky.varioCenterMax = round((ui->varioLimitCenterMax_DSB->value()-0.5)*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_fasOffset_DSB_editingFinished()
|
||||
{
|
||||
model.frsky.fasOffset = ui->fasOffset_DSB->value()*10;
|
||||
emit modified();
|
||||
model.frsky.fasOffset = ui->fasOffset_DSB->value() * 10;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_mahCount_SB_editingFinished()
|
||||
{
|
||||
model.frsky.storedMah = ui->mahCount_SB->value();
|
||||
emit modified();
|
||||
model.frsky.storedMah = ui->mahCount_SB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_mahCount_ChkB_toggled(bool checked)
|
||||
{
|
||||
model.frsky.mAhPersistent = checked;
|
||||
ui->mahCount_SB->setDisabled(!checked);
|
||||
emit modified();
|
||||
model.frsky.mAhPersistent = checked;
|
||||
ui->mahCount_SB->setDisabled(!checked);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::telBarUpdate()
|
||||
{
|
||||
int index;
|
||||
lock=true;
|
||||
for (int i=0; i<12; i++) {
|
||||
int screen=i/4;
|
||||
index=barsCB[i]->currentIndex();
|
||||
if (index==TELEMETRY_SOURCE_A1 || index==TELEMETRY_SOURCE_A1 || index==TELEMETRY_SOURCE_A1_MIN || index==TELEMETRY_SOURCE_A2_MIN) {
|
||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index, &model);
|
||||
RawSourceRange range = source.getRange(true);
|
||||
minSB[i]->setMinimum(range.min);
|
||||
minSB[i]->setMaximum(range.max);
|
||||
minSB[i]->setSingleStep(range.step);
|
||||
maxSB[i]->setMinimum(range.min);
|
||||
maxSB[i]->setMaximum(range.max);
|
||||
maxSB[i]->setSingleStep(range.step);
|
||||
minSB[i]->setValue(range.getValue(model.frsky.screens[screen].body.bars[i%4].barMin));
|
||||
maxSB[i]->setValue(range.getValue(255 - model.frsky.screens[screen].body.bars[i%4].barMax));
|
||||
}
|
||||
}
|
||||
lock=false;
|
||||
}
|
||||
|
||||
void TelemetryPanel::ScreenTypeCBcurrentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||
int screen = comboBox->objectName().right(1).toInt() -1;
|
||||
model.frsky.screens[screen].type = index;
|
||||
for (int i=0; i<3; i++) {
|
||||
bool isNum = (model.frsky.screens[i].type==0);
|
||||
barsGB[i]->setVisible(!isNum);
|
||||
numsGB[i]->setVisible(isNum);
|
||||
}
|
||||
lock = false;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::telBarCBcurrentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||
int screenId = comboBox->objectName().mid(8,1).toInt() - 1;
|
||||
int barId = comboBox->objectName().mid(10,1).toInt() - 1;
|
||||
int bar=barId+screenId*4;
|
||||
model.frsky.screens[screenId].body.bars[barId].source=index;
|
||||
if (index==0) {
|
||||
model.frsky.screens[screenId].body.bars[barId].barMin=0;
|
||||
model.frsky.screens[screenId].body.bars[barId].barMax=0;
|
||||
minSB[bar]->setDisabled(true);
|
||||
maxSB[bar]->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
minSB[bar]->setEnabled(true);
|
||||
maxSB[bar]->setEnabled(true);
|
||||
}
|
||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
|
||||
RawSourceRange range = source.getRange(true);
|
||||
minSB[bar]->setDecimals(range.decimals);
|
||||
minSB[bar]->setMinimum(range.min);
|
||||
minSB[bar]->setMaximum(range.max);
|
||||
minSB[bar]->setSingleStep(range.step);
|
||||
maxSB[bar]->setDecimals(range.decimals);
|
||||
maxSB[bar]->setMinimum(range.min);
|
||||
maxSB[bar]->setMaximum(range.max);
|
||||
maxSB[bar]->setSingleStep(range.step);
|
||||
minSB[bar]->setValue(range.getValue(model.frsky.screens[screenId].body.bars[barId].barMin));
|
||||
maxSB[bar]->setValue(range.getValue(255 - model.frsky.screens[screenId].body.bars[barId].barMax));
|
||||
lock = false;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::telMinSBeditingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int screenId = spinBox->objectName().mid(8,1).toInt() - 1;
|
||||
int barId = spinBox->objectName().right(1).toInt() - 1;
|
||||
int minId = barId+screenId*4;
|
||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, model.frsky.screens[screenId].body.bars[barId].source, &model);
|
||||
RawSourceRange range = source.getRange(true);
|
||||
if (model.frsky.screens[screenId].body.bars[barId].source==TELEMETRY_SOURCE_A1 || model.frsky.screens[screenId].body.bars[barId].source==TELEMETRY_SOURCE_A1_MIN) {
|
||||
model.frsky.screens[screenId].body.bars[barId].barMin = round((minSB[minId]->value()-analogs[0]->ui->CalibSB->value())/range.step);
|
||||
}
|
||||
else if (model.frsky.screens[screenId].body.bars[minId].source==TELEMETRY_SOURCE_A2 || model.frsky.screens[screenId].body.bars[minId].source==TELEMETRY_SOURCE_A2_MIN) {
|
||||
model.frsky.screens[screenId].body.bars[barId].barMin = round((minSB[minId]->value()-analogs[1]->ui->CalibSB->value())/range.step);
|
||||
}
|
||||
else {
|
||||
model.frsky.screens[screenId].body.bars[barId].barMin = round((minSB[minId]->value()-range.getValue(0))/range.step);
|
||||
}
|
||||
spinBox->setValue(range.getValue(model.frsky.screens[screenId].body.bars[barId].barMin));
|
||||
if (maxSB[minId]->value()<minSB[minId]->value()) {
|
||||
model.frsky.screens[screenId].body.bars[minId].barMax = (255-model.frsky.screens[screenId].body.bars[barId].barMin+1);
|
||||
maxSB[minId]->setValue(range.getValue(255 - model.frsky.screens[screenId].body.bars[barId].barMax));
|
||||
}
|
||||
maxSB[minId]->setMinimum(range.getValue((model.frsky.screens[screenId].body.bars[barId].barMin+1)));
|
||||
|
||||
lock = false;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::telMaxSBeditingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int screenId = spinBox->objectName().mid(8,1).toInt() - 1;
|
||||
int barId = spinBox->objectName().right(1).toInt() - 1;
|
||||
lock = true;
|
||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, model.frsky.screens[screenId].body.bars[barId].source, &model);
|
||||
RawSourceRange range = source.getRange(true);
|
||||
if (model.frsky.screens[screenId].body.bars[barId].source==5) {
|
||||
model.frsky.screens[screenId].body.bars[barId].barMax = (255-round((spinBox->value()-analogs[0]->ui->CalibSB->value())/range.step));
|
||||
}
|
||||
else if (model.frsky.screens[screenId].body.bars[barId].source==6) {
|
||||
model.frsky.screens[screenId].body.bars[barId].barMax = (255-round((spinBox->value()-analogs[1]->ui->CalibSB->value())/range.step));
|
||||
}
|
||||
else {
|
||||
model.frsky.screens[screenId].body.bars[barId].barMax = (255-round((spinBox->value()-range.getValue(0))/range.step));
|
||||
}
|
||||
spinBox->setValue(range.getValue(255-model.frsky.screens[screenId].body.bars[barId].barMax));
|
||||
lock = false;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::customFieldEdited()
|
||||
{
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
|
||||
int cols = GetEepromInterface()->getCapability(TelemetryColsCSFields);
|
||||
if (cols==0) cols=2;
|
||||
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCSFields); i++) {
|
||||
int screen=i/(4*cols);
|
||||
int r=((i%(4*cols))%4);
|
||||
int c=((i%(4*cols))/4);
|
||||
if (model.frsky.screens[screen].type==0) {
|
||||
model.frsky.screens[screen].body.lines[r].source[c]=csf[i]->currentIndex();
|
||||
}
|
||||
}
|
||||
|
||||
lock = false;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace Ui {
|
||||
class TelemetryAnalog;
|
||||
class TelemetryCustomScreen;
|
||||
class Telemetry;
|
||||
}
|
||||
|
||||
@@ -44,6 +45,32 @@ class TelemetryAnalog : public QWidget
|
||||
void update();
|
||||
};
|
||||
|
||||
class TelemetryCustomScreen : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen);
|
||||
~TelemetryCustomScreen();
|
||||
void update();
|
||||
|
||||
private slots:
|
||||
void on_screenType_currentIndexChanged(int index);
|
||||
void customFieldChanged(int index);
|
||||
void barSourceChanged(int index);
|
||||
void barMinChanged(double value);
|
||||
void barMaxChanged(double value);
|
||||
|
||||
private:
|
||||
void updateBar(int line);
|
||||
Ui::TelemetryCustomScreen * ui;
|
||||
FrSkyScreenData & screen;
|
||||
QComboBox * fieldsCB[4][3];
|
||||
QComboBox * barsCB[4];
|
||||
QDoubleSpinBox * minSB[4];
|
||||
QDoubleSpinBox * maxSB[4];
|
||||
};
|
||||
|
||||
class TelemetryPanel : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -77,21 +104,10 @@ class TelemetryPanel : public ModelPanel
|
||||
void on_fasOffset_DSB_editingFinished();
|
||||
void on_mahCount_SB_editingFinished();
|
||||
void on_mahCount_ChkB_toggled(bool checked);
|
||||
void telBarCBcurrentIndexChanged(int index);
|
||||
void ScreenTypeCBcurrentIndexChanged(int index);
|
||||
void telMaxSBeditingFinished();
|
||||
void telMinSBeditingFinished();
|
||||
void customFieldEdited();
|
||||
|
||||
private:
|
||||
Ui::Telemetry *ui;
|
||||
TelemetryAnalog * analogs[2];
|
||||
QGroupBox* barsGB[3];
|
||||
QGroupBox* numsGB[3];
|
||||
QComboBox* barsCB[12];
|
||||
QDoubleSpinBox* minSB[12];
|
||||
QDoubleSpinBox* maxSB[12];
|
||||
QComboBox* csf[36];
|
||||
|
||||
void setup();
|
||||
void telBarUpdate();
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TelemetryCustomScreen</class>
|
||||
<widget class="QWidget" name="TelemetryCustomScreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>650</width>
|
||||
<height>393</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="screenTypeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom Screen Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="screenType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Nums</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bars</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="screenNums">
|
||||
<layout class="QGridLayout" name="screenNumsLayout"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="screenBars">
|
||||
<layout class="QGridLayout" name="screenBarsLayout" columnstretch="1,0,1,0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_266">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_265">
|
||||
<property name="text">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_267">
|
||||
<property name="text">
|
||||
<string>Gauge</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_268">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -796,7 +796,7 @@ void printDialog::printFrSky()
|
||||
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("System of units")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>");
|
||||
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Propeller blades")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyBlades(fd->blades)+"</td></tr>");
|
||||
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
|
||||
|
||||
#if 0
|
||||
if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) {
|
||||
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
|
||||
if (cols==0) cols=2;
|
||||
@@ -840,6 +840,7 @@ void printDialog::printFrSky()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (tc>0)
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 156 B |
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 176 B |
|
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 393 B |
|
Before Width: | Height: | Size: 481 B After Width: | Height: | Size: 494 B |
|
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 212 B |
|
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 348 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 426 B |
|
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 175 B |
|
Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 181 B |
|
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 432 B After Width: | Height: | Size: 286 B |
|
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 181 B |
|
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 348 B |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 283 B |
|
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 346 B |
|
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 183 B |
|
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 195 B |
|
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 181 B |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 531 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 525 B |
|
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 471 B After Width: | Height: | Size: 571 B |
|
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 605 B |
|
Before Width: | Height: | Size: 398 B After Width: | Height: | Size: 557 B |
|
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 697 B |
|
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 506 B After Width: | Height: | Size: 613 B |
|
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 848 B |
|
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 679 B |
|
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 589 B |
|
Before Width: | Height: | Size: 559 B After Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 756 B |
|
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 623 B |
|
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 528 B |
|
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 477 B |
|
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 755 B |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 417 B After Width: | Height: | Size: 440 B |
|
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 724 B |
|
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 293 B After Width: | Height: | Size: 372 B |
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 899 B |
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 853 B |
|
Before Width: | Height: | Size: 723 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 771 B |
|
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 446 B |
|
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 594 B |
|
Before Width: | Height: | Size: 610 B After Width: | Height: | Size: 818 B |
|
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 901 B |
|
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 866 B |