added/fixed more checking on hardpoint set command for CLI

This commit is contained in:
blah
2016-03-14 09:07:46 +01:00
committed by Lorenz Meier
parent c98e236744
commit 7d079d1dd7
2 changed files with 10 additions and 5 deletions
+5 -2
View File
@@ -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) {
+5 -3
View File
@@ -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();