Copter: adsb handling simply logs error to dataflash

This commit is contained in:
Randy Mackay 2015-11-27 13:54:00 +09:00
parent 4ef53427f2
commit e6f8d812d3
2 changed files with 16 additions and 0 deletions

View File

@ -42,6 +42,21 @@ void Copter::adsb_update(void)
*/
void Copter::adsb_handle_vehicle_threats(void)
{
// handle clearing of threat
if (adsb.get_is_evading_threat() && !adsb.get_another_vehicle_within_radius()) {
adsb.set_is_evading_threat(false);
Log_Write_Error(ERROR_SUBSYSTEM_FAILSAFE_ADSB, ERROR_CODE_FAILSAFE_RESOLVED);
gcs_send_text(MAV_SEVERITY_CRITICAL, "ADS-B threat cleared");
return;
}
// handle new threat
if (!adsb.get_is_evading_threat() && adsb.get_another_vehicle_within_radius()) {
adsb.set_is_evading_threat(true);
Log_Write_Error(ERROR_SUBSYSTEM_FAILSAFE_ADSB, ERROR_CODE_FAILSAFE_OCCURRED);
gcs_send_text(MAV_SEVERITY_CRITICAL, "ADS-B threat!");
return;
}
}
#endif // #ADSB_ENABLED

View File

@ -352,6 +352,7 @@ enum FlipState {
#define ERROR_SUBSYSTEM_FAILSAFE_EKFINAV 17
#define ERROR_SUBSYSTEM_BARO 18
#define ERROR_SUBSYSTEM_CPU 19
#define ERROR_SUBSYSTEM_FAILSAFE_ADSB 20
// general error codes
#define ERROR_CODE_ERROR_RESOLVED 0
#define ERROR_CODE_FAILED_TO_INITIALISE 1