1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-26 01:35:16 +03:00

Re #2513: set value of duplicated telemetry sensors

This commit is contained in:
Damjan Adamic 2015-07-20 21:13:30 +02:00
parent f845be683c
commit 7b28910cc2

View file

@ -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) {