@@ -145,14 +145,6 @@ def _read_register(self, register):
145
145
i2c .readinto (self .buffer , start = 1 )
146
146
return self .buffer [1 ]
147
147
148
- def _get_calibration_data (self ):
149
- calibration_data = self ._read_register (_CALIBRATION_REGISTER )
150
- sys = (calibration_data >> 6 ) & 0x03
151
- gyro = (calibration_data >> 4 ) & 0x03
152
- accel = (calibration_data >> 2 ) & 0x03
153
- mag = calibration_data & 0x03
154
- return sys , gyro , accel , mag
155
-
156
148
def reset (self ):
157
149
"""Resets the sensor to default settings."""
158
150
self .mode = CONFIG_MODE
@@ -206,12 +198,20 @@ def mode(self):
206
198
return self ._read_register (_MODE_REGISTER )
207
199
208
200
@property
209
- def is_fully_calibrated (self ):
210
- """Returns the status of the sensor calibration."""
211
- sys , gyro , accel , mag = self ._get_calibration_data ()
212
- if sys < 3 or gyro < 3 or accel < 3 or mag < 3 :
213
- return False
214
- return True
201
+ def calibration_status (self ):
202
+ """Tuple containing sys, gyro, accel, and mag calibration data."""
203
+ calibration_data = self ._read_register (_CALIBRATION_REGISTER )
204
+ sys = (calibration_data >> 6 ) & 0x03
205
+ gyro = (calibration_data >> 4 ) & 0x03
206
+ accel = (calibration_data >> 2 ) & 0x03
207
+ mag = calibration_data & 0x03
208
+ return sys , gyro , accel , mag
209
+
210
+ @property
211
+ def calibrated (self ):
212
+ """Boolean indicating calibration status."""
213
+ sys , gyro , accel , mag = self .calibration_status
214
+ return sys == gyro == accel == mag == 0x03
215
215
216
216
@mode .setter
217
217
def mode (self , new_mode ):
0 commit comments