From 334a599b2d6a64e6168cdba1937692e9bf0b0379 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Fri, 22 Nov 2019 16:11:19 +0100 Subject: [PATCH] vmount: tell user how to use vmount test This confused me, so hopefully it will help the next user, e.g. me. --- src/modules/vmount/vmount.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/vmount/vmount.cpp b/src/modules/vmount/vmount.cpp index aec55f4466..d70eee9d45 100644 --- a/src/modules/vmount/vmount.cpp +++ b/src/modules/vmount/vmount.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2017 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2019 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -432,12 +432,21 @@ int vmount_main(int argc, char *argv[]) return -1; } - if (!strcmp(argv[1], "start") || !strcmp(argv[1], "test")) { + const bool found_start = !strcmp(argv[1], "start"); + const bool found_test = !strcmp(argv[1], "test"); + + if (found_start || found_test) { /* this is not an error */ if (thread_running) { - PX4_WARN("mount driver already running"); - return 0; + if (found_start) { + PX4_WARN("mount driver already running"); + return 0; + + } else { + PX4_WARN("mount driver already running, run vmount stop before 'vmount test'"); + return 1; + } } thread_should_exit = false;