1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

Using the right precision for unknown (custom) sensors (#7508)

Co-authored-by: Herman Kruisman <herman@server.thuis.local>
This commit is contained in:
RealTadango 2020-04-21 15:04:17 +02:00 committed by GitHub
parent 9c632b582d
commit ce3f8374a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -130,7 +130,7 @@ uint16_t rboxState;
void sportProcessTelemetryPacket(uint16_t id, uint8_t subId, uint8_t instance, uint32_t data, TelemetryUnit unit=UNIT_RAW)
{
const FrSkySportSensor * sensor = getFrSkySportSensor(id, subId);
uint8_t precision = 0;
uint8_t precision = 255;
if (sensor) {
if (unit == UNIT_RAW)
unit = sensor->unit;

View file

@ -82,6 +82,10 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t val, uint32
{
int32_t newVal = val;
if(prec == 255) {
prec = sensor.prec;
}
if (unit == UNIT_CELLS) {
uint32_t data = uint32_t(newVal);
uint8_t cellsCount = (data >> 24);