mirror of https://github.com/ArduPilot/ardupilot
Copter: log compass failur to dataflash
This commit is contained in:
parent
55235630b6
commit
bb7aec2600
|
@ -112,9 +112,13 @@ void set_land_complete(bool b)
|
|||
|
||||
void set_compass_healthy(bool b)
|
||||
{
|
||||
if(ap.compass_status != b){
|
||||
if(false == b){
|
||||
Log_Write_Event(DATA_LOST_COMPASS);
|
||||
if(ap.compass_status != b) {
|
||||
if(b) {
|
||||
// compass has just recovered so log to the dataflash
|
||||
Log_Write_Error(ERROR_SUBSYSTEM_COMPASS,ERROR_CODE_ERROR_RESOLVED);
|
||||
}else{
|
||||
// compass has just failed so log an error to the dataflash
|
||||
Log_Write_Error(ERROR_SUBSYSTEM_COMPASS,ERROR_CODE_COMPASS_FAILED_TO_READ);
|
||||
}
|
||||
}
|
||||
ap.compass_status = b;
|
||||
|
|
|
@ -320,7 +320,6 @@ enum ap_message {
|
|||
#define DATA_DID_REACH_ALT 17
|
||||
#define DATA_LAND_COMPLETE 18
|
||||
#define DATA_LOST_GPS 19
|
||||
#define DATA_LOST_COMPASS 20
|
||||
#define DATA_BEGIN_FLIP 21
|
||||
#define DATA_END_FLIP 22
|
||||
#define DATA_EXIT_FLIP 23
|
||||
|
@ -442,6 +441,8 @@ enum ap_message {
|
|||
// subsystem specific error codes -- failsafe_thr, batt, gps
|
||||
#define ERROR_CODE_FAILSAFE_RESOLVED 0
|
||||
#define ERROR_CODE_FAILSAFE_OCCURRED 1
|
||||
// subsystem specific error codes -- compass
|
||||
#define ERROR_CODE_COMPASS_FAILED_TO_READ 2
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue