This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Ruuvitag BLE integration
#12
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
Reply


Messages In This Thread
Ruuvitag BLE integration - by Papru - 22.05.2020, 05:26
RE: Ruuvitag BLE integration - by admin - 22.05.2020, 09:56
RE: Ruuvitag BLE integration - by Papru - 22.05.2020, 11:35
RE: Ruuvitag BLE integration - by admin - 22.05.2020, 11:36
RE: Ruuvitag BLE integration - by Papru - 22.05.2020, 11:43
RE: Ruuvitag BLE integration - by admin - 22.05.2020, 11:45
RE: Ruuvitag BLE integration - by Papru - 22.05.2020, 11:48
RE: Ruuvitag BLE integration - by admin - 22.05.2020, 12:38
RE: Ruuvitag BLE integration - by Papru - 22.05.2020, 13:01
RE: Ruuvitag BLE integration - by admin - 22.05.2020, 13:25
RE: Ruuvitag BLE integration - by Papru - 22.05.2020, 13:38
RE: Ruuvitag BLE integration - by admin - 24.05.2020, 11:33

Forum Jump: