diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-11 14:51:13 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-11 14:51:13 +0200 |
commit | b97c867420f477f2c3a7dbc073975f5d872194cb (patch) | |
tree | c7b982ebd48430d5b1a32e105353179c5d70a437 /src/modules/commander/commander.cpp | |
parent | c93936c19baf2432512dd2f548f1ec4c6c1c7704 (diff) | |
download | px4-firmware-b97c867420f477f2c3a7dbc073975f5d872194cb.tar.gz px4-firmware-b97c867420f477f2c3a7dbc073975f5d872194cb.tar.bz2 px4-firmware-b97c867420f477f2c3a7dbc073975f5d872194cb.zip |
Add a check command and fix error reporting
Diffstat (limited to 'src/modules/commander/commander.cpp')
-rw-r--r-- | src/modules/commander/commander.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 2058cd92e..106f05f57 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -286,15 +286,20 @@ int commander_main(int argc, char *argv[]) exit(0); } - if (!strcmp(argv[1], "status")) { - if (thread_running) { - warnx("\tcommander is running"); - print_status(); + /* commands needing the app to run below */ + if (!thread_running) { + warnx("\tcommander not started"); + exit(1); + } - } else { - warnx("\tcommander not started"); - } + if (!strcmp(argv[1], "status")) { + print_status(); + exit(0); + } + if (!strcmp(argv[1], "check")) { + int checkres = prearm_check(&status, mavlink_fd); + warnx("FINAL RESULT: %s", (checkres == 0) ? "OK" : "FAILED"); exit(0); } |