From c1e12f691e316ab494b19f2a60bd15459bd42a21 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 28 Sep 2023 08:35:59 +1000 Subject: [PATCH] Sub: accept MISSION_START as both long and int --- ArduSub/GCS_Mavlink.cpp | 15 ++++++++++----- ArduSub/GCS_Mavlink.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ArduSub/GCS_Mavlink.cpp b/ArduSub/GCS_Mavlink.cpp index 2da1cb7535e20..8f027b034c914 100644 --- a/ArduSub/GCS_Mavlink.cpp +++ b/ArduSub/GCS_Mavlink.cpp @@ -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); @@ -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) diff --git a/ArduSub/GCS_Mavlink.h b/ArduSub/GCS_Mavlink.h index c185fa1b1890e..2177c917b0aac 100644 --- a/ArduSub/GCS_Mavlink.h +++ b/ArduSub/GCS_Mavlink.h @@ -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);