I’m having problems getting the right values for the temperature if it’s subzero degrees (C). I don’t use the python libs provided by you but “borrowed” the conversion code from xbee_sensor.py because I could find any decent documentation on the format of the 1S sample response.
According to your library a temp is negative, if the first 5 bits of the sample are set to 1, then all you need to do is negate the valued calculated before.
However this gives me wrong results, f.e. -122,62 or -126,69. After a bit of examination I think I have found the problem, is it possible that you have to flip the bits if the temp. is below zero? This would give me plausible results.
Sensor gives me FF AA as result.
is negative? FF AA & F8 00 != 0 : true
extract the integer: (FF AA & 7F0) >> 4 = 7A (= 122d, 1111010b)
if you flip the bits you’ll get 0000101b which would mean 5 degrees below zero, a plausible value for the temp. outside.
So could anybody give me a hint what’s wrong with the temp. calculation?