led_control move usage() to bottom of file

This commit is contained in:
Daniel Agar
2019-06-07 16:44:23 -04:00
committed by Lorenz Meier
parent c223de8a50
commit cfa58dfc36
+38 -38
View File
@@ -53,44 +53,6 @@ extern "C" {
__EXPORT int led_control_main(int argc, char *argv[]);
}
static void
usage()
{
PRINT_MODULE_DESCRIPTION(
R"DESCR_STR(
### Description
Command-line tool to control & test the (external) LED's.
To use it make sure there's a driver running, which handles the led_control uorb topic.
There are different priorities, such that for example one module can set a color with low priority, and another
module can blink N times with high priority, and the LED's automatically return to the lower priority state
after the blinking. The `reset` command can also be used to return to a lower priority.
### Examples
Blink the first LED 5 times in blue:
$ led_control blink -c blue -l 0 -n 5
)DESCR_STR");
PRINT_MODULE_USAGE_NAME("led_control", "command");
PRINT_MODULE_USAGE_COMMAND_DESCR("test", "Run a test pattern");
PRINT_MODULE_USAGE_COMMAND_DESCR("on", "Turn LED on");
PRINT_MODULE_USAGE_COMMAND_DESCR("off", "Turn LED off");
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset LED priority");
PRINT_MODULE_USAGE_COMMAND_DESCR("blink", "Blink LED N times");
PRINT_MODULE_USAGE_PARAM_INT('n', 3, 1, 20, "Number of blinks", true);
PRINT_MODULE_USAGE_PARAM_STRING('s', "normal", "fast|normal|slow", "Set blinking speed", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("breathe", "Continuously fade LED in & out");
PRINT_MODULE_USAGE_COMMAND_DESCR("flash", "Two fast blinks and then off with frequency of 1Hz");
PRINT_MODULE_USAGE_PARAM_COMMENT("The following arguments apply to all of the above commands except for 'test':");
PRINT_MODULE_USAGE_PARAM_STRING('c', "white", "red|blue|green|yellow|purple|amber|cyan|white", "color", true);
PRINT_MODULE_USAGE_PARAM_INT('l', -1, 0, 100, "Which LED to control: 0, 1, 2, ... (default=all)", true);
PRINT_MODULE_USAGE_PARAM_INT('p', 2, 0, 2, "Priority", true);
}
static void publish_led_control(led_control_s &led_control)
{
led_control.timestamp = hrt_absolute_time();
@@ -275,3 +237,41 @@ led_control_main(int argc, char *argv[])
return 0;
}
static void
usage()
{
PRINT_MODULE_DESCRIPTION(
R"DESCR_STR(
### Description
Command-line tool to control & test the (external) LED's.
To use it make sure there's a driver running, which handles the led_control uorb topic.
There are different priorities, such that for example one module can set a color with low priority, and another
module can blink N times with high priority, and the LED's automatically return to the lower priority state
after the blinking. The `reset` command can also be used to return to a lower priority.
### Examples
Blink the first LED 5 times in blue:
$ led_control blink -c blue -l 0 -n 5
)DESCR_STR");
PRINT_MODULE_USAGE_NAME("led_control", "command");
PRINT_MODULE_USAGE_COMMAND_DESCR("test", "Run a test pattern");
PRINT_MODULE_USAGE_COMMAND_DESCR("on", "Turn LED on");
PRINT_MODULE_USAGE_COMMAND_DESCR("off", "Turn LED off");
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset LED priority");
PRINT_MODULE_USAGE_COMMAND_DESCR("blink", "Blink LED N times");
PRINT_MODULE_USAGE_PARAM_INT('n', 3, 1, 20, "Number of blinks", true);
PRINT_MODULE_USAGE_PARAM_STRING('s', "normal", "fast|normal|slow", "Set blinking speed", true);
PRINT_MODULE_USAGE_COMMAND_DESCR("breathe", "Continuously fade LED in & out");
PRINT_MODULE_USAGE_COMMAND_DESCR("flash", "Two fast blinks and then off with frequency of 1Hz");
PRINT_MODULE_USAGE_PARAM_COMMENT("The following arguments apply to all of the above commands except for 'test':");
PRINT_MODULE_USAGE_PARAM_STRING('c', "white", "red|blue|green|yellow|purple|amber|cyan|white", "color", true);
PRINT_MODULE_USAGE_PARAM_INT('l', -1, 0, 100, "Which LED to control: 0, 1, 2, ... (default=all)", true);
PRINT_MODULE_USAGE_PARAM_INT('p', 2, 0, 2, "Priority", true);
}