Skip to content

Commit ef29547

Browse files
authored
Merge pull request #19 from tmf97/master
Added unit conversion deg to rad to be consistent with documentation
2 parents e969d40 + f1421d8 commit ef29547

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

adafruit_fxas21002c.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
GYRO_RANGE_1000DPS = 1000
8585
GYRO_RANGE_2000DPS = 2000
8686

87+
# Unit conversion:
88+
DEGREE_TO_RAD = 3.141592653589793 / 180
89+
8790

8891
class FXAS21002C:
8992
"""Driver for the NXP FXAS21002C gyroscope."""
@@ -172,4 +175,5 @@ def gyroscope(self):
172175
factor = _GYRO_SENSITIVITY_1000DPS
173176
elif self._gyro_range == GYRO_RANGE_2000DPS:
174177
factor = _GYRO_SENSITIVITY_2000DPS
178+
factor *= DEGREE_TO_RAD
175179
return [x * factor for x in raw]

0 commit comments

Comments
 (0)