Closed kenjif70 closed 4 years ago
I think you are correct. Do you want to submit a pull request?
Thanks for the comment. Yup, I can do that if you prefer. But I've not set up the repo/branch yet, so I'm perfectly fine/happy if you could make the change on behalf of me.
Do you have a use case that can test the change? If so can you test the change in the merge request (#58) branch I just raised to apply the fix?
Cool! I just confirmed that, with the fix, readLightLevel gives a consistent value regardless of the sensitivity. Before the fix, MTreg=39 and MTreg=63 give very different numbers, for example.
By the way, another thing I realized while testing is that readLightLevel returns an inconsistent number if it's called right after calling setMTreg with the mode = ONESHOT. setMTreg has _delayms when the mode is CONTINUOUS but not ONESHOT, and this inconsistent behavior doesn't happen in CONTINUOUS_ modes.
Thanks for catching this issue. I've merged #58 which provides the fix and raised another issue (#59) to capture the last issue you observed.
https://github.com/claws/BH1750/blob/a49b08550a8f46d3c7672a3774103cd01dc8186b/BH1750.cpp#L156
Shouldn't we keep 5 bits rather than 3 bits?