Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #24
After further investigation, I found that because of the logic of the library, the flags of the
DR_STATUS Register
were not being cleared. Causing, the while conditionals waiting for the measure flag were not taken into consideration, as the condition was already different from 0Adafruit_CircuitPython_MPL3115A2/adafruit_mpl3115a2.py
Lines 236 to 238 in b32af7d
Depending, on the reading order, a quick survey on the register even showed data overwrite on these bits (See table 12 on the datasheet)
According to the datasheet, you need to read
OUT_P_MSB or OUT_T_MSB
. However, when we read the temperature, the flag for pressure/altitude was not cleared because we were only reading two bytes in OUT_T_MSB, so the flag inDR_STATUS Register
for pressure/altitude measurement was not cleared, causing all sort of problems downwards.Just a heads-up, the flag behaviour configuration is set up here
Adafruit_CircuitPython_MPL3115A2/adafruit_mpl3115a2.py
Lines 152 to 157 in b32af7d
Finally, I do think that it would be good to re-do the library, as at the moment we will be reading the whole altitude/pressure and temperature anyway. But is not the intention of this PR.
@caternuson could you take a look? :) Thanks.