-
Notifications
You must be signed in to change notification settings - Fork 108
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
Frequent calls to readLightLevel prevents measurement update #61
Comments
No, that looks like a bug. Lines 220 to 224 in 0643631
We should check for continuous mode and do not reconfigure the sensor. |
Can you replace it accordingly with the following and test it?
|
coelner
pushed a commit
to coelner/BH1750
that referenced
this issue
Aug 14, 2020
Merged
coelner
pushed a commit
to coelner/BH1750
that referenced
this issue
Sep 24, 2020
Closed
coelner
pushed a commit
to coelner/BH1750
that referenced
this issue
Oct 13, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that in CONTINUOUS modes, frequent calls to readLightLevel prevents the bh1750 module to actually update the measurement. Presumably, the measurement is interrupted by the i2c communication and has to be restarted.
Thus, if I (say) set
lightMeter.configure(BH1750::CONTINUOUS_HIGH_RES_MODE);
and then call readLightLevel with only 100 (or even 120) millis delays, then I keep getting the same value back.
If I increase to, say, 180 millis (max time to make measurement) ,then I get an updated value every time.
If there already is a caveat about this usage, then I apologize for reporting.
I do not see an easy way to circumvent this, except storing (in the object) the previous measurement and time-of-measurement, and not then checking time vs previous time-of-measurement to see if an updated measurement should be ready.
Obviosly, I can avoid the problem by not calling
readLightLevel()
often. I was just surprised by the effect, and want to report it.Best,
/Bjarne
The text was updated successfully, but these errors were encountered: