GCS_MAVLink: deprecate use of MISSION_SET_CURRENT message

The mavlink command MAV_CMD_DO_SET_MISSION_CURRENT has been in place since January 2019 and is superior to this.
This commit is contained in:
Peter Barker 2023-03-16 17:14:28 +11:00 committed by Andrew Tridgell
parent 6659b02e14
commit 068443718e
5 changed files with 21 additions and 0 deletions

View File

@ -1316,6 +1316,7 @@ MAV_RESULT GCS_MAVLINK_Plane::handle_command_do_set_mission_current(const mavlin
return result; return result;
} }
#if AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
void GCS_MAVLINK_Plane::handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg) void GCS_MAVLINK_Plane::handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg)
{ {
// if you change this you must change handle_command_do_set_mission_current // if you change this you must change handle_command_do_set_mission_current
@ -1325,6 +1326,7 @@ void GCS_MAVLINK_Plane::handle_mission_set_current(AP_Mission &mission, const ma
plane.mission.resume(); plane.mission.resume();
} }
} }
#endif
uint64_t GCS_MAVLINK_Plane::capabilities() const uint64_t GCS_MAVLINK_Plane::capabilities() const
{ {

View File

@ -15,7 +15,9 @@ protected:
uint32_t telem_delay() const override; uint32_t telem_delay() const override;
#if AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
void handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg) override; void handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg) override;
#endif
uint8_t sysid_my_gcs() const override; uint8_t sysid_my_gcs() const override;
bool sysid_enforce() const override; bool sysid_enforce() const override;

View File

@ -525,12 +525,15 @@ protected:
void handle_mission_request_int(const mavlink_message_t &msg); void handle_mission_request_int(const mavlink_message_t &msg);
void handle_mission_clear_all(const mavlink_message_t &msg); void handle_mission_clear_all(const mavlink_message_t &msg);
#if AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
// Note that there exists a relatively new mavlink DO command, // Note that there exists a relatively new mavlink DO command,
// MAV_CMD_DO_SET_MISSION_CURRENT which provides an acknowledgement // MAV_CMD_DO_SET_MISSION_CURRENT which provides an acknowledgement
// that the command has been received, rather than the GCS having to // that the command has been received, rather than the GCS having to
// rely on getting back an identical sequence number as some currently // rely on getting back an identical sequence number as some currently
// do. // do.
virtual void handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg); virtual void handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg);
#endif
void handle_mission_count(const mavlink_message_t &msg); void handle_mission_count(const mavlink_message_t &msg);
void handle_mission_write_partial_list(const mavlink_message_t &msg); void handle_mission_write_partial_list(const mavlink_message_t &msg);
void handle_mission_item(const mavlink_message_t &msg); void handle_mission_item(const mavlink_message_t &msg);

View File

@ -614,6 +614,7 @@ void GCS_MAVLINK::handle_mission_request(const mavlink_message_t &msg)
prot->handle_mission_request(*this, packet, msg); prot->handle_mission_request(*this, packet, msg);
} }
#if AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
/* /*
handle a MISSION_SET_CURRENT mavlink packet handle a MISSION_SET_CURRENT mavlink packet
@ -625,6 +626,8 @@ void GCS_MAVLINK::handle_mission_request(const mavlink_message_t &msg)
*/ */
void GCS_MAVLINK::handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg) void GCS_MAVLINK::handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg)
{ {
// send_received_message_deprecation_warning("MISSION_SET_CURRENT");
// decode // decode
mavlink_mission_set_current_t packet; mavlink_mission_set_current_t packet;
mavlink_msg_mission_set_current_decode(&msg, &packet); mavlink_msg_mission_set_current_decode(&msg, &packet);
@ -647,6 +650,7 @@ void GCS_MAVLINK::handle_mission_set_current(AP_Mission &mission, const mavlink_
} }
} }
} }
#endif // AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
/* /*
handle a MISSION_COUNT mavlink packet handle a MISSION_COUNT mavlink packet
@ -4060,6 +4064,7 @@ void GCS_MAVLINK::handle_common_mission_message(const mavlink_message_t &msg)
handle_mission_request(msg); handle_mission_request(msg);
break; break;
#if AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
case MAVLINK_MSG_ID_MISSION_SET_CURRENT: // MAV ID: 41 case MAVLINK_MSG_ID_MISSION_SET_CURRENT: // MAV ID: 41
{ {
AP_Mission *_mission = AP::mission(); AP_Mission *_mission = AP::mission();
@ -4068,6 +4073,7 @@ void GCS_MAVLINK::handle_common_mission_message(const mavlink_message_t &msg)
} }
break; break;
} }
#endif
// GCS request the full list of commands, we return just the number and leave the GCS to then request each command individually // GCS request the full list of commands, we return just the number and leave the GCS to then request each command individually
case MAVLINK_MSG_ID_MISSION_REQUEST_LIST: // MAV ID: 43 case MAVLINK_MSG_ID_MISSION_REQUEST_LIST: // MAV ID: 43

View File

@ -10,3 +10,11 @@
#ifndef AP_MAVLINK_BATTERY2_ENABLED #ifndef AP_MAVLINK_BATTERY2_ENABLED
#define AP_MAVLINK_BATTERY2_ENABLED 1 #define AP_MAVLINK_BATTERY2_ENABLED 1
#endif #endif
// handling of MISSION_SET_CURRENT (the message) is slated to be
// removed. It has signficant deficiencies vs MAV_CMD_DO_SET_CURRENT.
// The command was added to the spec in January 2019 and to MAVLink in
// ArduPilot in 4.1.x
#ifndef AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
#define AP_MAVLINK_MISSION_SET_CURRENT_ENABLED 1
#endif