Fixes #2382: new atribute onlyPositive for telemetry sensor

Conflicts:
	radio/src/translations/it.h.txt
This commit is contained in:
Damjan Adamic
2015-06-28 12:37:55 +02:00
committed by bsongis
parent add90b3a88
commit 7312bd2655
17 changed files with 72 additions and 46 deletions
+4
View File
@@ -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;
+1 -2
View File
@@ -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;