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:
0x07CB 2024-10-19 23:56:54 +02:00 committed by GitHub
parent c33738a320
commit f88425505b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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