Skip to content

Commit

Permalink
GCS_MAVLink: support gripper commands as both long and int
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and tridge committed Nov 8, 2023
1 parent 09ab14c commit abf3290
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libraries/GCS_MAVLink/GCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ class GCS_MAVLINK
MAV_RESULT handle_command_camera(const mavlink_command_int_t &packet);
MAV_RESULT handle_command_do_set_roi(const mavlink_command_int_t &packet);
virtual MAV_RESULT handle_command_do_set_roi(const Location &roi_loc);
MAV_RESULT handle_command_do_gripper(const mavlink_command_long_t &packet);
MAV_RESULT handle_command_do_gripper(const mavlink_command_int_t &packet);
MAV_RESULT handle_command_do_sprayer(const mavlink_command_int_t &packet);
MAV_RESULT handle_command_do_set_mode(const mavlink_command_int_t &packet);
MAV_RESULT handle_command_get_home_position(const mavlink_command_int_t &packet);
Expand Down
13 changes: 6 additions & 7 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4552,7 +4552,7 @@ MAV_RESULT GCS_MAVLINK::handle_command_set_ekf_source_set(const mavlink_command_
}

#if AP_GRIPPER_ENABLED
MAV_RESULT GCS_MAVLINK::handle_command_do_gripper(const mavlink_command_long_t &packet)
MAV_RESULT GCS_MAVLINK::handle_command_do_gripper(const mavlink_command_int_t &packet)
{
AP_Gripper *gripper = AP::gripper();
if (gripper == nullptr) {
Expand Down Expand Up @@ -4726,12 +4726,6 @@ MAV_RESULT GCS_MAVLINK::handle_command_long_packet(const mavlink_command_long_t

switch (packet.command) {

#if AP_GRIPPER_ENABLED
case MAV_CMD_DO_GRIPPER:
result = handle_command_do_gripper(packet);
break;
#endif

#if AP_MAVLINK_MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES_ENABLED
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: {
result = handle_command_request_autopilot_capabilities(packet);
Expand Down Expand Up @@ -5048,6 +5042,11 @@ MAV_RESULT GCS_MAVLINK::handle_command_int_packet(const mavlink_command_int_t &p
case MAV_CMD_DO_FLIGHTTERMINATION:
return handle_flight_termination(packet);

#if AP_GRIPPER_ENABLED
case MAV_CMD_DO_GRIPPER:
return handle_command_do_gripper(packet);
#endif

case MAV_CMD_DO_SET_MODE:
return handle_command_do_set_mode(packet);

Expand Down

0 comments on commit abf3290

Please sign in to comment.