There's a bug in the Sensorlib code (Rev 2.1.0.12573) that manages the tMPU9150 struct (in MPU9150.c: MPU9150Write; also in MPU6050.c: MPU6050Write). The error incorrectly indexes data structures if the accelerometer or gyro scales are not set to "0" (most sensitive), so subsequent floating point scaling of the sensor data will be in error.
The error has been there at least since Rev 1.0 (my earliest revision). Basically, the pui8Data[] index is MPU9150_O_*** - ui8Reg, but should be reversed, as anything but "0" is negative.
The diff code is:
@@ -678,7 +678,7 @@ MPU9150Write(tMPU9150 *psInst, uint_fast8_t ui8Reg, const uint8_t *pui8Data, // // See if a soft reset is being requested. // - if(pui8Data[MPU9150_O_PWR_MGMT_1 - ui8Reg] & + if(pui8Data[ui8Reg - MPU9150_O_PWR_MGMT_1] &^M MPU9150_PWR_MGMT_1_DEVICE_RESET) { // @@ -702,7 +702,7 @@ MPU9150Write(tMPU9150 *psInst, uint_fast8_t ui8Reg, const uint8_t *pui8Data, // // Extract the FS_SEL from the GYRO_CONFIG register value. // - psInst->ui8NewGyroFsSel = ((pui8Data[MPU9150_O_GYRO_CONFIG - ui8Reg] & + psInst->ui8NewGyroFsSel = ((pui8Data[ui8Reg - MPU9150_O_GYRO_CONFIG] &^M MPU9150_GYRO_CONFIG_FS_SEL_M) >> MPU9150_GYRO_CONFIG_FS_SEL_S); } @@ -717,7 +717,7 @@ MPU9150Write(tMPU9150 *psInst, uint_fast8_t ui8Reg, const uint8_t *pui8Data, // Extract the AFS_SEL from the ACCEL_CONFIG register value. // psInst->ui8NewAccelAfsSel = - ((pui8Data[MPU9150_O_ACCEL_CONFIG - ui8Reg] & + ((pui8Data[ui8Reg - MPU9150_O_ACCEL_CONFIG] &^M MPU9150_ACCEL_CONFIG_AFS_SEL_M) >> MPU9150_ACCEL_CONFIG_AFS_SEL_S); }
Cheers,
Doug