-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Description
Hello,
I am new to the github, so please excuse me if this is not the right place to post this.
I noticed in lines 1729-1731, the way mx, my and mz readings are reconstructed from MSB and LSB is not correct. Unlike the Accel and Gyro which have big-endian format (MSB at lower address and LSB at higher address), magnetometer data which come from a different chip (i.e. AK8975) have little-endian format (LSB at lower address and MSB at higher address) (refer to page 53 of MPU-9150 Register Map and Descriptions Revision 3.0). Therefore these 3 lines (1729-1731) should be modified as follows:
1729 *mx = (((int16_t)buffer[1]) << 8) | buffer[0];
1730 *my = (((int16_t)buffer[3]) << 8) | buffer[2];
1731 *mz = (((int16_t)buffer[5]) << 8) | buffer[4];
Thank you,
Siavash Y
P.S. Thank you very much for the great libraries you have made and shared.