Add a check command and fix error reporting

This commit is contained in:
Lorenz Meier
2014-07-11 14:51:13 +02:00
parent c93936c19b
commit b97c867420
3 changed files with 24 additions and 20 deletions

View File

@@ -286,15 +286,20 @@ int commander_main(int argc, char *argv[])
exit(0);
}
/* commands needing the app to run below */
if (!thread_running) {
warnx("\tcommander not started");
exit(1);
}
if (!strcmp(argv[1], "status")) {
if (thread_running) {
warnx("\tcommander is running");
print_status();
} else {
warnx("\tcommander not started");
}
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);
}