Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions adafruit_ahtx0.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ def calibrate(self) -> bool:
except (RuntimeError, OSError):
pass

start_busy_time = time.monotonic()
while self.status & AHTX0_STATUS_BUSY:
if time.monotonic() - start_busy_time > 3.0:
raise RuntimeError(
"Sensor remained busy 3 seconds. Could not be calibrated"
)
time.sleep(0.01)
if not self.status & AHTX0_STATUS_CALIBRATED:
return False
Expand Down