Skip to content

Commit

Permalink
[mag] fix typo and rotations (#3109)
Browse files Browse the repository at this point in the history
- fix typo in ist8310 driver
- add rotation option to lis3mdl driver (for old style calibration)
  • Loading branch information
gautierhattenberger committed Sep 26, 2023
1 parent dd7b07a commit 76a9415
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sw/airborne/modules/sensors/mag_ist8310.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void mag_ist8310_module_init(void)
};
int32_rmat_of_eulers(&mag_to_imu, &mag_to_imu_eulers);

imu_set_defaults_mag(MAG_IST8310_SENDER_ID, &mag_to_imu, NULL, NULL)
imu_set_defaults_mag(MAG_IST8310_SENDER_ID, &mag_to_imu, NULL, NULL);
#endif
}

Expand Down
12 changes: 12 additions & 0 deletions sw/airborne/modules/sensors/mag_lis3mdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ void mag_lis3mdl_module_init(void)
LIS3MDL_SCALE_4_GAUSS,
LIS3MDL_MODE_CONTINUOUS,
LIS3MDL_PERFORMANCE_ULTRA_HIGH);

#if MODULE_LIS3MDL_UPDATE_AHRS && defined(LIS3MDL_MAG_TO_IMU_PHI) && defined(LIS3MDL_MAG_TO_IMU_THETA) && defined(LIS3MDL_MAG_TO_IMU_PSI)
struct Int32RMat mag_to_imu;
struct Int32Eulers mag_to_imu_eulers = {
ANGLE_BFP_OF_REAL(LIS3MDL_MAG_TO_IMU_PHI),
ANGLE_BFP_OF_REAL(LIS3MDL_MAG_TO_IMU_THETA),
ANGLE_BFP_OF_REAL(LIS3MDL_MAG_TO_IMU_PSI)
};
int32_rmat_of_eulers(&mag_to_imu, &mag_to_imu_eulers);

imu_set_defaults_mag(MAG_LIS3MDL_SENDER_ID, &mag_to_imu, NULL, NULL);
#endif
}

void mag_lis3mdl_module_periodic(void)
Expand Down

0 comments on commit 76a9415

Please sign in to comment.