summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-02-28 01:20:26 +0100
committerRichard Braun <rbraun@sceen.net>2018-02-28 01:20:26 +0100
commit4ab64988e360db004942acb811559ee78e5ea9ff (patch)
treebf790773dd53f0c44cc7d76dd1e8c314a368298d
parent574e638d764a653b67346ce348bc1a9fb26b62d4 (diff)
led: make the led_blink command print the blinking state
-rw-r--r--src/led.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/led.c b/src/led.c
index 3a49f77..d20f2b9 100644
--- a/src/led.c
+++ b/src/led.c
@@ -43,8 +43,11 @@ led_shell_blink(int argc, char **argv)
{
bool enabled;
- if (argc != 2) {
+ if (argc > 2) {
goto error;
+ } else if (argc == 1) {
+ printf("led: blinking: %s\n", led_blinking_enabled ? "yes" : "no");
+ return;
}
if (strcmp(argv[1], "on") == 0) {
@@ -56,7 +59,6 @@ led_shell_blink(int argc, char **argv)
}
led_blinking_enabled = enabled;
-
return;
error:
@@ -65,7 +67,7 @@ error:
static struct shell_cmd led_shell_cmds[] = {
SHELL_CMD_INITIALIZER("led_blink", led_shell_blink,
- "led_blink <on|off>",
+ "led_blink [on|off]",
"control led blinking"),
};