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 1 commit
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_CONFIG_MODE is not defined, needs to be CONFIG_MODE

time.sleep_ms(0.02) # Datasheet table 3.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be time.sleep(0.02).
image

if new_mode != _CONFIG_MODE:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for _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