aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Oes <julian@oes.ch>2013-08-22 15:53:46 +0200
committerJulian Oes <julian@oes.ch>2013-08-22 15:53:46 +0200
commitca96140b217971d527e2306922a87a1592e6f90d (patch)
tree39ca42602c8a61b82472fe6ed8a714ab25ba1d6e
parentab5ec0da0b4afcb3f68eaf70efebe691513f74ce (diff)
downloadpx4-firmware-ca96140b217971d527e2306922a87a1592e6f90d.tar.gz
px4-firmware-ca96140b217971d527e2306922a87a1592e6f90d.tar.bz2
px4-firmware-ca96140b217971d527e2306922a87a1592e6f90d.zip
Allow the tone alarms to be interrupted
-rw-r--r--src/drivers/stm32/tone_alarm/tone_alarm.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/drivers/stm32/tone_alarm/tone_alarm.cpp b/src/drivers/stm32/tone_alarm/tone_alarm.cpp
index b06920a76..ad21f7143 100644
--- a/src/drivers/stm32/tone_alarm/tone_alarm.cpp
+++ b/src/drivers/stm32/tone_alarm/tone_alarm.cpp
@@ -879,14 +879,9 @@ ToneAlarm::ioctl(file *filp, int cmd, unsigned long arg)
_tune = nullptr;
_next = nullptr;
} else {
- /* don't interrupt alarms unless they are repeated */
- if (_tune != nullptr && !_repeat) {
- /* abort and let the current tune finish */
- result = -EBUSY;
- } else if (_repeat && _default_tune_number == arg) {
- /* requested repeating tune already playing */
- } else {
- // play the selected tune
+ /* always interrupt alarms, unless they are repeating and already playing */
+ if (!(_repeat && _default_tune_number == arg)) {
+ /* play the selected tune */
_default_tune_number = arg;
start_tune(_default_tunes[arg - 1]);
}