ArduCopter: Changed implementation of configuration value for automatic declination. There is now a FORCE_AUTOMATIC_DECLINATION_UPDATE that when enabled will update the declination on every GPS 3D fix regardless of whether or not the user saved a value to the EEPROM. By default the declination will only be set by the automatic declination routine if the user has not saved a declination to the EEPROM.

This commit is contained in:
Adam M Rivera 2012-03-29 14:42:18 -05:00 committed by Andrew Tridgell
parent 380b9ece44
commit 0727955fe3
2 changed files with 3 additions and 8 deletions

View File

@ -95,10 +95,7 @@ http://code.google.com/p/ardupilot-mega/downloads/list
#include "Parameters.h"
#include "GCS.h"
#if AUTOMATIC_DECLINATION == ENABLED
// this is in an #if to avoid the static data
#include <AP_Declination.h> // ArduPilot Mega Declination Helper Library
#endif
////////////////////////////////////////////////////////////////////////////////
// Serial ports
@ -1381,12 +1378,10 @@ static void update_GPS(void)
ground_start_count = 5;
}else{
#if AUTOMATIC_DECLINATION == ENABLED
if(g.compass_enabled) {
// Set compass declination automatically
compass.set_initial_location(g_gps->latitude, g_gps->longitude, false);
compass.set_initial_location(g_gps->latitude, g_gps->longitude, (FORCE_AUTOMATIC_DECLINATION_UPDATE == ENABLED));
}
#endif
// save home to eeprom (we must have a good fix to have reached this point)
init_home();
ground_start_count = 0;

View File

@ -425,8 +425,8 @@
# define GROUND_START_DELAY 3
#endif
#ifndef AUTOMATIC_DECLINATION
#define AUTOMATIC_DECLINATION DISABLED
#ifndef FORCE_AUTOMATIC_DECLINATION_UPDATE
#define FORCE_AUTOMATIC_DECLINATION_UPDATE DISABLED
#endif