Closes #3505: add fuel quantity sensor in telemetry simulator (#3506) (ported from master)

* Closes #3507: raise max RPM in telemetry simulator to 2147483647 (0x7FFFFFFF)
This commit is contained in:
Damjan Adamic
2016-05-23 18:49:46 +02:00
parent 957bc11135
commit 06fce5108e
3 changed files with 112 additions and 54 deletions
+36 -26
View File
@@ -147,31 +147,32 @@ void TelemetrySimulator::closeEvent(QCloseEvent *event)
void TelemetrySimulator::showEvent(QShowEvent *event) void TelemetrySimulator::showEvent(QShowEvent *event)
{ {
SET_INSTANCE(rxbt_inst, BATT_ID, 0); SET_INSTANCE(rxbt_inst, BATT_ID, 0);
SET_INSTANCE(rssi_inst, RSSI_ID, 24); SET_INSTANCE(rssi_inst, RSSI_ID, 24);
SET_INSTANCE(swr_inst, SWR_ID, 24); SET_INSTANCE(swr_inst, SWR_ID, 24);
SET_INSTANCE(a1_inst, ADC1_ID, 0); SET_INSTANCE(a1_inst, ADC1_ID, 0);
SET_INSTANCE(a2_inst, ADC2_ID, 0); SET_INSTANCE(a2_inst, ADC2_ID, 0);
SET_INSTANCE(a3_inst, A3_FIRST_ID, 0); SET_INSTANCE(a3_inst, A3_FIRST_ID, 0);
SET_INSTANCE(a4_inst, A4_FIRST_ID, 0); SET_INSTANCE(a4_inst, A4_FIRST_ID, 0);
SET_INSTANCE(t1_inst, T1_FIRST_ID, 0); SET_INSTANCE(t1_inst, T1_FIRST_ID, 0);
SET_INSTANCE(t2_inst, T2_FIRST_ID, 0); SET_INSTANCE(t2_inst, T2_FIRST_ID, 0);
SET_INSTANCE(rpm_inst, RPM_FIRST_ID, DATA_ID_RPM); SET_INSTANCE(rpm_inst, RPM_FIRST_ID, DATA_ID_RPM);
SET_INSTANCE(fuel_inst, FUEL_FIRST_ID, 0); SET_INSTANCE(fuel_inst, FUEL_FIRST_ID, 0);
SET_INSTANCE(aspd_inst, AIR_SPEED_FIRST_ID, 0); SET_INSTANCE(fuel_qty_inst, FUEL_QTY_FIRST_ID, 0);
SET_INSTANCE(vvspd_inst, VARIO_FIRST_ID, DATA_ID_VARIO); SET_INSTANCE(aspd_inst, AIR_SPEED_FIRST_ID, 0);
SET_INSTANCE(valt_inst, ALT_FIRST_ID, DATA_ID_VARIO); SET_INSTANCE(vvspd_inst, VARIO_FIRST_ID, DATA_ID_VARIO);
SET_INSTANCE(fasv_inst, VFAS_FIRST_ID, DATA_ID_FAS); SET_INSTANCE(valt_inst, ALT_FIRST_ID, DATA_ID_VARIO);
SET_INSTANCE(fasc_inst, CURR_FIRST_ID, DATA_ID_FAS); SET_INSTANCE(fasv_inst, VFAS_FIRST_ID, DATA_ID_FAS);
SET_INSTANCE(cells_inst, CELLS_FIRST_ID, DATA_ID_FLVSS); SET_INSTANCE(fasc_inst, CURR_FIRST_ID, DATA_ID_FAS);
SET_INSTANCE(gpsa_inst, GPS_ALT_FIRST_ID, DATA_ID_GPS); SET_INSTANCE(cells_inst, CELLS_FIRST_ID, DATA_ID_FLVSS);
SET_INSTANCE(gpss_inst, GPS_SPEED_FIRST_ID, DATA_ID_GPS); SET_INSTANCE(gpsa_inst, GPS_ALT_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(gpsc_inst, GPS_COURS_FIRST_ID, DATA_ID_GPS); SET_INSTANCE(gpss_inst, GPS_SPEED_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(gpst_inst, GPS_TIME_DATE_FIRST_ID, DATA_ID_GPS); SET_INSTANCE(gpsc_inst, GPS_COURS_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(gpsll_inst, GPS_LONG_LATI_FIRST_ID, DATA_ID_GPS); SET_INSTANCE(gpst_inst, GPS_TIME_DATE_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(accx_inst, ACCX_FIRST_ID, 0); SET_INSTANCE(gpsll_inst, GPS_LONG_LATI_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(accy_inst, ACCY_FIRST_ID, 0); SET_INSTANCE(accx_inst, ACCX_FIRST_ID, 0);
SET_INSTANCE(accz_inst, ACCZ_FIRST_ID, 0); SET_INSTANCE(accy_inst, ACCY_FIRST_ID, 0);
SET_INSTANCE(accz_inst, ACCZ_FIRST_ID, 0);
ui->rxbt_ratio->setValue(simulator->getSensorRatio(BATT_ID) / 10.0); ui->rxbt_ratio->setValue(simulator->getSensorRatio(BATT_ID) / 10.0);
ui->A1_ratio->setValue(simulator->getSensorRatio(ADC1_ID) / 10.0); ui->A1_ratio->setValue(simulator->getSensorRatio(ADC1_ID) / 10.0);
@@ -283,7 +284,7 @@ void TelemetrySimulator::generateTelemetryFrame()
case 10: case 10:
if (ui->rpm->value() > 0) if (ui->rpm->value() > 0)
generateSportPacket(buffer, ui->rpm_inst->text().toInt(&ok, 0) - 1, DATA_FRAME, RPM_FIRST_ID, LIMIT<uint32_t>(0, ui->rpm->value(), 0xFFFF)); generateSportPacket(buffer, ui->rpm_inst->text().toInt(&ok, 0) - 1, DATA_FRAME, RPM_FIRST_ID, LIMIT<uint32_t>(0, ui->rpm->value(), 0x7FFFFFFF));
break; break;
case 11: case 11:
@@ -383,6 +384,11 @@ void TelemetrySimulator::generateTelemetryFrame()
generateSportPacket(buffer, ui->accz_inst->text().toInt(&ok, 0) - 1, DATA_FRAME, ACCZ_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accz->value() * 100.0, 0x7FFFFFFF)); generateSportPacket(buffer, ui->accz_inst->text().toInt(&ok, 0) - 1, DATA_FRAME, ACCZ_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accz->value() * 100.0, 0x7FFFFFFF));
break; break;
case 26:
if (ui->fuel_qty->value() > 0)
generateSportPacket(buffer, ui->fuel_qty_inst->text().toInt(&ok, 0) - 1, DATA_FRAME, FUEL_QTY_FIRST_ID, LIMIT<uint32_t>(0, ui->fuel_qty->value() * 100.0, 0xFFFFFF));
break;
default: default:
item = 0; item = 0;
return; return;
@@ -596,6 +602,7 @@ TelemetrySimulator::LogPlaybackController::LogPlaybackController(Ui::TelemetrySi
colToFuncMap.insert("Tmp2(@F)", T2_DEGF); colToFuncMap.insert("Tmp2(@F)", T2_DEGF);
colToFuncMap.insert("RPM(rpm)", RPM); colToFuncMap.insert("RPM(rpm)", RPM);
colToFuncMap.insert("Fuel(%)", FUEL); colToFuncMap.insert("Fuel(%)", FUEL);
colToFuncMap.insert("Fuel(ml)", FUEL_QTY);
colToFuncMap.insert("VSpd(m/s)", VSPD_MS); colToFuncMap.insert("VSpd(m/s)", VSPD_MS);
colToFuncMap.insert("VSpd(f/s)", VSPD_FS); colToFuncMap.insert("VSpd(f/s)", VSPD_FS);
colToFuncMap.insert("Alt(ft)", ALT_FEET); colToFuncMap.insert("Alt(ft)", ALT_FEET);
@@ -890,6 +897,9 @@ void TelemetrySimulator::LogPlaybackController::setUiDataValues()
case FUEL: case FUEL:
ui->fuel->setValue(columnData[info.dataIndex].toDouble()); ui->fuel->setValue(columnData[info.dataIndex].toDouble());
break; break;
case FUEL_QTY:
ui->fuel_qty->setValue(columnData[info.dataIndex].toDouble());
break;
case VSPD_MS: case VSPD_MS:
ui->vspeed->setValue(columnData[info.dataIndex].toDouble()); ui->vspeed->setValue(columnData[info.dataIndex].toDouble());
break; break;
+1
View File
@@ -80,6 +80,7 @@ class TelemetrySimulator : public QDialog
ACCX, ACCX,
ACCY, ACCY,
ACCZ, ACCZ,
FUEL_QTY,
}; };
QMap<QString, CONVERT_TYPE> colToFuncMap; // contains all 'known' column headings and how they are to be processed QMap<QString, CONVERT_TYPE> colToFuncMap; // contains all 'known' column headings and how they are to be processed
Ui::TelemetrySimulator * ui; Ui::TelemetrySimulator * ui;
+75 -28
View File
@@ -1360,7 +1360,7 @@ Timestamp</string>
</font> </font>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65535</number> <number>2147483647</number>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1520,23 +1520,20 @@ Timestamp</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0"> <item row="11" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_51">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
</font> </font>
</property> </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text"> <property name="text">
<string>VSpd</string> <string>Fuel Qty</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="1"> <item row="11" column="1">
<widget class="QLineEdit" name="vvspd_inst"> <widget class="QLineEdit" name="fuel_qty_inst">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
@@ -1545,35 +1542,26 @@ Timestamp</string>
</widget> </widget>
</item> </item>
<item row="11" column="2"> <item row="11" column="2">
<widget class="QDoubleSpinBox" name="vspeed"> <widget class="QSpinBox" name="fuel_qty">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
</font> </font>
</property> </property>
<property name="decimals">
<number>2</number>
</property>
<property name="minimum">
<double>-16777215.000000000000000</double>
</property>
<property name="maximum"> <property name="maximum">
<double>16777215.000000000000000</double> <double>100000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="3"> <item row="11" column="3">
<widget class="QLabel" name="label_48"> <widget class="QLabel" name="label_52">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>m/s</string> <string>ml</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1632,7 +1620,7 @@ Timestamp</string>
</widget> </widget>
</item> </item>
<item row="12" column="0"> <item row="12" column="0">
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="label_11">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
@@ -1642,12 +1630,12 @@ Timestamp</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Alt</string> <string>VSpd</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1"> <item row="12" column="1">
<widget class="QLineEdit" name="valt_inst"> <widget class="QLineEdit" name="vvspd_inst">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
@@ -1656,7 +1644,7 @@ Timestamp</string>
</widget> </widget>
</item> </item>
<item row="12" column="2"> <item row="12" column="2">
<widget class="QDoubleSpinBox" name="valt"> <widget class="QDoubleSpinBox" name="vspeed">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
@@ -1677,14 +1665,14 @@ Timestamp</string>
</widget> </widget>
</item> </item>
<item row="12" column="3"> <item row="12" column="3">
<widget class="QLabel" name="label_49"> <widget class="QLabel" name="label_48">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>8</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Meters</string> <string>m/s</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1742,7 +1730,64 @@ Timestamp</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="13" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Alt</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLineEdit" name="valt_inst">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QDoubleSpinBox" name="valt">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="minimum">
<double>-16777215.000000000000000</double>
</property>
<property name="maximum">
<double>16777215.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="13" column="3">
<widget class="QLabel" name="label_49">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>Meters</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</widget> </widget>
<tabstops> <tabstops>
@@ -1812,6 +1857,8 @@ Timestamp</string>
<tabstop>accy</tabstop> <tabstop>accy</tabstop>
<tabstop>accz_inst</tabstop> <tabstop>accz_inst</tabstop>
<tabstop>accz</tabstop> <tabstop>accz</tabstop>
<tabstop>fuel_qty_inst</tabstop>
<tabstop>fuel_qty</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>