GCS_MAVLink: deny attempt to do partial upload while mission transfer in progress

fixes an internal error where we make sure resources are not allocated before allocating upload resources.

The user may receive a DENIED message if they move a waypoint before an item has been transfered to the vehicle.
This commit is contained in:
Peter Barker 2024-05-08 22:14:23 +10:00 committed by Peter Barker
parent 39bb63c61f
commit 9f0e191505

View File

@ -220,6 +220,19 @@ void MissionItemProtocol::handle_mission_write_partial_list(GCS_MAVLINK &_link,
const mavlink_message_t &msg,
const mavlink_mission_write_partial_list_t &packet)
{
if (!mavlink2_requirement_met(_link, msg)) {
return;
}
if (receiving) {
// someone is already uploading a mission. Deny ability to
// write a partial list here as they might be trying to
// overwrite a subset of the waypoints which the current
// transfer is uploading, and that may lead to storing a whole
// bunch of empty items.
send_mission_ack(_link, msg, MAV_MISSION_DENIED);
return;
}
// start waypoint receiving
if ((unsigned)packet.start_index > item_count() ||