GCS_Mavlink: allow setting of AHRS_TRIM_Z

This commit is contained in:
Andrew Tridgell 2021-08-17 12:52:16 +10:00
parent 3715ce6d1a
commit 5dcfa95444
1 changed files with 3 additions and 3 deletions

View File

@ -3776,12 +3776,12 @@ MAV_RESULT GCS_MAVLINK::_handle_command_preflight_calibration(const mavlink_comm
if (!calibrate_gyros()) {
return MAV_RESULT_FAILED;
}
float trim_roll, trim_pitch;
if (!AP::ins().calibrate_trim(trim_roll, trim_pitch)) {
Vector3f trim_rad = AP::ahrs().get_trim();
if (!AP::ins().calibrate_trim(trim_rad)) {
return MAV_RESULT_FAILED;
}
// reset ahrs's trim to suggested values from calibration routine
AP::ahrs().set_trim(Vector3f(trim_roll, trim_pitch, 0));
AP::ahrs().set_trim(trim_rad);
return MAV_RESULT_ACCEPTED;
}