File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -108,18 +108,18 @@ def reset(self) -> None:
108
108
def calibrate (self ) -> bool :
109
109
"""Ask the sensor to self-calibrate. Returns True on success, False otherwise"""
110
110
# Newer AHT20's may not succeed, so wrapping in try/except
111
- try :
112
- self ._buf [0 ] = AHTX0_CMD_CALIBRATE
113
- self ._buf [1 ] = 0x08
114
- self ._buf [ 2 ] = 0x00
115
- with self . i2c_device as i2c :
111
+ self . _buf [ 0 ] = AHTX0_CMD_CALIBRATE
112
+ self ._buf [1 ] = 0x08
113
+ self ._buf [2 ] = 0x00
114
+ with self .i2c_device as i2c :
115
+ try :
116
116
i2c .write (self ._buf , start = 0 , end = 3 )
117
- while self . status & AHTX0_STATUS_BUSY :
118
- time . sleep ( 0.01 )
119
- if not self .status & AHTX0_STATUS_CALIBRATED :
120
- return False
121
- except Exception : # pylint: disable=broad-except
122
- pass
117
+ except Exception : # pylint: disable=broad-except
118
+ pass
119
+ while self .status & AHTX0_STATUS_BUSY :
120
+ time . sleep ( 0.01 )
121
+ if not self . status & AHTX0_STATUS_CALIBRATED :
122
+ return False
123
123
return True
124
124
125
125
@property
You can’t perform that action at this time.
0 commit comments