mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
Started with px4io stop implementation
This commit is contained in:
@@ -825,9 +825,38 @@ px4io_main(int argc, char *argv[])
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(argv[1], "stop")) {
|
||||||
|
|
||||||
|
if (g_dev != nullptr) {
|
||||||
|
/* stop the driver */
|
||||||
|
delete g_dev;
|
||||||
|
} else {
|
||||||
|
errx(1, "not loaded");
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!strcmp(argv[1], "status")) {
|
||||||
|
|
||||||
|
if (g_dev != nullptr)
|
||||||
|
printf("[px4io] loaded\n");
|
||||||
|
else
|
||||||
|
printf("[px4io] not loaded\n");
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* note, stop not currently implemented */
|
/* note, stop not currently implemented */
|
||||||
|
|
||||||
if (!strcmp(argv[1], "update")) {
|
if (!strcmp(argv[1], "update")) {
|
||||||
|
|
||||||
|
if (g_dev != nullptr) {
|
||||||
|
printf("[px4io] loaded, detaching first\n");
|
||||||
|
/* stop the driver */
|
||||||
|
delete g_dev;
|
||||||
|
}
|
||||||
|
|
||||||
PX4IO_Uploader *up;
|
PX4IO_Uploader *up;
|
||||||
const char *fn[3];
|
const char *fn[3];
|
||||||
|
|
||||||
@@ -883,5 +912,5 @@ px4io_main(int argc, char *argv[])
|
|||||||
if (!strcmp(argv[1], "monitor"))
|
if (!strcmp(argv[1], "monitor"))
|
||||||
monitor();
|
monitor();
|
||||||
|
|
||||||
errx(1, "need a command, try 'start', 'test', 'monitor' or 'update'");
|
errx(1, "need a command, try 'start', 'stop', 'status', 'test', 'monitor' or 'update'");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user