Skip to content

Commit

Permalink
Sub: accept MISSION_START as both long and int
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Oct 3, 2023
1 parent 8999790 commit c1e12f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ArduSub/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ MAV_RESULT GCS_MAVLINK_Sub::handle_command_int_packet(const mavlink_command_int_
case MAV_CMD_DO_MOTOR_TEST:
return handle_MAV_CMD_DO_MOTOR_TEST(packet);

case MAV_CMD_MISSION_START:
return handle_MAV_CMD_MISSION_START(packet);

case MAV_CMD_NAV_LOITER_UNLIM:
return handle_MAV_CMD_NAV_LOITER_UNLIM(packet);

Expand Down Expand Up @@ -523,15 +526,17 @@ MAV_RESULT GCS_MAVLINK_Sub::handle_command_long_packet(const mavlink_command_lon
}
return MAV_RESULT_FAILED;

case MAV_CMD_MISSION_START:
default:
return GCS_MAVLINK::handle_command_long_packet(packet, msg);
}
}

MAV_RESULT GCS_MAVLINK_Sub::handle_MAV_CMD_MISSION_START(const mavlink_command_int_t &packet)
{
if (sub.motors.armed() && sub.set_mode(Mode::Number::AUTO, ModeReason::GCS_COMMAND)) {
return MAV_RESULT_ACCEPTED;
}
return MAV_RESULT_FAILED;

default:
return GCS_MAVLINK::handle_command_long_packet(packet, msg);
}
}

MAV_RESULT GCS_MAVLINK_Sub::handle_MAV_CMD_DO_MOTOR_TEST(const mavlink_command_int_t &packet)
Expand Down
1 change: 1 addition & 0 deletions ArduSub/GCS_Mavlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class GCS_MAVLINK_Sub : public GCS_MAVLINK {

int16_t vfr_hud_throttle() const override;

MAV_RESULT handle_MAV_CMD_MISSION_START(const mavlink_command_int_t &packet);
MAV_RESULT handle_MAV_CMD_DO_MOTOR_TEST(const mavlink_command_int_t &packet);
MAV_RESULT handle_MAV_CMD_NAV_LOITER_UNLIM(const mavlink_command_int_t &packet);
MAV_RESULT handle_MAV_CMD_NAV_LAND(const mavlink_command_int_t &packet);
Expand Down

0 comments on commit c1e12f6

Please sign in to comment.