mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 01:23:34 +08:00
added/fixed more checking on hardpoint set command for CLI
This commit is contained in:
@@ -1383,15 +1383,18 @@ int uavcan_main(int argc, char *argv[])
|
||||
|
||||
// Sanity check - weed out negative values, check against maximums
|
||||
if (hardpoint_id >= 0 &&
|
||||
hardpoint_id < 9 &&
|
||||
hardpoint_id < 256 &&
|
||||
command >= 0 &&
|
||||
command < 11) {
|
||||
command < 65536) {
|
||||
inst->hardpoint_controller_set((uint8_t) hardpoint_id, (uint16_t) command);
|
||||
}
|
||||
else {
|
||||
errx(1, "Are you nuts?");
|
||||
}
|
||||
}
|
||||
else {
|
||||
errx(1, "Are you nuts?");
|
||||
}
|
||||
}
|
||||
if (!std::strcmp(argv[1], "stop")) {
|
||||
if (fw) {
|
||||
|
||||
@@ -123,13 +123,15 @@ public:
|
||||
|
||||
void subscribe();
|
||||
|
||||
int teardown();
|
||||
int arm_actuators(bool arm);
|
||||
int teardown();
|
||||
int arm_actuators(bool arm);
|
||||
|
||||
void print_info();
|
||||
|
||||
void shrink();
|
||||
|
||||
void hardpoint_controller_set(uint8_t hardpoint_id, uint16_t command);
|
||||
|
||||
static UavcanNode *instance() { return _instance; }
|
||||
static int getHardwareVersion(uavcan::protocol::HardwareVersion &hwver);
|
||||
int fw_server(eServerAction action);
|
||||
@@ -140,7 +142,7 @@ public:
|
||||
int get_param(int remote_node_id, const char *name);
|
||||
int reset_node(int remote_node_id);
|
||||
|
||||
void hardpoint_controller_set(uint8_t hardpoint_id, uint16_t command);
|
||||
|
||||
|
||||
private:
|
||||
void fill_node_info();
|
||||
|
||||
Reference in New Issue
Block a user