Browse Source

PX4Magnetometer implement MAGIOCGSCALE (copy out scale)

- fixes #12193
sbg
Daniel Agar 6 years ago committed by GitHub
parent
commit
55c9786157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/lib/drivers/magnetometer/PX4Magnetometer.cpp

14
src/lib/drivers/magnetometer/PX4Magnetometer.cpp

@ -72,6 +72,20 @@ int PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg) @@ -72,6 +72,20 @@ int PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
return PX4_OK;
case MAGIOCGSCALE: {
// copy out scale factors
mag_calibration_s cal{};
cal.x_offset = _calibration_offset(0);
cal.y_offset = _calibration_offset(1);
cal.z_offset = _calibration_offset(2);
cal.x_scale = _calibration_scale(0);
cal.y_scale = _calibration_scale(1);
cal.z_scale = _calibration_scale(2);
memcpy((mag_calibration_s *)arg, &cal, sizeof(cal));
}
return 0;
case DEVIOCGDEVICEID:
return _sensor_mag_pub.get().device_id;

Loading…
Cancel
Save