We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d62022d + fe1abce commit e7b71a5Copy full SHA for e7b71a5
adafruit_ahtx0.py
@@ -107,11 +107,15 @@ def reset(self) -> None:
107
108
def calibrate(self) -> bool:
109
"""Ask the sensor to self-calibrate. Returns True on success, False otherwise"""
110
+ # Newer AHT20's may not succeed, so wrapping in try/except
111
self._buf[0] = AHTX0_CMD_CALIBRATE
112
self._buf[1] = 0x08
113
self._buf[2] = 0x00
114
with self.i2c_device as i2c:
- i2c.write(self._buf, start=0, end=3)
115
+ try:
116
+ i2c.write(self._buf, start=0, end=3)
117
+ except Exception: # pylint: disable=broad-except
118
+ pass
119
while self.status & AHTX0_STATUS_BUSY:
120
time.sleep(0.01)
121
if not self.status & AHTX0_STATUS_CALIBRATED:
0 commit comments