mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 13:03:33 +08:00
Segway stabilized.
This commit is contained in:
@@ -82,7 +82,7 @@ usage(const char *reason)
|
||||
if (reason)
|
||||
fprintf(stderr, "%s\n", reason);
|
||||
|
||||
fprintf(stderr, "usage: md25 {start|stop|status|search|test|change_address}\n\n");
|
||||
fprintf(stderr, "usage: md25 {start|stop|read|status|search|test|change_address}\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,29 @@ int md25_main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "read")) {
|
||||
if (argc < 4) {
|
||||
printf("usage: md25 read bus address\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
const char *deviceName = "/dev/md25";
|
||||
|
||||
uint8_t bus = strtoul(argv[2], nullptr, 0);
|
||||
|
||||
uint8_t address = strtoul(argv[3], nullptr, 0);
|
||||
|
||||
MD25 md25(deviceName, bus, address);
|
||||
|
||||
// print status
|
||||
char buf[400];
|
||||
md25.status(buf, sizeof(buf));
|
||||
printf("%s\n", buf);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
if (!strcmp(argv[1], "search")) {
|
||||
if (argc < 3) {
|
||||
printf("usage: md25 search bus\n");
|
||||
@@ -268,7 +291,7 @@ int md25_thread_main(int argc, char *argv[])
|
||||
uint8_t address = strtoul(argv[4], nullptr, 0);
|
||||
|
||||
// start
|
||||
MD25 md25("/dev/md25", bus, address);
|
||||
MD25 md25(deviceName, bus, address);
|
||||
|
||||
thread_running = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user