File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -160,12 +160,12 @@ def measure(self):
160
160
self ._temperature = buf [2 ]
161
161
else :
162
162
# temperature is 2 bytes
163
- # MSB ist sign, bits 0-14 are magnitude)
164
- self . _temperature = (((buf [2 ] & 0x7f )<< 8 ) | buf [3 ]) / 10
163
+ # MSB is sign, bits 0-14 are magnitude)
164
+ raw_temperature = (((buf [2 ] & 0x7f )<< 8 ) | buf [3 ]) / 10
165
165
# set sign
166
166
if buf [2 ] & 0x80 :
167
- self . _temperature = - self . _temperature
168
-
167
+ raw_temperature = - raw_temperature
168
+ self . _temperature = raw_temperature
169
169
# calc checksum
170
170
chk_sum = 0
171
171
for b in buf [0 :4 ]:
@@ -176,7 +176,6 @@ def measure(self):
176
176
# check sum failed to validate
177
177
raise RuntimeError ("Checksum did not validate. Try again." )
178
178
179
-
180
179
else :
181
180
raise RuntimeError ("A full buffer was not returned. Try again." )
182
181
You can’t perform that action at this time.
0 commit comments