Skip to content

Commit 29c027a

Browse files
committed
Calibration patch for newer AHT20's
Updating calibration function so that it isn't required to pass for newer AHT20's. This same change was made for the [Arduino library](adafruit/Adafruit_AHTX0#13)
1 parent 0d5caf0 commit 29c027a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

adafruit_ahtx0.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,14 @@ def reset(self) -> None:
106106
time.sleep(0.02) # 20ms delay to wake up
107107

108108
def calibrate(self) -> bool:
109-
"""Ask the sensor to self-calibrate. Returns True on success, False otherwise"""
109+
"""Ask the sensor to self-calibrate. May not 'succeed' on newer AHT20s."""
110110
self._buf[0] = AHTX0_CMD_CALIBRATE
111111
self._buf[1] = 0x08
112112
self._buf[2] = 0x00
113113
with self.i2c_device as i2c:
114114
i2c.write(self._buf, start=0, end=3)
115115
while self.status & AHTX0_STATUS_BUSY:
116116
time.sleep(0.01)
117-
if not self.status & AHTX0_STATUS_CALIBRATED:
118-
return False
119117
return True
120118

121119
@property

0 commit comments

Comments
 (0)