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:
parent
9c632b582d
commit
ce3f8374a1
2 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue