Bug: returning magnetometer values in wrong order | Fixed incorrect return order in _raw_magnetic. #16
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.
Hi,
Just noticed the values that are being returned from
_raw_magnetic
function are in wrong order:Adafruit_CircuitPython_LSM303DLH_Mag/adafruit_lsm303dlh_mag.py
Line 142 in 6d2fec3
According to the datasheet of LSM303DLH, the register
0x03-0x04
is for X channel,0x05-0x06
for Y channel and0x07-0x08
for Z channel.The address of the registers Y and Z are also interchanged in the declaration, which could have given the correct output, but it looks like the library is fetching readings from all 6 registers simultaneously and not though the defined addresses in line 51 to 54:
Adafruit_CircuitPython_LSM303DLH_Mag/adafruit_lsm303dlh_mag.py
Line 140 in 6d2fec3
Adafruit_CircuitPython_LSM303DLH_Mag/adafruit_lsm303dlh_mag.py
Lines 49 to 54 in 6d2fec3
Hence while returning it is returning in order X,Z,Y.