From ad83a78901ab78eb4598de77bae605084020ee30 Mon Sep 17 00:00:00 2001 From: Neil Horne Date: Mon, 1 Jun 2020 00:46:56 +1000 Subject: [PATCH] Align companion telemetry sensor units to radio (#7653) * Align cpn sensor units to radio * Add cpn conversion for sensor unit --- .../src/firmwares/opentx/opentxeeprom.cpp | 6 ++++++ companion/src/firmwares/sensordata.h | 21 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index e39d04180..b49a4a7ab 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -1983,6 +1983,12 @@ class SensorField: public TransformedField { sensor.unit++; } + if (version < 219) { + if (sensor.unit > SensorData::UNIT_FLOZ) { + sensor.unit += 11; + } + } + qCDebug(eepromImport) << QString("imported %1").arg(internalField.getName()); } diff --git a/companion/src/firmwares/sensordata.h b/companion/src/firmwares/sensordata.h index 65a8a4957..3f995ea3e 100644 --- a/companion/src/firmwares/sensordata.h +++ b/companion/src/firmwares/sensordata.h @@ -74,10 +74,13 @@ class SensorData { UNIT_METERS_PER_SECOND, UNIT_FEET_PER_SECOND, UNIT_KMH, + UNIT_SPEED = UNIT_KMH, UNIT_MPH, UNIT_METERS, + UNIT_DIST = UNIT_METERS, UNIT_FEET, UNIT_CELSIUS, + UNIT_TEMPERATURE = UNIT_CELSIUS, UNIT_FAHRENHEIT, UNIT_PERCENT, UNIT_MAH, @@ -91,18 +94,30 @@ class SensorData { UNIT_MILLILITERS, UNIT_FLOZ, UNIT_MILLILITERS_PER_MINUTE, + UNIT_MAX = UNIT_MILLILITERS_PER_MINUTE, + UNIT_SPARE1, + UNIT_SPARE2, + UNIT_SPARE3, + UNIT_SPARE4, + UNIT_SPARE5, + UNIT_SPARE6, + UNIT_SPARE7, + UNIT_SPARE8, + UNIT_SPARE9, + UNIT_SPARE10, UNIT_HOURS, UNIT_MINUTES, UNIT_SECONDS, // FrSky format used for these fields, could be another format in the future - UNIT_FIRST_VIRTUAL, + UNIT_FIRST_VIRTUAL, UNIT_CELLS = UNIT_FIRST_VIRTUAL, UNIT_DATETIME, UNIT_GPS, + UNIT_BITFIELD, + UNIT_TEXT, + // Internal units (not stored in sensor unit) UNIT_GPS_LONGITUDE, UNIT_GPS_LATITUDE, - UNIT_GPS_LONGITUDE_EW, - UNIT_GPS_LATITUDE_NS, UNIT_DATETIME_YEAR, UNIT_DATETIME_DAY_MONTH, UNIT_DATETIME_HOUR_MIN,