mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 12:48:53 +08:00
test_ppm: add argc check
This commit is contained in:
@@ -249,23 +249,26 @@ usage()
|
|||||||
int
|
int
|
||||||
test_ppm_main(int argc, char *argv[])
|
test_ppm_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
if (argc < 2) {
|
||||||
|
test_ppm::usage();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
const char *verb = argv[1];
|
const char *verb = argv[1];
|
||||||
unsigned channels = 7;
|
unsigned channels = 7;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start/load the driver.
|
* Start/load the driver.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!strcmp(verb, "start")) {
|
if (!strcmp(verb, "start")) {
|
||||||
test_ppm::start(channels);
|
test_ppm::start(channels);
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(verb, "stop")) {
|
if (!strcmp(verb, "stop")) {
|
||||||
|
|
||||||
test_ppm::stop();
|
test_ppm::stop();
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -280,11 +283,9 @@ test_ppm_main(int argc, char *argv[])
|
|||||||
unsigned value = strtol(argv[3], NULL, 0);
|
unsigned value = strtol(argv[3], NULL, 0);
|
||||||
|
|
||||||
test_ppm::set(channel, value);
|
test_ppm::set(channel, value);
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test_ppm::usage();
|
test_ppm::usage();
|
||||||
exit(1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user