Fixes #2631
This commit is contained in:
@@ -527,6 +527,10 @@ void TelemetrySensor::init(const char * label, uint8_t unit, uint8_t prec)
|
||||
memclear(this->label, TELEM_LABEL_LEN);
|
||||
strncpy(this->label, label, TELEM_LABEL_LEN);
|
||||
this->unit = unit;
|
||||
if (prec > 1 && (IS_DISTANCE_UNIT(unit) || IS_SPEED_UNIT(unit))) {
|
||||
// 2 digits precision is not needed here
|
||||
prec = 1;
|
||||
}
|
||||
this->prec = prec;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,4 +192,7 @@ int32_t convertTelemetryValue(int32_t value, uint8_t unit, uint8_t prec, uint8_t
|
||||
void frskySportSetDefault(int index, uint16_t type, uint8_t instance);
|
||||
void frskyDSetDefault(int index, uint16_t id);
|
||||
|
||||
#define IS_DISTANCE_UNIT(unit) ((unit) == UNIT_METERS || (unit) == UNIT_FEET)
|
||||
#define IS_SPEED_UNIT(unit) ((unit) >= UNIT_KTS && (unit) <= UNIT_MPH)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user