Skip to content

Commit 116162e

Browse files
committed
changing cache init
1 parent 58d7cb4 commit 116162e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_lsm6ds.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ class LSM6DS: #pylint: disable=too-many-instance-attributes
214214
_raw_gyro_data = Struct(_LSM6DS_OUTX_L_G, "<hhh")
215215
CHIP_ID = None
216216
def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS):
217+
self._cached_accel_range = None
218+
self._cached_gyro_range = None
219+
217220
self.i2c_device = i2c_device.I2CDevice(i2c_bus, address)
218221
if self.CHIP_ID is None:
219222
raise AttributeError("LSM6DS Parent Class cannot be directly instantiated")
@@ -229,9 +232,6 @@ def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS):
229232
self.accelerometer_range = AccelRange.RANGE_4G #pylint: disable=no-member
230233
self.gyro_range = GyroRange.RANGE_250_DPS #pylint: disable=no-member
231234

232-
self._cached_accel_range = self._accel_range
233-
self._cached_gyro_range = self._gyro_range
234-
235235
def reset(self):
236236
"Resets the sensor's configuration into an initial state"
237237
self._sw_reset = True

0 commit comments

Comments
 (0)