Skip to content

Commit f324666

Browse files
committed
changed modes in list from dec to hex consts, updated docstrings to reflect changes
1 parent b416aa8 commit f324666

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

adafruit_bno055.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -231,49 +231,63 @@ def temperature(self):
231231

232232
@property
233233
def acceleration(self):
234-
"""Gives the raw accelerometer readings, in m/s."""
235-
if self.mode not in [0, 2, 3, 6]:
234+
"""Gives the raw accelerometer readings, in m/s.
235+
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
236+
"""
237+
if self.mode not in [0x00, 0x02, 0x03, 0x06]:
236238
return self._acceleration
237239
return (None, None, None)
238240

239241
@property
240242
def magnetic(self):
241-
"""Gives the raw magnetometer readings in microteslas."""
242-
if self.mode not in [0, 3, 5, 8]:
243+
"""Gives the raw magnetometer readings in microteslas.
244+
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
245+
"""
246+
if self.mode not in [0x00, 0x03, 0x05, 0x08]:
243247
return self._magnetic
244248
return (None, None, None)
245249

246250
@property
247251
def gyro(self):
248-
"""Gives the raw gyroscope reading in radians per second."""
249-
if self.mode not in [0, 1, 2, 4, 9, 10]:
252+
"""Gives the raw gyroscope reading in radians per second.
253+
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
254+
"""
255+
if self.mode not in [0x00, 0x01, 0x02, 0x04, 0x09, 0x0a]:
250256
return self._gyro
251257
return (None, None, None)
252258

253259
@property
254260
def euler(self):
255-
"""Gives the calculated orientation angles, in degrees."""
256-
if self.mode in [9, 11, 12]:
261+
"""Gives the calculated orientation angles, in degrees.
262+
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
263+
"""
264+
if self.mode in [0x09, 0x0b, 0x0c]:
257265
return self._euler
258266
return (None, None, None)
259267

260268
@property
261269
def quaternion(self):
262-
"""Gives the calculated orientation as a quaternion."""
263-
if self.mode in [9, 11, 12]:
270+
"""Gives the calculated orientation as a quaternion.
271+
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
272+
"""
273+
if self.mode in [0x09, 0x0b, 0x0c]:
264274
return self._quaternion
265275
return (None, None, None, None)
266276

267277
@property
268278
def linear_acceleration(self):
269-
"""Returns the linear acceleration, without gravity, in m/s."""
270-
if self.mode in [9, 11, 12]:
279+
"""Returns the linear acceleration, without gravity, in m/s.
280+
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
281+
"""
282+
if self.mode in [0x09, 0x0b, 0x0c]:
271283
return self._linear_acceleration
272284
return (None, None, None)
273285

274286
@property
275287
def gravity(self):
276-
"""Returns the gravity vector, without acceleration in m/s."""
277-
if self.mode in [9, 11, 12]:
288+
"""Returns the gravity vector, without acceleration in m/s.
289+
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
290+
"""
291+
if self.mode in [0x09, 0x0b, 0x0c]:
278292
return self._gravity
279293
return (None, None, None)

0 commit comments

Comments
 (0)