aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2015-01-15 11:40:40 +0100
committerThomas Gubler <thomasgubler@gmail.com>2015-01-15 11:40:40 +0100
commite62bd37e73139c77f0d60cd91fe3443ed23df074 (patch)
treeff451341a51a5c51356e719f8060afefbbe078fc
parent78b603bb3532e927e617fe1946a1090b509e72ad (diff)
parentddf65bae049fe4e4b053dc0b53fd6fe840a92aea (diff)
downloadpx4-firmware-e62bd37e73139c77f0d60cd91fe3443ed23df074.tar.gz
px4-firmware-e62bd37e73139c77f0d60cd91fe3443ed23df074.tar.bz2
px4-firmware-e62bd37e73139c77f0d60cd91fe3443ed23df074.zip
Merge pull request #1652 from Zefz/arming_notifications
Commander: Play tune on disarm and when safety switch is toggled
-rw-r--r--src/modules/commander/commander.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index ee20f57a1..f511f3876 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -1243,6 +1243,7 @@ int commander_thread_main(int argc, char *argv[])
orb_check(safety_sub, &updated);
if (updated) {
+ bool previous_safety_off = safety.safety_off;
orb_copy(ORB_ID(safety), safety_sub, &safety);
/* disarm if safety is now on and still armed */
@@ -1256,6 +1257,19 @@ int commander_thread_main(int argc, char *argv[])
arming_state_changed = true;
}
}
+
+ //Notify the user if the status of the safety switch changes
+ if(safety.safety_switch_available && previous_safety_off != safety.safety_off) {
+
+ if(safety.safety_off) {
+ set_tune(TONE_NOTIFY_POSITIVE_TUNE);
+ }
+ else {
+ tune_neutral(true);
+ }
+
+ status_changed = true;
+ }
}
/* update vtol vehicle status*/
@@ -1949,6 +1963,12 @@ int commander_thread_main(int argc, char *argv[])
/* reset arm_tune_played when disarmed */
if (!armed.armed || (safety.safety_switch_available && !safety.safety_off)) {
+
+ //Notify the user that it is safe to approach the vehicle
+ if(arm_tune_played) {
+ tune_neutral(true);
+ }
+
arm_tune_played = false;
}