diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-01-28 15:13:14 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-01-28 15:13:14 +0100 |
commit | 9c355d280eb379c72df636c1d47e5b14ae3e3e6e (patch) | |
tree | e224a00b8bd506e2a78cad6886262c9968cb9bc5 /src/drivers/rgbled/rgbled.cpp | |
parent | ac77fe9c27d7253b01805ff94d3e0f8e21017709 (diff) | |
download | px4-firmware-9c355d280eb379c72df636c1d47e5b14ae3e3e6e.tar.gz px4-firmware-9c355d280eb379c72df636c1d47e5b14ae3e3e6e.tar.bz2 px4-firmware-9c355d280eb379c72df636c1d47e5b14ae3e3e6e.zip |
Merged beta into mavlink rework branch
Diffstat (limited to 'src/drivers/rgbled/rgbled.cpp')
-rw-r--r-- | src/drivers/rgbled/rgbled.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/drivers/rgbled/rgbled.cpp b/src/drivers/rgbled/rgbled.cpp index 727c86e02..4f58891ed 100644 --- a/src/drivers/rgbled/rgbled.cpp +++ b/src/drivers/rgbled/rgbled.cpp @@ -559,7 +559,7 @@ RGBLED::get(bool &on, bool &powersave, uint8_t &r, uint8_t &g, uint8_t &b) void rgbled_usage() { - warnx("missing command: try 'start', 'test', 'info', 'off', 'rgb 30 40 50'"); + warnx("missing command: try 'start', 'test', 'info', 'off', 'stop', 'rgb 30 40 50'"); warnx("options:"); warnx(" -b i2cbus (%d)", PX4_I2C_BUS_LED); warnx(" -a addr (0x%x)", ADDR); @@ -643,7 +643,7 @@ rgbled_main(int argc, char *argv[]) if (g_rgbled == nullptr) { warnx("not started"); rgbled_usage(); - exit(0); + exit(1); } if (!strcmp(verb, "test")) { @@ -669,7 +669,7 @@ rgbled_main(int argc, char *argv[]) exit(0); } - if (!strcmp(verb, "off")) { + if (!strcmp(verb, "off") || !strcmp(verb, "stop")) { fd = open(RGBLED_DEVICE_PATH, 0); if (fd == -1) { @@ -681,6 +681,12 @@ rgbled_main(int argc, char *argv[]) exit(ret); } + if (!strcmp(verb, "stop")) { + delete g_rgbled; + g_rgbled = nullptr; + exit(0); + } + if (!strcmp(verb, "rgb")) { if (argc < 5) { errx(1, "Usage: rgbled rgb <red> <green> <blue>"); |