mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Re #2513: set value of duplicated telemetry sensors
This commit is contained in:
parent
f845be683c
commit
7b28910cc2
1 changed files with 9 additions and 2 deletions
|
@ -482,13 +482,20 @@ int lastUsedTelemetryIndex()
|
|||
|
||||
void setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t instance, int32_t value, uint32_t unit, uint32_t prec)
|
||||
{
|
||||
bool available = false;
|
||||
|
||||
for (int index=0; index<MAX_SENSORS; index++) {
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index];
|
||||
if (telemetrySensor.type == TELEM_TYPE_CUSTOM && telemetrySensor.id == id && telemetrySensor.instance == instance) {
|
||||
telemetryItems[index].setValue(telemetrySensor, value, unit, prec);
|
||||
return;
|
||||
telemetryItems[index].setValue(telemetrySensor, value, unit, prec);
|
||||
available = true;
|
||||
// we continue search here, because more than one sensor can have the same id and instance
|
||||
}
|
||||
}
|
||||
|
||||
if (available) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = availableTelemetryIndex();
|
||||
if (index >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue