24.05.2020, 11:33
Use this to handle negative temperature correctly:
Code:
temperature = data:byte(10)
decimals = data:byte(11) / 100
if bit.band(temperature, 0x80) == 0x80 then
temperature = -bit.band(temperature, 0x7F)
temperature = temperature - decimals
else
temperature = temperature + decimals
end