From cfa58dfc3623b2383e1313d8b2998ca168b5b218 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Fri, 7 Jun 2019 16:44:23 -0400 Subject: [PATCH] led_control move usage() to bottom of file --- src/systemcmds/led_control/led_control.cpp | 76 +++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/systemcmds/led_control/led_control.cpp b/src/systemcmds/led_control/led_control.cpp index fa502fa546..60e987c88b 100644 --- a/src/systemcmds/led_control/led_control.cpp +++ b/src/systemcmds/led_control/led_control.cpp @@ -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); +}