From da45a4575419c0878f25e0bed30d770cfec3d377 Mon Sep 17 00:00:00 2001 From: Rustom Jehangir Date: Mon, 10 Oct 2016 15:00:00 -0700 Subject: [PATCH] Improve Sub safety page to match firmware capabilities --- .../APM/APMSafetyComponentSub.qml | 154 +++--------------- .../APM/APMSafetyComponentSummarySub.qml | 69 +++----- 2 files changed, 42 insertions(+), 181 deletions(-) diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml index 6582c5d3e1..a8ff1d10c1 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml @@ -28,11 +28,11 @@ QGCView { QGCPalette { id: ggcPal; colorGroupEnabled: enabled } property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") - property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE") - property Fact _failsafeBattMah: controller.getParameterFact(-1, "FS_BATT_MAH") - property Fact _failsafeBattVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE") - property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE") - property Fact _failsafeThrValue: controller.getParameterFact(-1, "FS_THR_VALUE") + property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE") + property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE") + property Fact _failsafePressureValue: controller.getParameterFact(-1, "FS_PRESS_MAX") + property Fact _failsafeTempEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE") + property Fact _failsafeTempValue: controller.getParameterFact(-1, "FS_TEMP_MAX") property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") property Fact _fenceAltMax: controller.getParameterFact(-1, "FENCE_ALT_MAX") @@ -70,14 +70,14 @@ QGCView { QGCLabel { id: failsafeLabel - text: qsTr("Failsafe Triggers") + text: qsTr("Failsafe Actions") font.family: ScreenTools.demiboldFontFamily } Rectangle { id: failsafeSettings - width: throttleEnableCombo.x + throttleEnableCombo.width + _margins - height: mahField.y + mahField.height + _margins + width: leakEnableCombo.x + leakEnableCombo.width + _margins + height: leakEnableCombo.y + leakEnableCombo.height + _margins color: ggcPal.windowShade QGCLabel { @@ -90,111 +90,30 @@ QGCView { FactComboBox { id: gcsEnableCombo - anchors.topMargin: _margins - anchors.leftMargin: _margins + anchors.margins: _margins anchors.left: gcsEnableLabel.right anchors.top: parent.top - width: voltageField.width + width: ScreenTools.defaultFontPixelWidth*15 fact: _failsafeGCSEnable indexModel: false } QGCLabel { - id: throttleEnableLabel + id: leakEnableLabel anchors.margins: _margins anchors.left: parent.left - anchors.baseline: throttleEnableCombo.baseline - text: qsTr("Throttle failsafe:") + anchors.baseline: leakEnableCombo.baseline + text: qsTr("Leak failsafe:") } - QGCComboBox { - id: throttleEnableCombo + FactComboBox { + id: leakEnableCombo anchors.topMargin: _margins anchors.left: gcsEnableCombo.left anchors.top: gcsEnableCombo.bottom - width: voltageField.width - model: [qsTr("Disabled"), qsTr("Always RTL"), - qsTr("Continue with Mission in Auto Mode"), qsTr("Always Land")] - currentIndex: _failsafeThrEnable.value - - onActivated: _failsafeThrEnable.value = index - } - - QGCLabel { - id: throttlePWMLabel - anchors.margins: _margins - anchors.left: parent.left - anchors.baseline: throttlePWMField.baseline - text: qsTr("PWM threshold:") - } - - FactTextField { - id: throttlePWMField - anchors.topMargin: _margins / 2 - anchors.left: gcsEnableCombo.left - anchors.top: throttleEnableCombo.bottom - fact: _failsafeThrValue - showUnits: true - } - - QGCLabel { - id: batteryEnableLabel - anchors.margins: _margins - anchors.left: parent.left - anchors.baseline: batteryEnableCombo.baseline - text: qsTr("Battery failsafe:") - } - - QGCComboBox { - id: batteryEnableCombo - anchors.topMargin: _margins - anchors.left: gcsEnableCombo.left - anchors.top: throttlePWMField.bottom - width: voltageField.width - model: [qsTr("Disabled"), qsTr("Land"), qsTr("Return to Launch")] - currentIndex: _failsafeBattEnable.value - - onActivated: _failsafeBattEnable.value = index - } - - QGCCheckBox { - id: voltageLabel - anchors.margins: _margins - anchors.left: parent.left - anchors.baseline: voltageField.baseline - text: qsTr("Voltage threshold:") - checked: _failsafeBattVoltage.value != 0 - - onClicked: _failsafeBattVoltage.value = checked ? 10.5 : 0 - } - - FactTextField { - id: voltageField - anchors.topMargin: _margins / 2 - anchors.left: gcsEnableCombo.left - anchors.top: batteryEnableCombo.bottom - fact: _failsafeBattVoltage - showUnits: true - } - - QGCCheckBox { - id: mahLabel - anchors.margins: _margins - anchors.left: parent.left - anchors.baseline: mahField.baseline - text: qsTr("MAH threshold:") - checked: _failsafeBattMah.value != 0 - - onClicked: _failsafeBattMah.value = checked ? 600 : 0 - } - - FactTextField { - id: mahField - anchors.topMargin: _margins / 2 - anchors.left: gcsEnableCombo.left - anchors.top: voltageField.bottom - fact: _failsafeBattMah - showUnits: true + width: ScreenTools.defaultFontPixelWidth*15 + fact: _failsafeLeakEnable + indexModel: false } } // Rectangle - Failsafe Settings } // Column - Failsafe Settings @@ -216,11 +135,10 @@ QGCView { QGCCheckBox { id: altitudeGeo - enabled: false anchors.margins: _margins anchors.left: parent.left anchors.top: parent.top - text: qsTr("Depth GeoFence enabled") + text: qsTr("Depth GeoFence enabled\n(report only)") checked: _fenceEnable.value != 0 && _fenceType.value & 1 onClicked: { @@ -238,35 +156,8 @@ QGCView { } } - QGCRadioButton { - id: geoReportRadio - enabled: false - anchors.margins: _margins - anchors.left: parent.left - anchors.top: altitudeGeo.bottom - text: qsTr("Report only") - exclusiveGroup: fenceActionRadioGroup - checked: _fenceAction.value == 0 - - onClicked: _fenceAction.value = 0 - } - - QGCRadioButton { - id: geoRTLRadio - enabled: false - anchors.topMargin: _margins / 2 - anchors.left: altitudeGeo.left - anchors.top: geoReportRadio.bottom - text: qsTr("RTL or Land") - exclusiveGroup: fenceActionRadioGroup - checked: _fenceAction.value == 1 - - onClicked: _fenceAction.value = 1 - } - QGCLabel { id: fenceAltMaxLabel - enabled: false anchors.left: altitudeGeo.left anchors.baseline: fenceAltMaxField.baseline text: qsTr("Max depth:") @@ -274,11 +165,10 @@ QGCView { FactTextField { id: fenceAltMaxField - enabled: false anchors.topMargin: _margins / 2 anchors.leftMargin: _margins anchors.left: fenceAltMaxLabel.right - anchors.top: geoRTLRadio.bottom + anchors.top: altitudeGeo.bottom fact: _fenceAltMax showUnits: true } @@ -313,7 +203,7 @@ QGCView { anchors.margins: _margins anchors.left: leakLogicLabel.right anchors.baseline: leakPinLabel.baseline - width: voltageField.width + width: ScreenTools.defaultFontPixelWidth*15 fact: _leakPin indexModel: false } @@ -331,7 +221,7 @@ QGCView { anchors.margins: _margins anchors.left: leakLogicLabel.right anchors.baseline: leakLogicLabel.baseline - width: voltageField.width + width: ScreenTools.defaultFontPixelWidth*15 fact: _leakLogic indexModel: false } diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml index d97e032c75..a50f85a876 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml @@ -14,69 +14,42 @@ FactPanel { QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; factPanel: panel } - property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE") - property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE") + property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") + property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE") property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE") property Fact _fenceType: controller.getParameterFact(-1, "FENCE_TYPE") - property Fact _leakPin: controller.getParameterFact(-1, "WD_1_PIN") + property Fact _leakPin: controller.getParameterFact(-1, "WD_1_PIN") property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") - property string _failsafeBattEnableText - property string _failsafeThrEnableText + property string _failsafeGCSEnableText Component.onCompleted: { - setFailsafeBattEnableText() - setFailsafeThrEnableText() + setFailsafeGCSEnableText() } Connections { - target: _failsafeBattEnable + target: _failsafeGCSEnable - onValueChanged: setFailsafeBattEnableText() + onValueChanged: setFailsafeGCSEnableText() } - Connections { - target: _failsafeThrEnable - - onValueChanged: setFailsafeThrEnableText() - } - - function setFailsafeThrEnableText() { - switch (_failsafeThrEnable.value) { - case 0: - _failsafeThrEnableText = qsTr("Disabled") - break - case 1: - _failsafeThrEnableText = qsTr("Always RTL") - break - case 2: - _failsafeThrEnableText = qsTr("Continue with Mission in Auto Mode") - break - case 3: - _failsafeThrEnableText = qsTr("Always Land") - break - default: - _failsafeThrEnableText = qsTr("Unknown") - } - } - - function setFailsafeBattEnableText() { - switch (_failsafeBattEnable.value) { + function setFailsafeGCSEnableText() { + switch (_failsafeGCSEnable.value) { case 0: - _failsafeBattEnableText = qsTr("Disabled") + _failsafeGCSEnableText = qsTr("Disabled") break case 1: - _failsafeBattEnableText = qsTr("Land") + _failsafeGCSEnableText = qsTr("Always RTL") break case 2: - _failsafeBattEnableText = qsTr("Return to Launch") + _failsafeGCSEnableText = qsTr("Continue with Mission in Auto Mode") break default: - _failsafeThrEnableText = qsTr("Unknown") + _failsafeGCSEnableText = qsTr("Unknown") } } @@ -89,13 +62,13 @@ FactPanel { } VehicleSummaryRow { - labelText: qsTr("Throttle failsafe:") - valueText: _failsafeThrEnableText + labelText: qsTr("GCS failsafe:") + valueText: _failsafeGCSEnableText } VehicleSummaryRow { - labelText: qsTr("Battery failsafe:") - valueText: _failsafeBattEnableText + labelText: qsTr("Leak failsafe:") + valueText: _failsafeLeakEnable.value ? qsTr("Enabled") : qsTr("Disabled") } VehicleSummaryRow { @@ -108,15 +81,13 @@ FactPanel { valueText: _fenceEnable.value == 0 || _fenceType == 0 ? qsTr("Disabled") : (_fenceType.value == 1 ? - qsTr("Altitude") : - (_fenceType.value == 2 ? qsTr("Circle") : qsTr("Altitude,Circle"))) + qsTr("Depth") : + (_fenceType.value == 2 ? qsTr("Circle") : qsTr("Depth,Circle"))) } VehicleSummaryRow { labelText: qsTr("GeoFence:") - valueText: _fenceAction.value == 0 ? - qsTr("Report only") : - (_fenceAction.value == 1 ? qsTr("RTL or Land") : qsTr("Unknown")) + valueText: qsTr("Report only") visible: _fenceEnable.value != 0 } } -- GitLab