Skip to content

Commit 350d313

Browse files
committed
BREAKING CHANGE - change from dps->rads for gyro to fix #9
1 parent cbc8c46 commit 350d313

7 files changed

+10
-127
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Usage Example
6969
7070
while True:
7171
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sox.acceleration))
72-
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(sox.gyro))
72+
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s"%(sox.gyro))
7373
print("")
7474
time.sleep(0.5)
7575

adafruit_lsm6ds.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
_LSM6DS_TAP_CFG = const(0x58)
9696

9797
_MILLI_G_TO_ACCEL = 0.00980665
98+
_DPS_TO_RADS = 0.017453293
9899

99100

100101
class CV:
@@ -293,11 +294,11 @@ def acceleration(self):
293294

294295
@property
295296
def gyro(self):
296-
"""The x, y, z angular velocity values returned in a 3-tuple and are in degrees / second"""
297+
"""The x, y, z angular velocity values returned in a 3-tuple and are in radians / second"""
297298
raw_gyro_data = self._raw_gyro_data
298-
x = self._scale_gyro_data(raw_gyro_data[0])
299-
y = self._scale_gyro_data(raw_gyro_data[1])
300-
z = self._scale_gyro_data(raw_gyro_data[2])
299+
x = self._scale_gyro_data(raw_gyro_data[0]) * _DPS_TO_RADS
300+
y = self._scale_gyro_data(raw_gyro_data[1]) * _DPS_TO_RADS
301+
z = self._scale_gyro_data(raw_gyro_data[2]) * _DPS_TO_RADS
301302

302303
return (x, y, z)
303304

examples/lsm6ds_full_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
while True:
3030
print(
31-
"Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s"
31+
"Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f radians/s"
3232
% (sensor.acceleration + sensor.gyro)
3333
)
3434
time.sleep(0.05)

examples/lsm6ds_ism330dhct_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
while True:
1111
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
12-
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
12+
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
1313
print("")
1414
time.sleep(0.5)

examples/lsm6ds_lsm6ds33_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
while True:
1111
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
12-
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
12+
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
1313
print("")
1414
time.sleep(0.5)

examples/lsm6ds_lsm6dsox_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
while True:
1111
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
12-
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
12+
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
1313
print("")
1414
time.sleep(0.5)

register_map.json

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)