Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: getRegister and bit-masks #7

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

Closed
wants to merge 4 commits into from

Conversation

TheRealWaldo
Copy link

getRegister was always reading 2 bytes even if 1 was requested, causing most methods to fail.

Further, only the signing bit was masked out on temperature reads, leaving 4 random bits of data in values, causing havoc at high/low readings.

Original logic would only mask out the sign bit, but leave 4 bits of random data in
place.  This masks out all 5 bits.
@galed3e3
Copy link

There's also this drop-in replacement for getRegister:
#3 (comment)

@PaulZC
Copy link
Contributor

PaulZC commented Oct 19, 2022

Hi Will (@TheRealWaldo ),

Thank you for the fix. And apologies for the VERY slow reply!

I've added a slightly different fix in v1.0.2 - which will be released shortly. I went with getRegister8 and getRegister16 as suggested by @Koepel. The 12-bit signed corrections are in there too.

I'm going to close this - but will also give you a mention in the v1.0.2 release notes. Your PR would have worked perfectly - I just did the same thing a different way...

Very best wishes,
Paul

@PaulZC PaulZC closed this Oct 19, 2022
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.

3 participants