Skip to content

Commit 7178527

Browse files
committed
moving 4k dps into the only place that cares about it
1 parent ea28ea3 commit 7178527

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

adafruit_lsm6ds/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ class LSM6DS: # pylint: disable=too-many-instance-attributes
182182
_gyro_data_rate = RWBits(4, _LSM6DS_CTRL2_G, 4)
183183
_gyro_range = RWBits(2, _LSM6DS_CTRL2_G, 2)
184184
_gyro_range_125dps = RWBit(_LSM6DS_CTRL2_G, 1)
185-
_gyro_range_4000dps = RWBit(_LSM6DS_CTRL2_G, 0)
186185

187186
_sw_reset = RWBit(_LSM6DS_CTRL3_C, 0)
188187
_bdu = RWBit(_LSM6DS_CTRL3_C, 6)
@@ -306,7 +305,6 @@ def gyro_range(self, value):
306305
def _set_gyro_range(self, value):
307306
if not GyroRange.is_valid(value):
308307
raise AttributeError("range must be a `GyroRange`")
309-
self._gyro_range_4000dps = False
310308

311309
# range uses `FS_G` enum
312310
if value <= GyroRange.RANGE_2000_DPS: # pylint: disable=no-member

adafruit_lsm6ds/ism330dhcx.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
This module provides the ISM330DHCX subclass of LSM6DS for using ISM330DHCX sensors.
66
"""
77
from time import sleep
8-
from . import LSM6DS, LSM6DS_DEFAULT_ADDRESS, GyroRange
8+
from . import LSM6DS, LSM6DS_DEFAULT_ADDRESS, GyroRange, RWBit, const
9+
10+
_LSM6DS_CTRL2_G = const(0x11)
911

1012

1113
class ISM330DHCX(LSM6DS): # pylint: disable=too-many-instance-attributes
@@ -18,6 +20,7 @@ class ISM330DHCX(LSM6DS): # pylint: disable=too-many-instance-attributes
1820
"""
1921

2022
CHIP_ID = 0x6B
23+
_gyro_range_4000dps = RWBit(_LSM6DS_CTRL2_G, 0)
2124

2225
def __init__(self, i2c_bus, address=LSM6DS_DEFAULT_ADDRESS):
2326
GyroRange.add_values(
@@ -50,5 +53,7 @@ def gyro_range(self, value):
5053
if value is GyroRange.RANGE_4000_DPS: # pylint: disable=no-member
5154
self._gyro_range_125dps = False
5255
self._gyro_range_4000dps = True
56+
else:
57+
self._gyro_range_4000dps = False
5358

5459
sleep(0.2) # needed to let new range settle

0 commit comments

Comments
 (0)