ruuvi / ruuvi-sensor-protocols

46 stars 20 forks source link

Clarify MSB / LSB for RAWv2 #29

Open tomgidden opened 4 years ago

tomgidden commented 4 years ago

Implementing RAWv2 is made a bit more complicated by not specifying whether the 16-bit values are most-significant-bit or least-significant-bit.

For that matter, it'd help if the data field descriptions referred to the bytes in the input data rather than just 0x01c3 being +2.255ºC, for example.

So, maybe some code such as ( buf[1] << 8 | buf[2] ) * 0.005 * ( buf[1] > 0x7f ? -1 : 1 )

For the split battery data, the clarification of "13th byte and three most-significant bits of 14th byte", and/or some code as above would be useful.

The values can be deduced by working through the Test Vectors later on in the document, but it's not as simple as it could be.

ojousima commented 4 years ago

Thanks for the feedback, I'll clarify these points

ojousima commented 4 years ago

Reopening as a reminder to add links to decoder

DG12 commented 2 years ago

@ojousima maybe time to recluse this?