@ -103,7 +103,6 @@
@@ -103,7 +103,6 @@
#include <GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager.h> // Serial manager library
#include <AP_GPS.h> // ArduPilot GPS library
#include <AP_GPS_Glitch.h> // GPS glitch protection library
#include <DataFlash.h> // ArduPilot Mega Flash Memory Library
#include <AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource.h>
@ -257,8 +256,6 @@ static const AP_InertialSensor::Sample_rate ins_sample_rate = AP_InertialSensor:
@@ -257,8 +256,6 @@ static const AP_InertialSensor::Sample_rate ins_sample_rate = AP_InertialSensor:
static AP_GPS gps;
static GPS_Glitch gps_glitch(gps);
// flight modes convenience array
static AP_Int8 *flight_modes = &g.flight_mode1;
@ -408,7 +405,6 @@ static struct {
@@ -408,7 +405,6 @@ static struct {
uint8_t rc_override_active : 1; // 0 // true if rc control are overwritten by ground station
uint8_t radio : 1; // 1 // A status flag for the radio failsafe
uint8_t battery : 1; // 2 // A status flag for the battery failsafe
uint8_t gps : 1; // 3 // A status flag for the gps failsafe
uint8_t gcs : 1; // 4 // A status flag for the ground station failsafe
uint8_t ekf : 1; // 5 // true if ekf failsafe has occurred
@ -602,7 +598,7 @@ static float G_Dt = 0.02;
@@ -602,7 +598,7 @@ static float G_Dt = 0.02;
////////////////////////////////////////////////////////////////////////////////
// Inertial Navigation
////////////////////////////////////////////////////////////////////////////////
static AP_InertialNav_NavEKF inertial_nav(ahrs, barometer, gps_glitch );
static AP_InertialNav_NavEKF inertial_nav(ahrs);
////////////////////////////////////////////////////////////////////////////////
// Attitude, Position and Waypoint navigation objects
@ -1175,12 +1171,11 @@ static void one_hz_loop()
@@ -1175,12 +1171,11 @@ static void one_hz_loop()
static void update_GPS(void)
{
static uint32_t last_gps_reading[GPS_MAX_INSTANCES]; // time of last gps message
bool report_gps_glitch;
bool gps_updated = false;
gps.update();
// logging and glitch protection run after every gps message
// log after every gps message
for (uint8_t i=0; i<gps.num_sensors(); i++) {
if (gps.last_message_time_ms(i) != last_gps_reading[i]) {
last_gps_reading[i] = gps.last_message_time_ms(i);
@ -1195,20 +1190,6 @@ static void update_GPS(void)
@@ -1195,20 +1190,6 @@ static void update_GPS(void)
}
if (gps_updated) {
// run glitch protection and update AP_Notify if home has been initialised
if (home_is_set()) {
gps_glitch.check_position();
report_gps_glitch = (gps_glitch.glitching() && !ap.usb_connected && hal.util->safety_switch_state() != AP_HAL::Util::SAFETY_DISARMED);
if (AP_Notify::flags.gps_glitching != report_gps_glitch) {
if (gps_glitch.glitching()) {
Log_Write_Error(ERROR_SUBSYSTEM_GPS, ERROR_CODE_GPS_GLITCH);
}else{
Log_Write_Error(ERROR_SUBSYSTEM_GPS, ERROR_CODE_ERROR_RESOLVED);
}
AP_Notify::flags.gps_glitching = report_gps_glitch;
}
}
// set system time if necessary
set_system_time_from_GPS();
@ -1228,9 +1209,6 @@ static void update_GPS(void)
@@ -1228,9 +1209,6 @@ static void update_GPS(void)
#endif
}
}
// check for loss of gps
failsafe_gps_check();
}
static void