From f63be6b055c55e04dd20f66d2b1ff9f9e5b640de Mon Sep 17 00:00:00 2001 From: Simone Guscetti Date: Tue, 14 Mar 2017 08:42:30 +0100 Subject: [PATCH] libtunes: If default tune does not exist return -EINVAL --- src/lib/tunes/tunes.cpp | 4 +++- src/lib/tunes/tunes.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/tunes/tunes.cpp b/src/lib/tunes/tunes.cpp index 5687d7bfb5..5dfcfbe66b 100644 --- a/src/lib/tunes/tunes.cpp +++ b/src/lib/tunes/tunes.cpp @@ -78,7 +78,7 @@ void Tunes::config_tone() _octave = _default_octave; } -void Tunes::set_control(const tune_control_s &tune_control) +int Tunes::set_control(const tune_control_s &tune_control) { bool reset_playing_tune = false; @@ -120,8 +120,10 @@ void Tunes::set_control(const tune_control_s &tune_control) } else { PX4_WARN("Tune ID not recognized."); + return -EINVAL; } + return OK; } void Tunes::set_string(const char *string) diff --git a/src/lib/tunes/tunes.h b/src/lib/tunes/tunes.h index d7ba83a9f6..c3d7f52180 100644 --- a/src/lib/tunes/tunes.h +++ b/src/lib/tunes/tunes.h @@ -65,10 +65,10 @@ public: /** * Set tune to be played. - * * @param tune_control struct containig the uORB message + * @return return -EINVAL if the default tune does not exist. */ - void set_control(const tune_control_s &tune_control); + int set_control(const tune_control_s &tune_control); /** * Parse a tune string, formatted with the syntax of the Microsoft GWBasic/QBasic.