mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 20:31:37 +08:00
Improved hardpoint command handling
This commit is contained in:
committed by
Lorenz Meier
parent
7b83e828b8
commit
1ac88ec034
@@ -1385,19 +1385,16 @@ int uavcan_main(int argc, char *argv[])
|
|||||||
const int command = atoi(argv[4]);
|
const int command = atoi(argv[4]);
|
||||||
|
|
||||||
// Sanity check - weed out negative values, check against maximums
|
// Sanity check - weed out negative values, check against maximums
|
||||||
if (hardpoint_id >= 0 &&
|
if (hardpoint_id >= 0 && hardpoint_id < 256 &&
|
||||||
hardpoint_id < 256 &&
|
command >= 0 && command < 65536) {
|
||||||
command >= 0 &&
|
|
||||||
command < 65536) {
|
|
||||||
inst->hardpoint_controller_set((uint8_t) hardpoint_id, (uint16_t) command);
|
inst->hardpoint_controller_set((uint8_t) hardpoint_id, (uint16_t) command);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
errx(1, "Are you nuts?");
|
errx(1, "Invalid argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
errx(1, "Are you nuts?");
|
errx(1, "Invalid hardpoint command");
|
||||||
}
|
}
|
||||||
|
::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!std::strcmp(argv[1], "stop")) {
|
if (!std::strcmp(argv[1], "stop")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user