Add multiplier to RPM sensor (Fix #1688), fix offset/ratio DSBs

This commit is contained in:
Andre Bernet
2015-03-31 17:49:43 +04:00
parent 4110de0e64
commit 8b29aa1e9b
5 changed files with 51 additions and 12 deletions
+1
View File
@@ -259,6 +259,7 @@ void frskySportSetDefault(int index, uint16_t id, uint8_t instance)
}
if (unit == UNIT_RPMS) {
telemetrySensor.custom.ratio = 1;
telemetrySensor.custom.offset = 1;
}
}
else {
+1 -1
View File
@@ -172,7 +172,7 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t val, uint32
newVal = 0;
}
else if (unit == UNIT_RPMS) {
newVal = newVal / sensor.custom.ratio;
newVal = (newVal * sensor.custom.offset) / sensor.custom.ratio;
}
else {
newVal = sensor.getValue(newVal, unit, prec);