diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-02-15 15:53:12 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-02-15 19:52:02 +0100 |
commit | 93997acdd2cab9264d8b4a6c9d4cd6142350f656 (patch) | |
tree | c98fab9860b81bbf3a02161c389971b16ce1b418 /src/drivers/px4io/px4io.cpp | |
parent | 4740568446a7605211d5443725ed487d171e15af (diff) | |
download | px4-firmware-93997acdd2cab9264d8b4a6c9d4cd6142350f656.tar.gz px4-firmware-93997acdd2cab9264d8b4a6c9d4cd6142350f656.tar.bz2 px4-firmware-93997acdd2cab9264d8b4a6c9d4cd6142350f656.zip |
px4io driver: Clean up log / warn style
Diffstat (limited to 'src/drivers/px4io/px4io.cpp')
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index dd9f2f7d7..f62df54f6 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -2823,12 +2823,12 @@ checkcrc(int argc, char *argv[]) check IO CRC against CRC of a file */ if (argc < 2) { - printf("usage: px4io checkcrc filename\n"); + warnx("usage: px4io checkcrc filename"); exit(1); } int fd = open(argv[1], O_RDONLY); if (fd == -1) { - printf("open of %s failed - %d\n", argv[1], errno); + warnx("open of %s failed: %d", argv[1], errno); exit(1); } const uint32_t app_size_max = 0xf000; @@ -2856,10 +2856,10 @@ checkcrc(int argc, char *argv[]) } if (ret != OK) { - warn("check CRC failed - %d", ret); + warn("check CRC failed: %d", ret); exit(1); } - warnx("CRCs match\n"); + warnx("CRCs match"); exit(0); } @@ -3126,7 +3126,7 @@ px4io_main(int argc, char *argv[]) if (!strcmp(argv[1], "update")) { if (g_dev != nullptr) { - printf("[px4io] loaded, detaching first\n"); + warnx("loaded, detaching first"); /* stop the driver */ delete g_dev; g_dev = nullptr; @@ -3218,7 +3218,7 @@ px4io_main(int argc, char *argv[]) uint16_t arg = atol(argv[2]); int ret = g_dev->ioctl(nullptr, PX4IO_REBOOT_BOOTLOADER, arg); if (ret != OK) { - printf("reboot failed - %d\n", ret); + warnx("reboot failed - %d", ret); exit(1); } @@ -3275,7 +3275,7 @@ px4io_main(int argc, char *argv[]) if (!strcmp(argv[1], "safety_off")) { int ret = g_dev->ioctl(NULL, PWM_SERVO_SET_FORCE_SAFETY_OFF, 0); if (ret != OK) { - printf("failed to disable safety\n"); + warnx("failed to disable safety"); exit(1); } exit(0); @@ -3284,7 +3284,7 @@ px4io_main(int argc, char *argv[]) if (!strcmp(argv[1], "safety_on")) { int ret = g_dev->ioctl(NULL, PWM_SERVO_SET_FORCE_SAFETY_ON, 0); if (ret != OK) { - printf("failed to enable safety\n"); + warnx("failed to enable safety"); exit(1); } exit(0); @@ -3312,7 +3312,7 @@ px4io_main(int argc, char *argv[]) if (!strcmp(argv[1], "status")) { - printf("[px4io] loaded\n"); + warnx("loaded"); g_dev->print_status(true); exit(0); @@ -3320,12 +3320,12 @@ px4io_main(int argc, char *argv[]) if (!strcmp(argv[1], "debug")) { if (argc <= 2) { - printf("usage: px4io debug LEVEL\n"); + warnx("usage: px4io debug LEVEL"); exit(1); } if (g_dev == nullptr) { - printf("px4io is not started\n"); + warnx("not started"); exit(1); } @@ -3336,11 +3336,11 @@ px4io_main(int argc, char *argv[]) int ret = g_dev->ioctl(nullptr, PX4IO_SET_DEBUG, level); if (ret != 0) { - printf("SET_DEBUG failed - %d\n", ret); + warnx("SET_DEBUG failed: %d", ret); exit(1); } - printf("SET_DEBUG %u OK\n", (unsigned)level); + warnx("SET_DEBUG %u OK", (unsigned)level); exit(0); } |