Skip to content

Commit eb89a5d

Browse files
committed
Modified unpack for temperature sensor value to use unsigned short instead of signed to fix issue with high temperatures (over 42.5C) coming out as negative values (issue #4)
1 parent 8e0fea8 commit eb89a5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_shtc3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def measurements(self):
195195
# decode data into human values:
196196
# convert bytes into 16-bit signed integer
197197
# convert the LSB value to a human value according to the datasheet
198-
raw_temp = unpack_from(">h", temp_data)[0]
198+
raw_temp = unpack_from(">H", temp_data)[0]
199199
raw_temp = ((4375 * raw_temp) >> 14) - 4500
200200
temperature = raw_temp / 100.0
201201

0 commit comments

Comments
 (0)