From 1ac88ec0344ec269d2f34aacda1c673f033b24d2 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Tue, 2 Feb 2016 01:20:07 +0300 Subject: [PATCH] Improved hardpoint command handling --- src/modules/uavcan/uavcan_main.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index 1b63741dbe..75aede53e6 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -1385,19 +1385,16 @@ int uavcan_main(int argc, char *argv[]) const int command = atoi(argv[4]); // Sanity check - weed out negative values, check against maximums - if (hardpoint_id >= 0 && - hardpoint_id < 256 && - command >= 0 && - command < 65536) { + if (hardpoint_id >= 0 && hardpoint_id < 256 && + command >= 0 && command < 65536) { inst->hardpoint_controller_set((uint8_t) hardpoint_id, (uint16_t) command); - } else { - errx(1, "Are you nuts?"); + errx(1, "Invalid argument"); } - } else { - errx(1, "Are you nuts?"); + errx(1, "Invalid hardpoint command"); } + ::exit(0); } if (!std::strcmp(argv[1], "stop")) {