Commit b2611d6b authored by syndycat's avatar syndycat Committed by Damien George
Browse files

drivers/onewire/ds18x20: Fix negative temperature calc for DS18B20.

parent 044f96c3
......@@ -93,6 +93,9 @@ class DS18X20(object):
temp = temp_read - 0.25 + (count_per_c - count_remain) / count_per_c
return temp
elif rom0 == 0x28:
return (temp_msb << 8 | temp_lsb) / 16
temp = (temp_msb << 8 | temp_lsb) / 16
if (temp_msb & 0xf8) == 0xf8: # for negative temperature
temp -= 0x1000
return temp
else:
assert False
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment