From 955264c7e293ade952b4609fa04dea002c243e7e Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Thu, 1 Feb 2018 13:55:10 -0800 Subject: [PATCH] Fix incorrect Resume Mission display --- src/FlightDisplay/GuidedActionsController.qml | 4 +++- src/MissionManager/MissionManager.cc | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index e1a187189..0e08e0cbf 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -101,13 +101,15 @@ Item { property bool showLand: _activeVehicle && _activeVehicle.guidedModeSupported && _vehicleArmed && !_activeVehicle.fixedWing && !_vehicleInLandMode property bool showStartMission: _activeVehicle && _missionAvailable && !_missionActive && !_vehicleFlying property bool showContinueMission: _activeVehicle && _missionAvailable && !_missionActive && _vehicleFlying && (_currentMissionIndex < missionController.visualItems.count - 1) - property bool showResumeMission: _activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < missionController.visualItems.count - 2) property bool showPause: _activeVehicle && _vehicleArmed && _activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused property bool showChangeAlt: (_activeVehicle && _vehicleFlying) && _activeVehicle.guidedModeSupported && _vehicleArmed && !_missionActive property bool showOrbit: !_hideOrbit && _activeVehicle && _vehicleFlying && _activeVehicle.orbitModeSupported && _vehicleArmed && !_missionActive property bool showLandAbort: _activeVehicle && _vehicleFlying && _activeVehicle.fixedWing && _vehicleLanding property bool showGotoLocation: _activeVehicle && _vehicleFlying + // Note: The 'missionController.visualItems.count - 3' is a hack to not trigger resume mission when a mission ends with an RTL item + property bool showResumeMission: _activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < missionController.visualItems.count - 3) + property bool guidedUIVisible: guidedActionConfirm.visible || guidedActionList.visible property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle diff --git a/src/MissionManager/MissionManager.cc b/src/MissionManager/MissionManager.cc index 4ed0dcc33..e5fc3bd1f 100644 --- a/src/MissionManager/MissionManager.cc +++ b/src/MissionManager/MissionManager.cc @@ -242,7 +242,7 @@ void MissionManager::_handleMissionCurrent(const mavlink_message_t& message) emit currentIndexChanged(_currentMissionIndex); } - if (_currentMissionIndex != _lastCurrentIndex) { + if (_currentMissionIndex != _lastCurrentIndex && _cachedLastCurrentIndex != _currentMissionIndex) { // We have to be careful of an RTL sequence causing a change of index to the DO_LAND_START sequence. This also triggers // a flight mode change away from mission flight mode. So we only update _lastCurrentIndex when the flight mode is mission. // But we can run into problems where we may get the MISSION_CURRENT message for the RTL/DO_LAND_START sequenc change prior -- 2.22.0