Skip to content

The reset method seems inconsistent #28

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

Closed
peterhinch opened this issue May 6, 2019 · 2 comments
Closed

The reset method seems inconsistent #28

peterhinch opened this issue May 6, 2019 · 2 comments

Comments

@peterhinch
Copy link
Contributor

The BNO055 class reset method is user-accesible

def reset(self):
"""Resets the sensor to default settings."""
self.mode = CONFIG_MODE
try:
self._write_register(_TRIGGER_REGISTER, 0x20)
except OSError: # error due to the chip resetting
pass
# wait for the chip to reset (650 ms typ.)
time.sleep(0.7)

If a user calls this method, my reading of the datasheet is that the behaviour of the chip is equivalent to a power-on or a pulse on the reset line. It therefore seems inconsistent that the constructor, after calling reset(), issues
self._write_register(_POWER_REGISTER, _POWER_NORMAL)
self._write_register(_PAGE_REGISTER, 0x00)
self._write_register(_TRIGGER_REGISTER, 0x00)
time.sleep(0.01)
self.mode = NDOF_MODE
time.sleep(0.01)

Either these lines are redundant or they should be included in the reset method. Alternatively user access could be discouraged by renaming it _reset.

@tannewt
Copy link
Member

tannewt commented May 10, 2019

My preference would be to rename it to _reset and reduce the API surface area.

ladyada added a commit that referenced this issue May 22, 2019
Rename .reset ._reset as per issue #28
@evaherrada
Copy link
Collaborator

Fixed in #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants