Copter: log compass failur to dataflash

This commit is contained in:
Randy Mackay 2013-05-13 18:01:30 +09:00
parent 55235630b6
commit bb7aec2600
2 changed files with 9 additions and 4 deletions

View File

@ -113,8 +113,12 @@ 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(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;

View File

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