Copter: log event when primary GPS changes

This commit is contained in:
Randy Mackay 2017-03-09 09:16:25 +09:00
parent b30d743812
commit 8140353c64
3 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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