Browse Source

Improve Sub safety page to match firmware capabilities

QGC4.4
Rustom Jehangir 9 years ago
parent
commit
da45a45754
  1. 154
      src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml
  2. 67
      src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml

154
src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml

@ -28,11 +28,11 @@ QGCView {
QGCPalette { id: ggcPal; colorGroupEnabled: enabled } QGCPalette { id: ggcPal; colorGroupEnabled: enabled }
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE") property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
property Fact _failsafeBattMah: controller.getParameterFact(-1, "FS_BATT_MAH") property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
property Fact _failsafeBattVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE") property Fact _failsafePressureValue: controller.getParameterFact(-1, "FS_PRESS_MAX")
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE") property Fact _failsafeTempEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE")
property Fact _failsafeThrValue: controller.getParameterFact(-1, "FS_THR_VALUE") property Fact _failsafeTempValue: controller.getParameterFact(-1, "FS_TEMP_MAX")
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION")
property Fact _fenceAltMax: controller.getParameterFact(-1, "FENCE_ALT_MAX") property Fact _fenceAltMax: controller.getParameterFact(-1, "FENCE_ALT_MAX")
@ -70,14 +70,14 @@ QGCView {
QGCLabel { QGCLabel {
id: failsafeLabel id: failsafeLabel
text: qsTr("Failsafe Triggers") text: qsTr("Failsafe Actions")
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
} }
Rectangle { Rectangle {
id: failsafeSettings id: failsafeSettings
width: throttleEnableCombo.x + throttleEnableCombo.width + _margins width: leakEnableCombo.x + leakEnableCombo.width + _margins
height: mahField.y + mahField.height + _margins height: leakEnableCombo.y + leakEnableCombo.height + _margins
color: ggcPal.windowShade color: ggcPal.windowShade
QGCLabel { QGCLabel {
@ -90,111 +90,30 @@ QGCView {
FactComboBox { FactComboBox {
id: gcsEnableCombo id: gcsEnableCombo
anchors.topMargin: _margins anchors.margins: _margins
anchors.leftMargin: _margins
anchors.left: gcsEnableLabel.right anchors.left: gcsEnableLabel.right
anchors.top: parent.top anchors.top: parent.top
width: voltageField.width width: ScreenTools.defaultFontPixelWidth*15
fact: _failsafeGCSEnable fact: _failsafeGCSEnable
indexModel: false indexModel: false
} }
QGCLabel { QGCLabel {
id: throttleEnableLabel id: leakEnableLabel
anchors.margins: _margins anchors.margins: _margins
anchors.left: parent.left anchors.left: parent.left
anchors.baseline: throttleEnableCombo.baseline anchors.baseline: leakEnableCombo.baseline
text: qsTr("Throttle failsafe:") text: qsTr("Leak failsafe:")
} }
QGCComboBox { FactComboBox {
id: throttleEnableCombo id: leakEnableCombo
anchors.topMargin: _margins anchors.topMargin: _margins
anchors.left: gcsEnableCombo.left anchors.left: gcsEnableCombo.left
anchors.top: gcsEnableCombo.bottom anchors.top: gcsEnableCombo.bottom
width: voltageField.width width: ScreenTools.defaultFontPixelWidth*15
model: [qsTr("Disabled"), qsTr("Always RTL"), fact: _failsafeLeakEnable
qsTr("Continue with Mission in Auto Mode"), qsTr("Always Land")] indexModel: false
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
} }
} // Rectangle - Failsafe Settings } // Rectangle - Failsafe Settings
} // Column - Failsafe Settings } // Column - Failsafe Settings
@ -216,11 +135,10 @@ QGCView {
QGCCheckBox { QGCCheckBox {
id: altitudeGeo id: altitudeGeo
enabled: false
anchors.margins: _margins anchors.margins: _margins
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
text: qsTr("Depth GeoFence enabled") text: qsTr("Depth GeoFence enabled\n(report only)")
checked: _fenceEnable.value != 0 && _fenceType.value & 1 checked: _fenceEnable.value != 0 && _fenceType.value & 1
onClicked: { 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 { QGCLabel {
id: fenceAltMaxLabel id: fenceAltMaxLabel
enabled: false
anchors.left: altitudeGeo.left anchors.left: altitudeGeo.left
anchors.baseline: fenceAltMaxField.baseline anchors.baseline: fenceAltMaxField.baseline
text: qsTr("Max depth:") text: qsTr("Max depth:")
@ -274,11 +165,10 @@ QGCView {
FactTextField { FactTextField {
id: fenceAltMaxField id: fenceAltMaxField
enabled: false
anchors.topMargin: _margins / 2 anchors.topMargin: _margins / 2
anchors.leftMargin: _margins anchors.leftMargin: _margins
anchors.left: fenceAltMaxLabel.right anchors.left: fenceAltMaxLabel.right
anchors.top: geoRTLRadio.bottom anchors.top: altitudeGeo.bottom
fact: _fenceAltMax fact: _fenceAltMax
showUnits: true showUnits: true
} }
@ -313,7 +203,7 @@ QGCView {
anchors.margins: _margins anchors.margins: _margins
anchors.left: leakLogicLabel.right anchors.left: leakLogicLabel.right
anchors.baseline: leakPinLabel.baseline anchors.baseline: leakPinLabel.baseline
width: voltageField.width width: ScreenTools.defaultFontPixelWidth*15
fact: _leakPin fact: _leakPin
indexModel: false indexModel: false
} }
@ -331,7 +221,7 @@ QGCView {
anchors.margins: _margins anchors.margins: _margins
anchors.left: leakLogicLabel.right anchors.left: leakLogicLabel.right
anchors.baseline: leakLogicLabel.baseline anchors.baseline: leakLogicLabel.baseline
width: voltageField.width width: ScreenTools.defaultFontPixelWidth*15
fact: _leakLogic fact: _leakLogic
indexModel: false indexModel: false
} }

67
src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml

@ -14,8 +14,8 @@ FactPanel {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel } FactPanelController { id: controller; factPanel: panel }
property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE") property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE") property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION")
property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE") property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE")
@ -25,58 +25,31 @@ FactPanel {
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
property string _failsafeBattEnableText property string _failsafeGCSEnableText
property string _failsafeThrEnableText
Component.onCompleted: { Component.onCompleted: {
setFailsafeBattEnableText() setFailsafeGCSEnableText()
setFailsafeThrEnableText()
} }
Connections { Connections {
target: _failsafeBattEnable target: _failsafeGCSEnable
onValueChanged: setFailsafeBattEnableText() onValueChanged: setFailsafeGCSEnableText()
} }
Connections { function setFailsafeGCSEnableText() {
target: _failsafeThrEnable switch (_failsafeGCSEnable.value) {
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) {
case 0: case 0:
_failsafeBattEnableText = qsTr("Disabled") _failsafeGCSEnableText = qsTr("Disabled")
break break
case 1: case 1:
_failsafeBattEnableText = qsTr("Land") _failsafeGCSEnableText = qsTr("Always RTL")
break break
case 2: case 2:
_failsafeBattEnableText = qsTr("Return to Launch") _failsafeGCSEnableText = qsTr("Continue with Mission in Auto Mode")
break break
default: default:
_failsafeThrEnableText = qsTr("Unknown") _failsafeGCSEnableText = qsTr("Unknown")
} }
} }
@ -89,13 +62,13 @@ FactPanel {
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Throttle failsafe:") labelText: qsTr("GCS failsafe:")
valueText: _failsafeThrEnableText valueText: _failsafeGCSEnableText
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Battery failsafe:") labelText: qsTr("Leak failsafe:")
valueText: _failsafeBattEnableText valueText: _failsafeLeakEnable.value ? qsTr("Enabled") : qsTr("Disabled")
} }
VehicleSummaryRow { VehicleSummaryRow {
@ -108,15 +81,13 @@ FactPanel {
valueText: _fenceEnable.value == 0 || _fenceType == 0 ? valueText: _fenceEnable.value == 0 || _fenceType == 0 ?
qsTr("Disabled") : qsTr("Disabled") :
(_fenceType.value == 1 ? (_fenceType.value == 1 ?
qsTr("Altitude") : qsTr("Depth") :
(_fenceType.value == 2 ? qsTr("Circle") : qsTr("Altitude,Circle"))) (_fenceType.value == 2 ? qsTr("Circle") : qsTr("Depth,Circle")))
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("GeoFence:") labelText: qsTr("GeoFence:")
valueText: _fenceAction.value == 0 ? valueText: qsTr("Report only")
qsTr("Report only") :
(_fenceAction.value == 1 ? qsTr("RTL or Land") : qsTr("Unknown"))
visible: _fenceEnable.value != 0 visible: _fenceEnable.value != 0
} }
} }

Loading…
Cancel
Save