From 54cb815fece6792f9a1c8ccc503689aba8de493b Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 23 Sep 2013 17:04:08 +0900 Subject: [PATCH] AP_Notify: add gps glitching and failsafe flags --- libraries/AP_Notify/ToneAlarm_PX4.cpp | 18 ++++++++++++++++++ libraries/AP_Notify/ToneAlarm_PX4.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/libraries/AP_Notify/ToneAlarm_PX4.cpp b/libraries/AP_Notify/ToneAlarm_PX4.cpp index 1172d4703f..4deaadf57c 100644 --- a/libraries/AP_Notify/ToneAlarm_PX4.cpp +++ b/libraries/AP_Notify/ToneAlarm_PX4.cpp @@ -85,6 +85,24 @@ void ToneAlarm_PX4::update() play_tune(TONE_BATTERY_WARNING_FAST_TUNE); } } + + // check gps glitch + if (flags.gps_glitching != AP_Notify::flags.gps_glitching) { + flags.gps_glitching = AP_Notify::flags.gps_glitching; + if (flags.gps_glitching) { + // gps glitch warning tune + play_tune(TONE_GPS_WARNING_TUNE); + } + } + + // check gps failsafe + if (flags.failsafe_gps != AP_Notify::flags.failsafe_gps) { + flags.failsafe_gps = AP_Notify::flags.failsafe_gps; + if (flags.failsafe_gps) { + // gps glitch warning tune + play_tune(TONE_GPS_WARNING_TUNE); + } + } } #endif // CONFIG_HAL_BOARD == HAL_BOARD_PX4 diff --git a/libraries/AP_Notify/ToneAlarm_PX4.h b/libraries/AP_Notify/ToneAlarm_PX4.h index 239a27aac0..690597c3d8 100644 --- a/libraries/AP_Notify/ToneAlarm_PX4.h +++ b/libraries/AP_Notify/ToneAlarm_PX4.h @@ -39,6 +39,8 @@ private: struct tonealarm_type { uint8_t armed : 1; // 0 = disarmed, 1 = armed uint8_t failsafe_battery : 1; // 1 if battery failsafe + uint8_t gps_glitching : 1; // 1 if gps position is not good + uint8_t failsafe_gps : 1; // 1 if gps failsafe } flags; };