mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
AP_NavEKF3: don't use WMM tables unless we have a compass scale factor set
This commit is contained in:
parent
eefa16887b
commit
c7a39648d4
@ -608,13 +608,16 @@ void NavEKF3_core::readGpsData()
|
||||
}
|
||||
|
||||
if (gpsGoodToAlign && !have_table_earth_field) {
|
||||
table_earth_field_ga = AP_Declination::get_earth_field_ga(gpsloc);
|
||||
table_declination = radians(AP_Declination::get_declination(gpsloc.lat*1.0e-7,
|
||||
const Compass *compass = _ahrs->get_compass();
|
||||
if (compass && compass->have_scale_factor(magSelectIndex)) {
|
||||
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));
|
||||
have_table_earth_field = true;
|
||||
if (frontend->_mag_ef_limit > 0) {
|
||||
// initialise earth field from tables
|
||||
stateStruct.earth_magfield = table_earth_field_ga;
|
||||
have_table_earth_field = true;
|
||||
if (frontend->_mag_ef_limit > 0) {
|
||||
// initialise earth field from tables
|
||||
stateStruct.earth_magfield = table_earth_field_ga;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user