diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index 37f9c8db0e61b78def266209d0a7af5f9782ced2..042894a871917fb38fc469cda2d7b632598c343f 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -93,25 +93,26 @@ Item { readonly property int actionVtolTransitionToFwdFlight: 20 readonly property int actionVtolTransitionToMRFlight: 21 - property bool showEmergenyStop: !_hideEmergenyStop && _activeVehicle && _vehicleArmed && _vehicleFlying - property bool showArm: _activeVehicle && !_vehicleArmed - property bool showDisarm: _activeVehicle && _vehicleArmed && !_vehicleFlying - property bool showRTL: _activeVehicle && _vehicleArmed && _activeVehicle.guidedModeSupported && _vehicleFlying && !_vehicleInRTLMode - property bool showTakeoff: _activeVehicle && _activeVehicle.takeoffVehicleSupported && !_vehicleFlying - 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 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 + property bool showEmergenyStop: _guidedActionsEnabled && !_hideEmergenyStop && _vehicleArmed && _vehicleFlying + property bool showArm: _guidedActionsEnabled && !_vehicleArmed + property bool showDisarm: _guidedActionsEnabled && _vehicleArmed && !_vehicleFlying + property bool showRTL: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.guidedModeSupported && _vehicleFlying && !_vehicleInRTLMode + property bool showTakeoff: _guidedActionsEnabled && _activeVehicle.takeoffVehicleSupported && !_vehicleFlying + property bool showLand: _guidedActionsEnabled && _activeVehicle.guidedModeSupported && _vehicleArmed && !_activeVehicle.fixedWing && !_vehicleInLandMode + property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying + property bool showContinueMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && _vehicleFlying && (_currentMissionIndex < missionController.visualItems.count - 1) + property bool showPause: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused + property bool showChangeAlt: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.guidedModeSupported && _vehicleArmed && !_missionActive + property bool showOrbit: _guidedActionsEnabled && !_hideOrbit && _vehicleFlying && _activeVehicle.orbitModeSupported && _vehicleArmed && !_missionActive + property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.fixedWing && _vehicleLanding + property bool showGotoLocation: _guidedActionsEnabled && _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 bool _guidedActionsEnabled: (QGroundControl.corePlugin.options.guidedActionsRequireRCRSSI && _activeVehicle) ? _rcRSSIAvailable : _activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property string _flightMode: _activeVehicle ? _activeVehicle.flightMode : "" property bool _missionAvailable: missionController.containsItems @@ -128,6 +129,7 @@ Item { property bool _hideEmergenyStop: !QGroundControl.corePlugin.options.guidedBarShowEmergencyStop property bool _hideOrbit: !QGroundControl.corePlugin.options.guidedBarShowOrbit property bool _vehicleWasFlying: false + property bool _rcRSSIAvailable: _activeVehicle ? _activeVehicle.rcRSSI > 0 && _activeVehicle.rcRSSI < 255 : false /* //Handy code for debugging state problems @@ -193,7 +195,7 @@ Item { _actionData = actionData switch (actionCode) { case actionArm: - if (_vehicleFlying) { + if (_vehicleFlying || !_guidedActionsEnabled) { return } confirmDialog.title = armTitle diff --git a/src/api/QGCCorePlugin.h b/src/api/QGCCorePlugin.h index 193253cc560b126aa95175861044562d852ca396..b5d6006f64c35e6dd1406dabe3cc157354aba15c 100644 --- a/src/api/QGCCorePlugin.h +++ b/src/api/QGCCorePlugin.h @@ -21,8 +21,6 @@ /// @brief Core Plugin Interface for QGroundControl /// @author Gus Grubba -// Work In Progress - class QGCApplication; class QGCOptions; class QGCSettings; @@ -33,6 +31,7 @@ class QQmlApplicationEngine; class Vehicle; class LinkInterface; class QmlObjectListModel; + class QGCCorePlugin : public QGCTool { Q_OBJECT diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index 9d06d00bdb2fa6161f5befda061623ddd8984fa6..d6249f745e494018ca904eff5f761b3539ae5ae7 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -46,6 +46,7 @@ public: Q_PROPERTY(bool showOfflineMapImport READ showOfflineMapImport NOTIFY showOfflineMapImportChanged) Q_PROPERTY(bool useMobileFileDialog READ useMobileFileDialog CONSTANT) Q_PROPERTY(bool showMissionStatus READ showMissionStatus CONSTANT) + Q_PROPERTY(bool guidedActionsRequireRCRSSI READ guidedActionsRequireRCRSSI CONSTANT) /// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)? /// @return true if QGC should consolidate both menus into one. @@ -82,6 +83,7 @@ public: virtual bool guidedBarShowOrbit () const { return true; } virtual bool missionWaypointsOnly () const { return false; } ///< true: Only allow waypoints and complex items in Plan virtual bool multiVehicleEnabled () const { return true; } ///< false: multi vehicle support is disabled + virtual bool guidedActionsRequireRCRSSI () const { return false; } ///< true: Guided actions will be disabled is there is no RC RSSI #if defined(__mobile__) virtual bool showOfflineMapExport () const { return false; }