Fixes #5090: periodically update sensor ratios from the radio when the telemetry simulator is running. (#5110)
This commit is contained in:
committed by
Bertrand Songis
parent
4dcd49a516
commit
3436273fdf
@@ -211,9 +211,7 @@ void TelemetrySimulator::setupDataFields()
|
||||
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->A1_ratio->setValue(simulator->getSensorRatio(ADC1_ID) / 10.0);
|
||||
ui->A2_ratio->setValue(simulator->getSensorRatio(ADC2_ID) / 10.0);
|
||||
refreshSensorRatios();
|
||||
}
|
||||
|
||||
void setSportPacketCrc(uint8_t * packet)
|
||||
@@ -252,6 +250,13 @@ bool generateSportPacket(uint8_t * packet, uint8_t dataId, uint8_t prim, uint16_
|
||||
return true;
|
||||
}
|
||||
|
||||
void TelemetrySimulator::refreshSensorRatios()
|
||||
{
|
||||
ui->rxbt_ratio->setValue(simulator->getSensorRatio(BATT_ID) / 10.0);
|
||||
ui->A1_ratio->setValue(simulator->getSensorRatio(ADC1_ID) / 10.0);
|
||||
ui->A2_ratio->setValue(simulator->getSensorRatio(ADC2_ID) / 10.0);
|
||||
}
|
||||
|
||||
void TelemetrySimulator::generateTelemetryFrame()
|
||||
{
|
||||
static int item = 0;
|
||||
@@ -268,6 +273,7 @@ void TelemetrySimulator::generateTelemetryFrame()
|
||||
#if defined(XJT_VERSION_ID)
|
||||
generateSportPacket(buffer, 1, DATA_FRAME, XJT_VERSION_ID, 11);
|
||||
#endif
|
||||
refreshSensorRatios(); // placed here in order to call this less often
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
@@ -67,6 +67,7 @@ class TelemetrySimulator : public QWidget
|
||||
void onStop();
|
||||
void onPositionIndicatorChanged(int value);
|
||||
void onReplayRateChanged(int value);
|
||||
void refreshSensorRatios();
|
||||
void generateTelemetryFrame();
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user