mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
REVONANO mpu9250 driver fix for Mag orientation
This commit is contained in:
parent
3651ac61a3
commit
f82a584eb2
@ -900,6 +900,10 @@ static bool PIOS_MPU9250_HandleData()
|
|||||||
#endif
|
#endif
|
||||||
data.gyro_y = GET_SENSOR_DATA(mpu9250_data, Gyro_X); // chip X
|
data.gyro_y = GET_SENSOR_DATA(mpu9250_data, Gyro_X); // chip X
|
||||||
data.gyro_x = GET_SENSOR_DATA(mpu9250_data, Gyro_Y); // chip Y
|
data.gyro_x = GET_SENSOR_DATA(mpu9250_data, Gyro_Y); // chip Y
|
||||||
|
#ifdef PIOS_MPU9250_MAG
|
||||||
|
data.mag_y = GET_SENSOR_DATA(mpu9250_data, Mag_X); // chip X
|
||||||
|
data.mag_x = GET_SENSOR_DATA(mpu9250_data, Mag_Y); // chip Y
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case PIOS_MPU9250_TOP_90DEG:
|
case PIOS_MPU9250_TOP_90DEG:
|
||||||
// -1 to bring it back to -32768 +32767 range
|
// -1 to bring it back to -32768 +32767 range
|
||||||
@ -909,6 +913,10 @@ static bool PIOS_MPU9250_HandleData()
|
|||||||
#endif
|
#endif
|
||||||
data.gyro_y = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_Y)); // chip Y
|
data.gyro_y = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_Y)); // chip Y
|
||||||
data.gyro_x = GET_SENSOR_DATA(mpu9250_data, Gyro_X); // chip X
|
data.gyro_x = GET_SENSOR_DATA(mpu9250_data, Gyro_X); // chip X
|
||||||
|
#ifdef PIOS_MPU9250_MAG
|
||||||
|
data.mag_y = -1 - (GET_SENSOR_DATA(mpu9250_data, Mag_Y)); // chip Y
|
||||||
|
data.mag_x = GET_SENSOR_DATA(mpu9250_data, Mag_X); // chip X
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case PIOS_MPU9250_TOP_180DEG:
|
case PIOS_MPU9250_TOP_180DEG:
|
||||||
#ifdef PIOS_MPU9250_ACCEL
|
#ifdef PIOS_MPU9250_ACCEL
|
||||||
@ -917,6 +925,10 @@ static bool PIOS_MPU9250_HandleData()
|
|||||||
#endif
|
#endif
|
||||||
data.gyro_y = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_X)); // chip X
|
data.gyro_y = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_X)); // chip X
|
||||||
data.gyro_x = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_Y)); // chip Y
|
data.gyro_x = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_Y)); // chip Y
|
||||||
|
#ifdef PIOS_MPU9250_MAG
|
||||||
|
data.mag_y = -1 - (GET_SENSOR_DATA(mpu9250_data, Mag_X)); // chip X
|
||||||
|
data.mag_x = -1 - (GET_SENSOR_DATA(mpu9250_data, Mag_Y)); // chip Y
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case PIOS_MPU9250_TOP_270DEG:
|
case PIOS_MPU9250_TOP_270DEG:
|
||||||
#ifdef PIOS_MPU9250_ACCEL
|
#ifdef PIOS_MPU9250_ACCEL
|
||||||
@ -925,6 +937,10 @@ static bool PIOS_MPU9250_HandleData()
|
|||||||
#endif
|
#endif
|
||||||
data.gyro_y = GET_SENSOR_DATA(mpu9250_data, Gyro_Y); // chip Y
|
data.gyro_y = GET_SENSOR_DATA(mpu9250_data, Gyro_Y); // chip Y
|
||||||
data.gyro_x = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_X)); // chip X
|
data.gyro_x = -1 - (GET_SENSOR_DATA(mpu9250_data, Gyro_X)); // chip X
|
||||||
|
#ifdef PIOS_MPU9250_MAG
|
||||||
|
data.mag_y = GET_SENSOR_DATA(mpu9250_data, Mag_Y); // chip Y
|
||||||
|
data.mag_x = -1 - (GET_SENSOR_DATA(mpu9250_data, Mag_X)); // chip X
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef PIOS_MPU9250_ACCEL
|
#ifdef PIOS_MPU9250_ACCEL
|
||||||
@ -934,8 +950,6 @@ static bool PIOS_MPU9250_HandleData()
|
|||||||
data.temperature = GET_SENSOR_DATA(mpu9250_data, Temperature);
|
data.temperature = GET_SENSOR_DATA(mpu9250_data, Temperature);
|
||||||
|
|
||||||
#ifdef PIOS_MPU9250_MAG
|
#ifdef PIOS_MPU9250_MAG
|
||||||
data.mag_y = GET_SENSOR_DATA(mpu9250_data, Mag_X); // chip X
|
|
||||||
data.mag_x = GET_SENSOR_DATA(mpu9250_data, Mag_Y); // chip Y
|
|
||||||
data.mag_z = GET_SENSOR_DATA(mpu9250_data, Mag_Z); // chip Z
|
data.mag_z = GET_SENSOR_DATA(mpu9250_data, Mag_Z); // chip Z
|
||||||
data.mag_valid = mpu9250_data.data.st1 & PIOS_MPU9250_MAG_DATA_RDY;
|
data.mag_valid = mpu9250_data.data.st1 & PIOS_MPU9250_MAG_DATA_RDY;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user