From 9d3dfb7864bc2a7b787d7cddff01665c1c0fa6f6 Mon Sep 17 00:00:00 2001
From: Alessandro Simovic <alessandro@yuneecresearch.com>
Date: Mon, 26 Mar 2018 13:09:58 +0200
Subject: [PATCH] libtunes: addressing comments of #9117

---
 src/lib/tunes/tunes.cpp                      | 1 -
 src/lib/tunes/tunes.h                        | 3 ---
 src/systemcmds/tune_control/tune_control.cpp | 6 +++++-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/lib/tunes/tunes.cpp b/src/lib/tunes/tunes.cpp
index 726cdcee7b..16be96efd5 100644
--- a/src/lib/tunes/tunes.cpp
+++ b/src/lib/tunes/tunes.cpp
@@ -89,7 +89,6 @@ int Tunes::set_control(const tune_control_s &tune_control)
 {
 	// Sanity check
 	if (tune_control.tune_id >= _default_tunes_size) {
-		PX4_WARN("Tune ID not recognized.");
 		return -EINVAL;
 	}
 
diff --git a/src/lib/tunes/tunes.h b/src/lib/tunes/tunes.h
index 3b62553ebe..d50efb21dc 100644
--- a/src/lib/tunes/tunes.h
+++ b/src/lib/tunes/tunes.h
@@ -73,9 +73,6 @@ public:
 	 */
 	Tunes(unsigned default_tempo, unsigned default_octave, unsigned default_note_length, NoteMode default_mode);
 
-	/**
-	 * Default destructor
-	 */
 	~Tunes() = default;
 
 	/**
diff --git a/src/systemcmds/tune_control/tune_control.cpp b/src/systemcmds/tune_control/tune_control.cpp
index f3d9a42255..cb1e8b156e 100644
--- a/src/systemcmds/tune_control/tune_control.cpp
+++ b/src/systemcmds/tune_control/tune_control.cpp
@@ -207,7 +207,11 @@ tune_control_main(int argc, char *argv[])
 		}
 
 	} else if (!strcmp(argv[myoptind], "libtest")) {
-		tunes.set_control(tune_control);
+		int ret = tunes.set_control(tune_control);
+
+		if (ret == -EINVAL) {
+			PX4_WARN("Tune ID not recognized.");
+		}
 
 		while (tunes.get_next_tune(frequency, duration, silence, strength) > 0) {
 			PX4_INFO("frequency: %d, duration %d, silence %d, strength%d",
-- 
GitLab