-
Notifications
You must be signed in to change notification settings - Fork 53
mode command: docs vs. implementation #16
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
Comments
In some recent (and maybe not recent) drivers we've taken to putting things like this into an enum-like class (see here for an example) so you can refer to things like
I suggest we do the same and the docstring for the new class be written to include a table of the members and a description of each option. |
Additional info: I see that I CAN use the mode names by specifying the module name. e.g., sensor.mode = adafruit_bno055.IMUPLUS_MODE, Maybe it's just me, but to my mind, that seems awkward, and in any case, docstring should reflect this. |
@ViennaMike so are you proposing something closer to |
It would be great to have something like sensor.mode() which gives back or allows to set the current mode. Btw in which mode do you ship the bno055 ? |
Note that
No additional APIs need to be added. Only the documentation needs to be improved. |
oh great good to know ! |
For the mode method, the docstring, and hence the API, read as if the user passes a text string to set a new mode. However, these text strings are defined at the top of the module, outside of the class, and use the circuit python const feature. One can work around it by looking up the mode vs. hex value and passing either an integer or hex, but that doesn't seem like the right solution. The most user-friendly mechanism would seem to be to support passing the text strings that correspond to the mode name. At a minimum, the docstring should be changed to show the mode name to hex mapping.
The text was updated successfully, but these errors were encountered: