diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 382bda2294b2d41ee30168a887db080b4b3c29ee..3faa8c84614c649b5491b6bde7461de910107950 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -49,6 +49,8 @@ Item { property var _rallyPointController: _planController.rallyPointController property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length + property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue + property bool _canArm: activeVehicle ? (_useChecklist ? (_enforceChecklist ? activeVehicle.checkListState === Vehicle.CheckListPassed : true) : true) : false property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _pipSize: mainWindow.width * 0.2 property alias _guidedController: guidedActionsController @@ -595,7 +597,7 @@ Item { name: _guidedController.takeoffTitle, iconSource: "/res/takeoff.svg", buttonVisible: _guidedController.showTakeoff || !_guidedController.showLand, - buttonEnabled: _guidedController.showTakeoff, + buttonEnabled: _guidedController.showTakeoff && _canArm, action: _guidedController.actionTakeoff }, { @@ -623,7 +625,7 @@ Item { name: qsTr("Action"), iconSource: "/res/action.svg", buttonVisible: !_guidedController.showPause, - buttonEnabled: _anyActionAvailable, + buttonEnabled: _anyActionAvailable && _canArm, action: -1 } ] @@ -657,7 +659,7 @@ Item { z: _flightVideoPipControl.z + 1 onShowStartMissionChanged: { - if (showStartMission) { + if (showStartMission && _canArm) { confirmAction(actionStartMission) } } diff --git a/src/Settings/App.SettingsGroup.json b/src/Settings/App.SettingsGroup.json index 18eae1e6aa1bff620c031d7ccf3d0f764ca6663f..945ec524553db6ed3c261c4a1d45db8e60399a47 100644 --- a/src/Settings/App.SettingsGroup.json +++ b/src/Settings/App.SettingsGroup.json @@ -138,6 +138,13 @@ "type": "bool", "defaultValue": false }, +{ + "name": "enforceChecklist", + "shortDescription": "Preflight checklist must pass before arming", + "longDescription": "If this option is enabled the preflight checklist must pass before arming.", + "type": "bool", + "defaultValue": false +}, { "name": "appFontPointSize", "shortDescription": "Application font size", diff --git a/src/Settings/AppSettings.cc b/src/Settings/AppSettings.cc index 278ee95c3f2ba0c6f9f41373c986aededf052fb9..67e199dbb073bb81e6e02c910753c4c2e5d8a60a 100644 --- a/src/Settings/AppSettings.cc +++ b/src/Settings/AppSettings.cc @@ -85,6 +85,7 @@ DECLARE_SETTINGSFACT(AppSettings, showLargeCompass) DECLARE_SETTINGSFACT(AppSettings, savePath) DECLARE_SETTINGSFACT(AppSettings, autoLoadMissions) DECLARE_SETTINGSFACT(AppSettings, useChecklist) +DECLARE_SETTINGSFACT(AppSettings, enforceChecklist) DECLARE_SETTINGSFACT(AppSettings, mapboxToken) DECLARE_SETTINGSFACT(AppSettings, esriToken) DECLARE_SETTINGSFACT(AppSettings, defaultFirmwareType) diff --git a/src/Settings/AppSettings.h b/src/Settings/AppSettings.h index b81d0b495296d645bcfea6e1d02162b202764f20..de4fa9049aa5e012f1ea6a8f8dc58e33b7fd7bb2 100644 --- a/src/Settings/AppSettings.h +++ b/src/Settings/AppSettings.h @@ -46,6 +46,7 @@ public: DEFINE_SETTINGFACT(savePath) DEFINE_SETTINGFACT(autoLoadMissions) DEFINE_SETTINGFACT(useChecklist) + DEFINE_SETTINGFACT(enforceChecklist) DEFINE_SETTINGFACT(mapboxToken) DEFINE_SETTINGFACT(esriToken) DEFINE_SETTINGFACT(defaultFirmwareType) diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index e223024bb03f1b259f8c269e3efebb18ca585a43..7014a7a0905402e2227ba2b3da1cc92718ff447d 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -475,13 +475,23 @@ Rectangle { spacing: _margins FactCheckBox { - text: qsTr("Use Preflight Checklist") - fact: _useChecklist - visible: _useChecklist.visible && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length + id: useCheckList + text: qsTr("Use Preflight Checklist") + fact: _useChecklist + visible: _useChecklist.visible && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist } + FactCheckBox { + text: qsTr("Enforce Preflight Checklist") + fact: _enforceChecklist + enabled: QGroundControl.settingsManager.appSettings.useChecklist.value + visible: useCheckList.visible && _enforceChecklist.visible && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length + + property Fact _enforceChecklist: QGroundControl.settingsManager.appSettings.enforceChecklist + } + FactCheckBox { text: qsTr("Keep Map Centered On Vehicle") fact: _keepMapCenteredOnVehicle