Skip to content

Commit

Permalink
updating to use try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
BlitzCityDIY committed Aug 14, 2023
1 parent cc89d00 commit e586707
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions adafruit_ahtx0.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def reset(self) -> None:

def calibrate(self) -> bool:
"""Ask the sensor to self-calibrate. Returns True on success, False otherwise"""
"""Newer AHT20's may not succeed, so wrapping in try/except"""
# Newer AHT20's may not succeed, so wrapping in try/except
try:
self._buf[0] = AHTX0_CMD_CALIBRATE
self._buf[1] = 0x08
Expand All @@ -118,9 +118,9 @@ def calibrate(self) -> bool:
time.sleep(0.01)
if not self.status & AHTX0_STATUS_CALIBRATED:
return False
return True
except:
except Exception: # pylint: disable=broad-except
pass
return True

@property
def status(self) -> int:
Expand Down

0 comments on commit e586707

Please sign in to comment.