TheThingsNetwork / arduino-node-lib

Arduino Library for The Things Node
MIT License
22 stars 26 forks source link

The Things Node :: Basic Example :: Problem with negative temperatures .. #24

Closed PreinfalkG closed 4 years ago

PreinfalkG commented 4 years ago

In the basic example negative temperatures are not processed correctly -> see Screenshot

2020-01-07_TheThingsNode-BasicExample

johanstokking commented 4 years ago

I cannot reproduce:

$ node
Welcome to Node.js v12.12.0.
Type ".help" for more information.
> let bytes = [0, 0, 0, 0, 0xfe, 0xc1]
undefined
> let decoded = {}
undefined
> decoded.temperature = ((0xffff << 16) + (bytes[4] << 8) + bytes[5]) / 100;
-3.19

Are you sure you are using the most up-to-date Decoder.js from the example you referenced?

PreinfalkG commented 4 years ago

oh sorry, i really used an old version of decoder.js