Skip to content

mode setter enables changes and honors delays. #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions adafruit_bno055.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ def mode(self):
"""
return self._read_register(_MODE_REGISTER)

@mode.setter
def mode(self, new_mode):
self._write_register(_MODE_REGISTER, CONFIG_MODE) # Empirically necessary
time.sleep(0.02) # Datasheet table 3.6
if new_mode != CONFIG_MODE:
self._write_register(_MODE_REGISTER, new_mode)
time.sleep(0.01) # Table 3.6

@property
def calibration_status(self):
"""Tuple containing sys, gyro, accel, and mag calibration data."""
Expand All @@ -213,10 +221,6 @@ def calibrated(self):
sys, gyro, accel, mag = self.calibration_status
return sys == gyro == accel == mag == 0x03

@mode.setter
def mode(self, new_mode):
self._write_register(_MODE_REGISTER, new_mode)

@property
def external_crystal(self):
"""Switches the use of external crystal on or off."""
Expand Down