Fixes #2382: new atribute onlyPositive for telemetry sensor
Conflicts: radio/src/translations/it.h.txt
This commit is contained in:
@@ -273,6 +273,10 @@ void frskySportSetDefault(int index, uint16_t id, uint8_t instance)
|
||||
telemetrySensor.custom.ratio = 132;
|
||||
telemetrySensor.filter = 1;
|
||||
}
|
||||
else if (id >= CURR_FIRST_ID && id <= CURR_LAST_ID) {
|
||||
telemetrySensor.onlyPositive = 1;
|
||||
}
|
||||
// TODO set telemetrySensor.onlyPositive for other sensors that need it
|
||||
else if (unit == UNIT_RPMS) {
|
||||
telemetrySensor.custom.ratio = 1;
|
||||
telemetrySensor.custom.offset = 1;
|
||||
|
||||
@@ -599,10 +599,9 @@ int32_t TelemetrySensor::getValue(int32_t value, uint8_t unit, uint8_t prec) con
|
||||
|
||||
if (type == TELEM_TYPE_CUSTOM) {
|
||||
value += custom.offset;
|
||||
if (value < 0 && unit >= UNIT_VOLTS && unit <= UNIT_MPH) {
|
||||
if (value < 0 && onlyPositive) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user