google / eddystone

Specification for Eddystone, an open beacon format from Google
Apache License 2.0
3.07k stars 761 forks source link

TLM temperature encoding #261

Open dvcorreia opened 2 years ago

dvcorreia commented 2 years ago

The Unencrypted TLM Frame Specification states that beacon temperature should be encoded following a signed 8.8 fixed-point notation. If the value is not supported it should be set to 0x8000, -128 °C. The encoding of the temperature is not clear reading the specification. The link provided for the signed 8.8 fixed-point notation does not provide any clear information regarding this, with the exception of a few lessons which go over fixed-point. A few problems I've been encountered reading the specification document are presented next.

The not supported value of 0x8000 (-128 °C) is ambiguous. 0x80, the integer part of the fixed-point, can represent 128 or -128 in two's complement. From the legacy code I've been tasked to migrate, we have been treating the value as a two's complement encoded value. This raises another question: if the integer part is encoded in two's complement, values between -1 and 0 (e.g. -0.25, -0.5, ...) can not be encoded, since two's complement doesn't have negative zero.

Any insight in this mater would be of help.