Skip to content

Commit

Permalink
Merge pull request #14 from adafruit/rads_fix
Browse files Browse the repository at this point in the history
change from dps->rads for gyro to fix #9
  • Loading branch information
jepler committed Apr 20, 2020
2 parents cbc8c46 + 472b71b commit 24224cc
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 128 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Usage Example
while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sox.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(sox.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s"%(sox.gyro))
print("")
time.sleep(0.5)
Expand Down
8 changes: 3 additions & 5 deletions adafruit_lsm6ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LSM6DSOX.git"
from time import sleep
from math import radians
from micropython import const
import adafruit_bus_device.i2c_device as i2c_device
from adafruit_register.i2c_struct import ROUnaryStruct, Struct
Expand Down Expand Up @@ -293,12 +294,9 @@ def acceleration(self):

@property
def gyro(self):
"""The x, y, z angular velocity values returned in a 3-tuple and are in degrees / second"""
"""The x, y, z angular velocity values returned in a 3-tuple and are in radians / second"""
raw_gyro_data = self._raw_gyro_data
x = self._scale_gyro_data(raw_gyro_data[0])
y = self._scale_gyro_data(raw_gyro_data[1])
z = self._scale_gyro_data(raw_gyro_data[2])

x, y, z = [radians(self._scale_gyro_data(i)) for i in raw_gyro_data]
return (x, y, z)

def _scale_xl_data(self, raw_measurement):
Expand Down
2 changes: 1 addition & 1 deletion examples/lsm6ds_full_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

while True:
print(
"Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s"
"Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f radians/s"
% (sensor.acceleration + sensor.gyro)
)
time.sleep(0.05)
2 changes: 1 addition & 1 deletion examples/lsm6ds_ism330dhct_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
print("")
time.sleep(0.5)
2 changes: 1 addition & 1 deletion examples/lsm6ds_lsm6ds33_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
print("")
time.sleep(0.5)
2 changes: 1 addition & 1 deletion examples/lsm6ds_lsm6dsox_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
print("")
time.sleep(0.5)
118 changes: 0 additions & 118 deletions register_map.json

This file was deleted.

0 comments on commit 24224cc

Please sign in to comment.