From 6cfd48d0c629a13977527c04aeaaf2e760939672 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Tue, 3 Feb 2015 05:58:20 +0900 Subject: [PATCH] Buzzer: handle arming_failed as event --- libraries/AP_Notify/Buzzer.cpp | 16 ++++++---------- libraries/AP_Notify/Buzzer.h | 1 - 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/libraries/AP_Notify/Buzzer.cpp b/libraries/AP_Notify/Buzzer.cpp index 5db1b2f4a1..1f07757337 100644 --- a/libraries/AP_Notify/Buzzer.cpp +++ b/libraries/AP_Notify/Buzzer.cpp @@ -49,6 +49,12 @@ void Buzzer::update() return; } + // check for arming failed event + if (AP_Notify::events.arming_failed) { + // arming failed buzz + play_pattern(SINGLE_BUZZ); + } + // reduce 50hz call down to 10hz _counter++; if (_counter < 5) { @@ -192,16 +198,6 @@ void Buzzer::update() return; } - // check arming failed - if (_flags.arming_failed != AP_Notify::flags.arming_failed) { - _flags.arming_failed = AP_Notify::flags.arming_failed; - if (_flags.arming_failed) { - // arming failed buzz - play_pattern(SINGLE_BUZZ); - } - return; - } - // check gps glitch if (_flags.gps_glitching != AP_Notify::flags.gps_glitching) { _flags.gps_glitching = AP_Notify::flags.gps_glitching; diff --git a/libraries/AP_Notify/Buzzer.h b/libraries/AP_Notify/Buzzer.h index e46f1f7f68..84d94aecc0 100644 --- a/libraries/AP_Notify/Buzzer.h +++ b/libraries/AP_Notify/Buzzer.h @@ -76,7 +76,6 @@ private: uint8_t failsafe_battery : 1; // 1 if battery failsafe has triggered uint8_t failsafe_gps : 1; // 1 if gps failsafe uint8_t baro_glitching : 1; // 1 if baro alt is glitching - uint8_t arming_failed : 1; // 0 = failing checks, 1 = passed uint8_t ekf_bad : 1; // 1 if ekf position has gone bad } _flags;