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

Lower bits of MTreg #57

Closed
kenjif70 opened this issue Jul 15, 2019 · 5 comments
Closed

Lower bits of MTreg #57

kenjif70 opened this issue Jul 15, 2019 · 5 comments

Comments

@kenjif70
Copy link

__wire_write((0b011 << 5 ) | (MTreg & 0b111));

Shouldn't we keep 5 bits rather than 3 bits?

@claws
Copy link
Owner

claws commented Jul 29, 2019

I think you are correct. Do you want to submit a pull request?

@kenjif70
Copy link
Author

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.

@claws
Copy link
Owner

claws commented Jul 29, 2019

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?

@kenjif70
Copy link
Author

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 = ONE_SHOT_. setMTreg has delay_ms when the mode is CONTINUOUS but not ONE_SHOT_, and this inconsistent behavior doesn't happen in CONTINUOUS_ modes.

@claws
Copy link
Owner

claws commented Jul 29, 2019

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.

@claws claws closed this as completed Jul 29, 2019
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

No branches or pull requests

2 participants