From 2a5e9f76ac175320c636501f4a694388c791de0a Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 10 May 2022 11:28:33 +1000 Subject: [PATCH] AP_Compass: do not use GSF if any model has been clipped --- libraries/AP_Compass/Compass_learn.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Compass/Compass_learn.cpp b/libraries/AP_Compass/Compass_learn.cpp index a9b3e9683c..4ccda4f3be 100644 --- a/libraries/AP_Compass/Compass_learn.cpp +++ b/libraries/AP_Compass/Compass_learn.cpp @@ -51,8 +51,10 @@ void CompassLearn::update(void) AP_Notify::flags.compass_cal_running = true; ftype yaw_rad, yaw_variance; - if (!gsf->getYawData(yaw_rad, yaw_variance) || + uint8_t n_clips; + if (!gsf->getYawData(yaw_rad, yaw_variance, &n_clips) || !is_positive(yaw_variance) || + n_clips > 1 || yaw_variance >= sq(radians(YAW_ACCURACY_THRESHOLD_DEG))) { // not converged return;