-
Notifications
You must be signed in to change notification settings - Fork 105
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
Correct implementation of forced measurements #91
base: master
Are you sure you want to change the base?
Conversation
@FlorianFranzen thanks for your pull. I haven't had time to go through all of the changes or to look at whether this is a better way of polling the sensor. I do have a lot of questions on some changes you made such as why you switched to TwoWire? There are a lot of architectural changes that I will likely have to change to match the style of the library. I don't necessarily like the idea of having unused portions of the API that only pertain to certain sensor modes, so that might need to be changed. The I2C address enum should not be in the base BME280 class. Member variable names should start with 'm_'. Also, the ctrlHum, ctrlMeas and config variables have been added as member variables when I don't see them used anywhere else. What was the reasoning behind changing the delays to 1000? So suffice to say, I am grateful for the submission and I will have the check the validity of the changes, but there is a lot that needs to be changed in order to incorporate it into the main branch. |
@FlorianFranzen any luck updating this pull request? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at conv/comments and resolve.
Issue
The current implementation does not allow you to trigger the sensor correctly and with as little overhead as possible.
A measurement always results in unnecessary computation followed by the actual forcing and then by a read-out of the old value, as the sensor needs at least 5.5ms to acquire even a single measurement.
Description of changes/fixes
These patches introduce the
force()
function to trigger a sensor measurement. The result can then be read out in the usual way at any later point in time (till it is triggered again). To know if the device is busy measuring or what mode it is in, it also introduces access to the state and mode register through thebusy()
andmode()
function call.It also includes a patch to support the use on none-default Wire interfaces and some minor cleanups.
All the examples were updated as well.
If necessary, I can also split the commit in separate requests.
Steps to test
busy()
or itsmode()
no longer being forced.@kvoit significantly contributed to this work.