Browse Source

PlanManager: drop spurious items for unexpected mission types (#10509)

* PlanManager: drop spurious items for unexpected mission types
* PlanManager: drive-by bug fix
QGC4.4
Mathieu Mirmont 2 years ago committed by GitHub
parent
commit
a3fa4dd537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/MissionManager/PlanManager.cc

13
src/MissionManager/PlanManager.cc

@ -375,6 +375,7 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message) @@ -375,6 +375,7 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message)
{
MAV_CMD command;
MAV_FRAME frame;
MAV_MISSION_TYPE missionType;
double param1;
double param2;
double param3;
@ -389,8 +390,9 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message) @@ -389,8 +390,9 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message)
mavlink_mission_item_int_t missionItem;
mavlink_msg_mission_item_int_decode(&message, &missionItem);
command = (MAV_CMD)missionItem.command,
frame = (MAV_FRAME)missionItem.frame,
command = (MAV_CMD)missionItem.command;
frame = (MAV_FRAME)missionItem.frame;
missionType = (MAV_MISSION_TYPE)missionItem.mission_type;
param1 = missionItem.param1;
param2 = missionItem.param2;
param3 = missionItem.param3;
@ -402,6 +404,13 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message) @@ -402,6 +404,13 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message)
isCurrentItem = missionItem.current;
seq = missionItem.seq;
// Check the mission_type field. It can happen that we receive a late duplicate message for a
// different mission_type request.
if (missionType != _planType) {
qCDebug(PlanManagerLog) << QStringLiteral("_handleMissionItem %1 dropping spurious item seq:command:missionType").arg(_planTypeString()) << seq << command << missionType;
return;
}
// We don't support editing ALT_INT frames so change on the way in.
if (frame == MAV_FRAME_GLOBAL_INT) {
frame = MAV_FRAME_GLOBAL;

Loading…
Cancel
Save