tunes: Improve logic for interrupting tunes

src/lib/tunes already knows which tunes are interruptable, so add
return values to expose than and use than in tone_alarm.
This fixes the issue that repeating tunes cannot be interrupted without
tune_override set to true.

Signed-off-by: Alex Mikhalev <alex@corvus-robotics.com>
This commit is contained in:
Alex Mikhalev
2020-11-30 16:56:13 -05:00
committed by Kabir Mohammed
parent bd943d872c
commit 378b41af6a
4 changed files with 86 additions and 58 deletions
+2 -2
View File
@@ -187,9 +187,9 @@ extern "C" __EXPORT int tune_control_main(int argc, char *argv[])
}
} else if (!strcmp(argv[myoptind], "libtest")) {
int ret = tunes.set_control(tune_control);
Tunes::ControlResult ret = tunes.set_control(tune_control);
if (ret == -EINVAL) {
if (ret == Tunes::ControlResult::InvalidTune) {
PX4_WARN("Tune ID not recognized.");
}