File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -116,17 +116,18 @@ def calibrate(self) -> bool:
116116 try :
117117 # Newer AHT20's may not succeed with old command, so wrapping in try/except
118118 i2c .write (self ._buf , start = 0 , end = 3 )
119- except Exception : # pylint: disable=broad-except
119+ except ( RuntimeError , OSError ):
120120 calibration_failed = True
121121
122122 if calibration_failed :
123123 # try another calibration command for newer AHT20's
124+ # print("Calibration failed, trying AH20 command")
124125 time .sleep (0.01 )
125126 self ._buf [0 ] = AHT20_CMD_CALIBRATE
126127 with self .i2c_device as i2c :
127128 try :
128129 i2c .write (self ._buf , start = 0 , end = 3 )
129- except Exception :
130+ except ( RuntimeError , OSError ) :
130131 pass
131132
132133 while self .status & AHTX0_STATUS_BUSY :
You can’t perform that action at this time.
0 commit comments