diff --git a/libraries/AP_Notify/AP_Notify.h b/libraries/AP_Notify/AP_Notify.h index 2ff2bd1273..f302d55856 100644 --- a/libraries/AP_Notify/AP_Notify.h +++ b/libraries/AP_Notify/AP_Notify.h @@ -72,6 +72,7 @@ public: // additional flags uint32_t external_leds : 1; // 1 if external LEDs are enabled (normally only used for copter) + uint32_t lost_copter : 1; // 1 when lost copter tone is requested (normally only used for copter) }; /// notify_events_type - bitmask of active events. diff --git a/libraries/AP_Notify/ToneAlarm_PX4.cpp b/libraries/AP_Notify/ToneAlarm_PX4.cpp index 2e2b96311c..e7d9031b92 100644 --- a/libraries/AP_Notify/ToneAlarm_PX4.cpp +++ b/libraries/AP_Notify/ToneAlarm_PX4.cpp @@ -230,6 +230,17 @@ void ToneAlarm_PX4::update() play_tone(AP_NOTIFY_PX4_TONE_LOUD_ATTENTION_NEEDED); } } + + + if (flags.lost_copter != AP_Notify::flags.lost_copter) { + flags.lost_copter = AP_Notify::flags.lost_copter; + if(flags.lost_copter) { + play_tone(AP_NOTIFY_PX4_TONE_LOUD_LOST_COPTER_CTS); + }else{ + stop_cont_tone(); + } + } + } #endif // CONFIG_HAL_BOARD == HAL_BOARD_PX4 diff --git a/libraries/AP_Notify/ToneAlarm_PX4.h b/libraries/AP_Notify/ToneAlarm_PX4.h index 96bb8bd0cb..43887a53c3 100644 --- a/libraries/AP_Notify/ToneAlarm_PX4.h +++ b/libraries/AP_Notify/ToneAlarm_PX4.h @@ -54,6 +54,7 @@ private: uint8_t parachute_release : 1; // 1 if parachute is being released uint8_t pre_arm_check : 1; // 0 = failing checks, 1 = passed uint8_t failsafe_radio : 1; // 1 if radio failsafe + uint8_t lost_copter : 1; // 1 if lost copter tone requested } flags; int8_t _cont_tone_playing;