mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 01:05:10 +03:00
#2538 - Proposal for a fix. We have many wrong sensors, including
openXsensor. The first ID is stored in EEPROM, but not used during the search loop
This commit is contained in:
parent
8d97235f41
commit
6f21556b81
3 changed files with 17 additions and 8 deletions
|
@ -179,7 +179,9 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t val, uint32
|
|||
newVal = 0;
|
||||
}
|
||||
else if (unit == UNIT_RPMS) {
|
||||
newVal = (newVal * sensor.custom.offset) / sensor.custom.ratio;
|
||||
if (sensor.custom.ratio != 0) {
|
||||
newVal = (newVal * sensor.custom.offset) / sensor.custom.ratio;
|
||||
}
|
||||
}
|
||||
else {
|
||||
newVal = sensor.getValue(newVal, unit, prec);
|
||||
|
@ -486,7 +488,7 @@ void setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t instance
|
|||
|
||||
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) {
|
||||
if (telemetrySensor.type == TELEM_TYPE_CUSTOM && (telemetrySensor.id == id || g_model.ignoreSensorIds) && telemetrySensor.instance == instance) {
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue