Skip to content

Commit c17bc16

Browse files
committed
switch to math.radians
1 parent 350d313 commit c17bc16

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

adafruit_lsm6ds.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LSM6DSOX.git"
5151
from time import sleep
5252
from micropython import const
53+
from math import radians
5354
import adafruit_bus_device.i2c_device as i2c_device
5455
from adafruit_register.i2c_struct import ROUnaryStruct, Struct
5556
from adafruit_register.i2c_bits import RWBits
@@ -95,7 +96,6 @@
9596
_LSM6DS_TAP_CFG = const(0x58)
9697

9798
_MILLI_G_TO_ACCEL = 0.00980665
98-
_DPS_TO_RADS = 0.017453293
9999

100100

101101
class CV:
@@ -296,10 +296,7 @@ def acceleration(self):
296296
def gyro(self):
297297
"""The x, y, z angular velocity values returned in a 3-tuple and are in radians / second"""
298298
raw_gyro_data = self._raw_gyro_data
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
302-
299+
x, y, z = [radians(self._scale_gyro_data(i)) for i in raw_gyro_data]
303300
return (x, y, z)
304301

305302
def _scale_xl_data(self, raw_measurement):

0 commit comments

Comments
 (0)