diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index b4dec0abaa..6f870af36c 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -331,6 +331,7 @@ private: struct { uint8_t baro : 1; // true if baro is healthy uint8_t compass : 1; // true if compass is healthy + uint8_t primary_gps; // primary gps index } sensor_health; // Motor Output diff --git a/ArduCopter/Log.cpp b/ArduCopter/Log.cpp index b6b757fcb1..4009d2c892 100644 --- a/ArduCopter/Log.cpp +++ b/ArduCopter/Log.cpp @@ -621,6 +621,12 @@ void Copter::Log_Sensor_Health() sensor_health.compass = compass.healthy(); Log_Write_Error(ERROR_SUBSYSTEM_COMPASS, (sensor_health.compass ? ERROR_CODE_ERROR_RESOLVED : ERROR_CODE_UNHEALTHY)); } + + // check primary GPS + if (sensor_health.primary_gps != gps.primary_sensor()) { + sensor_health.primary_gps = gps.primary_sensor(); + Log_Write_Event(DATA_GPS_PRIMARY_CHANGED); + } } struct PACKED log_Heli { diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index b18ba4f0fa..d71c153e08 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -393,6 +393,7 @@ enum DevOptions { #define DATA_AVOIDANCE_ADSB_DISABLE 64 #define DATA_AVOIDANCE_PROXIMITY_ENABLE 65 #define DATA_AVOIDANCE_PROXIMITY_DISABLE 66 +#define DATA_GPS_PRIMARY_CHANGED 67 // Centi-degrees to radians #define DEGX100 5729.57795f