From c04b31d9c094d118c55effb96432e1370b2b16d3 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Sun, 26 Apr 2020 08:12:10 +1000 Subject: [PATCH] AP_NavEKF3: Don't use geomag data when user specifies declination --- libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp b/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp index bd694fbae1..b6ae6e96cc 100644 --- a/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp +++ b/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp @@ -609,7 +609,7 @@ void NavEKF3_core::readGpsData() if (gpsGoodToAlign && !have_table_earth_field) { const Compass *compass = _ahrs->get_compass(); - if (compass && compass->have_scale_factor(magSelectIndex)) { + if (compass && compass->have_scale_factor(magSelectIndex) && compass->auto_declination_enabled()) { table_earth_field_ga = AP_Declination::get_earth_field_ga(gpsloc); table_declination = radians(AP_Declination::get_declination(gpsloc.lat*1.0e-7, gpsloc.lng*1.0e-7));