diff --git a/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp b/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp index 9ebe777515a84..794c88c66503a 100644 --- a/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp +++ b/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp @@ -294,8 +294,12 @@ void NavEKF3_core::readMagData() return; } - if (compass.learn_offsets_enabled()) { - // while learning offsets keep all mag states reset + if (compass.learn_offsets_enabled() && + frontend->sources.getYawSource() != AP_NavEKF_Source::SourceYaw::GPS_COMPASS_FALLBACK) { + /* + while learning offsets keep all mag states reset + note that compass learning is ignored with GPS with compass fallback + */ InitialiseVariablesMag(); wasLearningCompass_ms = imuSampleTime_ms; } else if (wasLearningCompass_ms != 0 && imuSampleTime_ms - wasLearningCompass_ms > 1000) {