Skip to content

Commit

Permalink
Calibration patch for newer AHT20's
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
BlitzCityDIY committed Aug 14, 2023
1 parent 0d5caf0 commit 29c027a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions adafruit_ahtx0.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,14 @@ def reset(self) -> None:
time.sleep(0.02) # 20ms delay to wake up

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

@property
Expand Down

0 comments on commit 29c027a

Please sign in to comment.