Telemetry Volts and Current sources (RxBatt, A3, A4) now available in
Companion. QAutoComboBox introduced to simplify code
This commit is contained in:
@@ -9,6 +9,8 @@ class ModelPanel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class QUnsignedAutoComboBox;
|
||||
|
||||
public:
|
||||
ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
virtual ~ModelPanel();
|
||||
|
||||
@@ -655,10 +655,42 @@ void TelemetryPanel::setup()
|
||||
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
|
||||
ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial);
|
||||
ui->bladesCount->setValue(model.frsky.blades);
|
||||
ui->frskyCurrentCB->setCurrentIndex(model.frsky.currentSource);
|
||||
ui->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource);
|
||||
|
||||
lock=false;
|
||||
populateVoltsSource();
|
||||
populateCurrentSource();
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void TelemetryPanel::populateVoltsSource()
|
||||
{
|
||||
QUnsignedAutoComboBox * cb = ui->frskyVoltCB;
|
||||
cb->setField(&model.frsky.voltsSource, this);
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
cb->addItem(tr("RxBatt"), TELEMETRY_VOLTS_SOURCE_RXBATT);
|
||||
}
|
||||
cb->addItem(tr("A1"), TELEMETRY_VOLTS_SOURCE_A1);
|
||||
cb->addItem(tr("A2"), TELEMETRY_VOLTS_SOURCE_A2);
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
cb->addItem(tr("A3"), TELEMETRY_VOLTS_SOURCE_A3);
|
||||
cb->addItem(tr("A4"), TELEMETRY_VOLTS_SOURCE_A4);
|
||||
}
|
||||
cb->addItem(tr("FAS"), TELEMETRY_VOLTS_SOURCE_FAS);
|
||||
cb->addItem(tr("Cells"), TELEMETRY_VOLTS_SOURCE_CELLS);
|
||||
}
|
||||
|
||||
void TelemetryPanel::populateCurrentSource()
|
||||
{
|
||||
QUnsignedAutoComboBox * cb = ui->frskyCurrentCB;
|
||||
cb->setField(&model.frsky.currentSource, this);
|
||||
cb->addItem(tr("---"), TELEMETRY_CURRENT_SOURCE_NONE);
|
||||
cb->addItem(tr("A1"), TELEMETRY_CURRENT_SOURCE_A1);
|
||||
cb->addItem(tr("A2"), TELEMETRY_CURRENT_SOURCE_A2);
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
cb->addItem(tr("A3"), TELEMETRY_CURRENT_SOURCE_A3);
|
||||
cb->addItem(tr("A4"), TELEMETRY_CURRENT_SOURCE_A4);
|
||||
}
|
||||
cb->addItem(tr("FAS"), TELEMETRY_CURRENT_SOURCE_FAS);
|
||||
}
|
||||
|
||||
void TelemetryPanel::onAnalogModified()
|
||||
@@ -678,18 +710,6 @@ void TelemetryPanel::on_bladesCount_editingFinished()
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_frskyCurrentCB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.currentSource=index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_frskyVoltCB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.voltsSource=index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.usrProto = index;
|
||||
|
||||
@@ -82,16 +82,11 @@ class TelemetryPanel : public ModelPanel
|
||||
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
virtual ~TelemetryPanel();
|
||||
|
||||
signals:
|
||||
void modified();
|
||||
|
||||
private slots:
|
||||
void onAnalogModified();
|
||||
void on_frskyProtoCB_currentIndexChanged(int index);
|
||||
void on_frskyUnitsCB_currentIndexChanged(int index);
|
||||
void on_bladesCount_editingFinished();
|
||||
void on_frskyCurrentCB_currentIndexChanged(int index);
|
||||
void on_frskyVoltCB_currentIndexChanged(int index);
|
||||
void on_AltitudeToolbar_ChkB_toggled(bool checked);
|
||||
void on_rssiAlarm1CB_currentIndexChanged(int index);
|
||||
void on_rssiAlarm2CB_currentIndexChanged(int index);
|
||||
@@ -114,6 +109,8 @@ class TelemetryPanel : public ModelPanel
|
||||
|
||||
void setup();
|
||||
void telBarUpdate();
|
||||
void populateVoltsSource();
|
||||
void populateCurrentSource();
|
||||
};
|
||||
|
||||
#endif // TELEMETRY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>757</width>
|
||||
<width>840</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -249,33 +249,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="frskyCurrentCB">
|
||||
<widget class="QUnsignedAutoComboBox" name="frskyCurrentCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>NONE</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FAS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
@@ -299,33 +279,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="frskyVoltCB">
|
||||
<widget class="QUnsignedAutoComboBox" name="frskyVoltCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FAS</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CELS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@@ -1125,6 +1085,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QUnsignedAutoComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>qautocombobox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user