Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

FlorianFranzen
Copy link

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 the busy() and mode() 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

  • Configure sensor in forced mode.
  • Read measurements continuously and see that values do not change
  • Force a measurement
  • Wait till the sensor is no longer busy() or its mode() no longer being forced.
  • Retrieve new measurement.

@kvoit significantly contributed to this work.

@FlorianFranzen FlorianFranzen changed the title Patches Correct implementation of forced measurements Jul 19, 2018
@finitespace
Copy link
Owner

@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.

@finitespace
Copy link
Owner

@FlorianFranzen any luck updating this pull request?

Copy link
Owner

@finitespace finitespace left a 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.

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

Successfully merging this pull request may close these issues.

None yet

2 participants