diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index c344287e27ad37359650925a32b470c7b9131d8f..5aafc3633e56f7c1f11ceac62f699264ed5f56cc 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -90,7 +90,7 @@ 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 && !_vehicleFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < missionController.visualItems.count - 2) + 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 @@ -114,6 +114,7 @@ Item { property int _resumeMissionIndex: missionController.resumeMissionIndex property bool _hideEmergenyStop: !QGroundControl.corePlugin.options.guidedBarShowEmergencyStop property bool _hideOrbit: !QGroundControl.corePlugin.options.guidedBarShowOrbit + property bool _vehicleWasFlying: false // This is a temporary hack to debug a problem with RTL and Pause being disabled at the wrong time @@ -128,7 +129,6 @@ Item { Component.onCompleted: _outputState() on_ActiveVehicleChanged: _outputState() on_VehicleArmedChanged: _outputState() - on_VehicleFlyingChanged: _outputState() on_VehicleInRTLModeChanged: _outputState() on_VehiclePausedChanged: _outputState() on__FlightModeChanged: _outputState() @@ -137,6 +137,15 @@ Item { // End of hack + on_VehicleFlyingChanged: { + _outputState() + if (!_vehicleFlying) { + // We use _vehicleWasFLying to help trigger Resume Mission only if the vehicle actually flew and came back down. + // Otherwise it may trigger during the Start Mission sequence due to signal ordering or armed and resume mission index. + _vehicleWasFlying = true + } + } + property var _actionData on_CurrentMissionIndexChanged: console.log("_currentMissionIndex", _currentMissionIndex) @@ -265,6 +274,7 @@ Item { missionController.resumeMission(missionController.resumeMissionIndex) break case actionResumeMissionReady: + _vehicleWasFlying = false _activeVehicle.startMission() break case actionStartMission: