Do you have any example payloads for different temperatures, especially values of 33°C and above?
The two example values in the documentation (0x1B being 27°C, and 0xF2 being -14°C), happen to be regular signed integers. But the “greater than 32” (rather than 127) in the following surprises me:
Temperature ranges -20°C to +50°C (Variable range -127 -> 127)
- - ([256 or 0] - Byte)
- If the decimal conversion of the byte is greater than 32 then the number required for the formula is 256 otherwise the number required for the formula is 0.
That makes me wonder how temperatures of 33°C and above would be sent. I don’t think that’s possible at all with this formula?
The decoder that @descartes found also assumes a standard signed integer. (Note that
if (value & 0x80) ...).
I’d assume that the following should do:
// negative values, by shifting 24 bits to the left, followed by a
// sign-propagating right shift of the same number of bits.
temp1 = bytes<<24>>24;
temp2 = bytes<<24>>24;
temp3 = bytes<<24>>24;
temp4 = bytes<<24>>24;