mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Problem: _mag_device_id is used to get the correct rotation matrix for each mag. But on POSIX, _mag_device_id was always 0, leading to invalid rotation matrices. This resulted in stale mag error messages (rot matrix=0 ==> mag data=0). _mag_device_id was 0 because there are no /dev/magX devices (eg. on RPi), thus the mag driver could not be opened. This patch does: get the device id from the uorb topic instead. We still need the device handle on certain platforms to apply the calibration params and to check if the mag is internal or external. Problem left: on POSIX, the check for external mag does not work.