Skip to content

Conversation

Raelx
Copy link
Contributor

@Raelx Raelx commented Sep 20, 2023

Bit math is not my strong suit but this was not working as it was and after a lot of digging it seems like the math for combining the LSS and MSB bytes in the X/Y/Z/angle functions was bad.

Also it seems that the readRegister function was reading two bytes even though it was always using only the first. Changed this to only read one byte.

Changed "readRegister" to only read one byte, not two
Fixed bad LBS MBS combination math in "getXData", "getYData", "getZData" and "getAngelResult"
Changed "readRegister" to only read one byte, not two
Fixed bad LSB MSB combination math in "getXData", "getYData", "getZData" and "getAngleResult"
@MadisonC-SparkFun MadisonC-SparkFun self-assigned this Sep 26, 2023
@MadisonC-SparkFun
Copy link
Contributor

Hi Raelx,

As for the comment/change in the code for the readRegister(uint8_t regAddress) function, we will not be changing that function due to the fact that there is another option to choose the number of bytes to be read called readRegisters(uint8_t regAddress, uint8_t *dataBuffer, uint8_t numBytes).

As for the bitwise math, that has been tested accordingly and will be changed in the latest release of the repo.

Thank you for your contributions!

@MadisonC-SparkFun MadisonC-SparkFun merged commit 0014034 into sparkfun:main Sep 26, 2023
@ws998116
Copy link

Hi, I am also experiencing the inconsistent readings mentioned in issue #2. This fix helps, but release v1.0.2 doesn't seem to be available on Arduino IDE or PlatformIO.

@MadisonC-SparkFun
Copy link
Contributor

Hi @ws998116 , thanks for letting us know! I'll check that out now and get that corrected. 👍

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