mirror of https://github.com/joan2937/pigpio
Update dht11.py
In Python, simply using raise outside of an except block is not valid and results in the error RuntimeError: No active exception to reraise.
This commit is contained in:
parent
c33738a320
commit
f88425505b
|
@ -88,7 +88,7 @@ class DHT11(object):
|
||||||
total = self.humidity + self.temperature
|
total = self.humidity + self.temperature
|
||||||
# is checksum ok ?
|
# is checksum ok ?
|
||||||
if not (total & 255) == self.checksum:
|
if not (total & 255) == self.checksum:
|
||||||
raise
|
raise ValueError("Checksum incorrect")
|
||||||
elif 16 <= self.bit < 24: # in temperature byte
|
elif 16 <= self.bit < 24: # in temperature byte
|
||||||
self.temperature = (self.temperature << 1) + val
|
self.temperature = (self.temperature << 1) + val
|
||||||
elif 0 <= self.bit < 8: # in humidity byte
|
elif 0 <= self.bit < 8: # in humidity byte
|
||||||
|
|
Loading…
Reference in New Issue