From 177148177905dc7ec074ca796dc164a46e99c752 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Wed, 3 Nov 2021 11:28:41 +0000 Subject: [PATCH] AP_Compass: never override custom orentation in calabration --- libraries/AP_Compass/AP_Compass_Calibration.cpp | 2 +- libraries/AP_Compass/CompassCalibrator.cpp | 1 + libraries/AP_Compass/CompassCalibrator.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Compass/AP_Compass_Calibration.cpp b/libraries/AP_Compass/AP_Compass_Calibration.cpp index af05912c3c..8b727bd116 100644 --- a/libraries/AP_Compass/AP_Compass_Calibration.cpp +++ b/libraries/AP_Compass/AP_Compass_Calibration.cpp @@ -207,7 +207,7 @@ bool Compass::_accept_calibration(uint8_t i) set_and_save_offdiagonals(i,offdiag); set_and_save_scale_factor(i,scale_factor); - if (_get_state(prio).external && _rotate_auto >= 2) { + if (cal_report.check_orientation && _get_state(prio).external && _rotate_auto >= 2) { set_and_save_orientation(i, cal_report.orientation); } diff --git a/libraries/AP_Compass/CompassCalibrator.cpp b/libraries/AP_Compass/CompassCalibrator.cpp index 71c3b3230a..98c8856230 100644 --- a/libraries/AP_Compass/CompassCalibrator.cpp +++ b/libraries/AP_Compass/CompassCalibrator.cpp @@ -324,6 +324,7 @@ void CompassCalibrator::update_cal_report() cal_report.orientation_confidence = _orientation_confidence; cal_report.original_orientation = _orig_orientation; cal_report.orientation = _orientation_solution; + cal_report.check_orientation = _check_orientation; } // running method for use in thread diff --git a/libraries/AP_Compass/CompassCalibrator.h b/libraries/AP_Compass/CompassCalibrator.h index 0daf0f30c3..38437f2942 100644 --- a/libraries/AP_Compass/CompassCalibrator.h +++ b/libraries/AP_Compass/CompassCalibrator.h @@ -67,6 +67,7 @@ public: Rotation original_orientation; Rotation orientation; float scale_factor; + bool check_orientation; } cal_report; // Structure setup to set calibration run settings