Commit c808cb97 authored by Jacob Walser's avatar Jacob Walser

Rework Sub Safety setup

parent b6a1d413
...@@ -12,6 +12,7 @@ import QtQuick 2.3 ...@@ -12,6 +12,7 @@ import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QGroundControl 1.0
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0 import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
...@@ -34,21 +35,27 @@ SetupPage { ...@@ -34,21 +35,27 @@ SetupPage {
QGCPalette { id: ggcPal; colorGroupEnabled: true } QGCPalette { id: ggcPal; colorGroupEnabled: true }
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE") property bool _firmware34: _activeVehicle.firmwareMajorVersion == 3 && _activeVehicle.firmwareMinorVersion == 4
property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
property Fact _failsafePressureValue: controller.getParameterFact(-1, "FS_PRESS_MAX") // Enable/Action parameters
property Fact _failsafeTempEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE") property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE")
property Fact _failsafeTempValue: controller.getParameterFact(-1, "FS_TEMP_MAX") property Fact _failsafeEKFEnable: controller.getParameterFact(-1, "FS_EKF_ACTION")
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
property Fact _fenceAltMax: controller.getParameterFact(-1, "r.FENCE_ALT_MIN") property Fact _failsafePilotEnable: controller.getParameterFact(-1, "FS_PILOT_INPUT")
property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE") property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
property Fact _fenceMargin: controller.getParameterFact(-1, "FENCE_MARGIN") property Fact _failsafeTemperatureEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE")
property Fact _fenceType: controller.getParameterFact(-1, "FENCE_TYPE")
// Threshold parameters
property Fact _leakPin: controller.getParameterFact(-1, "LEAK1_PIN") property Fact _failsafePressureThreshold: controller.getParameterFact(-1, "FS_PRESS_MAX")
property Fact _leakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC") property Fact _failsafeTemperatureThreshold: controller.getParameterFact(-1, "FS_TEMP_MAX")
property Fact _failsafePilotTimeout: controller.getParameterFact(-1, "FS_PILOT_TIMEOUT")
property Fact _failsafeLeakPin: controller.getParameterFact(-1, "LEAK1_PIN")
property Fact _failsafeLeakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC")
property Fact _failsafeEKFThreshold: controller.getParameterFact(-1, "FS_EKF_THRESH")
property Fact _failsafeBatteryVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE")
property Fact _failsafeBatteryCapacity: controller.getParameterFact(-1, "FS_BATT_MAH")
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
...@@ -67,158 +74,264 @@ SetupPage { ...@@ -67,158 +74,264 @@ SetupPage {
} }
Rectangle { Rectangle {
id: failsafeSettings id: failsafeRectangle
width: leakEnableCombo.x + leakEnableCombo.width + _margins width: flowLayout.width
height: leakEnableCombo.y + leakEnableCombo.height + _margins height: childrenRect.height + _margins
color: ggcPal.windowShade color: ggcPal.windowShade
QGCLabel { Column {
id: gcsEnableLabel anchors.top: failsafeRectangle.top
anchors.margins: _margins anchors.left: failsafeRectangle.left
anchors.left: parent.left anchors.margins: _margins / 2
anchors.baseline: gcsEnableCombo.baseline property var _labelWidth: ScreenTools.defaultFontPixelWidth * 15
text: qsTr("Ground Station failsafe:") property var _editWidth: ScreenTools.defaultFontPixelWidth * 20
} id: failsafeSettings
spacing: ScreenTools.defaultFontPixelHeight
Row {
spacing: _margins / 2
QGCLabel {
id: gcsEnableLabel
width: failsafeSettings._labelWidth
anchors.baseline: gcsEnableCombo.baseline
text: qsTr("GCS Heartbeat:")
}
FactComboBox { FactComboBox {
id: gcsEnableCombo id: gcsEnableCombo
anchors.margins: _margins width: failsafeSettings._editWidth
anchors.left: gcsEnableLabel.right fact: _failsafeGCSEnable
anchors.top: parent.top indexModel: false
width: ScreenTools.defaultFontPixelWidth*15 }
fact: _failsafeGCSEnable }
indexModel: false
}
QGCLabel { Row {
id: leakEnableLabel spacing: _margins / 2
anchors.margins: _margins
anchors.left: parent.left
anchors.baseline: leakEnableCombo.baseline
text: qsTr("Leak failsafe:")
}
FactComboBox { QGCLabel {
id: leakEnableCombo id: leakEnableLabel
anchors.topMargin: _margins width: failsafeSettings._labelWidth
anchors.left: gcsEnableCombo.left anchors.baseline: leakEnableCombo.baseline
anchors.top: gcsEnableCombo.bottom text: qsTr("Leak:")
width: ScreenTools.defaultFontPixelWidth*15 }
fact: _failsafeLeakEnable
indexModel: false
}
} // Rectangle - Failsafe Settings
} // Column - Failsafe Settings
Column { FactComboBox {
spacing: _margins / 2 id: leakEnableCombo
width: failsafeSettings._editWidth
fact: _failsafeLeakEnable
indexModel: false
}
QGCLabel { QGCLabel {
id: geoFenceLabel text: "Detector Pin:"
text: qsTr("GeoFence") width: failsafeSettings._labelWidth
font.family: ScreenTools.demiboldFontFamily visible: leakEnableCombo.currentIndex != 0
} anchors.baseline: leakEnableCombo.baseline
}
Rectangle { FactComboBox {
id: geoFenceSettings width: failsafeSettings._editWidth
width: fenceAltMaxField.x + fenceAltMaxField.width + _margins visible: leakEnableCombo.currentIndex != 0
height: fenceAltMaxField.y + fenceAltMaxField.height + _margins anchors.baseline: leakEnableCombo.baseline
color: ggcPal.windowShade fact: _failsafeLeakPin
}
QGCCheckBox { QGCLabel {
id: altitudeGeo text: "Logic when Dry:"
anchors.margins: _margins width: failsafeSettings._labelWidth
anchors.left: parent.left visible: leakEnableCombo.currentIndex != 0
anchors.top: parent.top anchors.baseline: leakEnableCombo.baseline
text: qsTr("Depth GeoFence enabled\n(report only)") }
checked: _fenceEnable.value != 0 && _fenceType.value & 1
FactComboBox {
onClicked: { width: failsafeSettings._editWidth
if (checked) { visible: leakEnableCombo.currentIndex != 0
if (_fenceEnable.value == 1) { anchors.baseline: leakEnableCombo.baseline
_fenceType.value |= 1 fact: _failsafeLeakLogic
} else {
_fenceEnable.value = 1
_fenceType.value = 1
}
} else {
_fenceEnable.value = 0
_fenceType.value = 0
} }
} }
}
QGCLabel { Row {
id: fenceAltMaxLabel spacing: _margins / 2
anchors.left: altitudeGeo.left visible: !_firmware34
anchors.baseline: fenceAltMaxField.baseline
text: qsTr("Max depth:")
}
FactTextField { QGCLabel {
id: fenceAltMaxField id: batteryEnableLabel
anchors.topMargin: _margins / 2 width: failsafeSettings._labelWidth
anchors.leftMargin: _margins anchors.baseline: batteryEnableCombo.baseline
anchors.left: fenceAltMaxLabel.right text: qsTr("Battery:")
anchors.top: altitudeGeo.bottom }
fact: _fenceAltMax
showUnits: true
}
} // Rectangle - GeoFence Settings
} // Column - GeoFence Settings
Column { FactComboBox {
spacing: _margins / 2 id: batteryEnableCombo
width: failsafeSettings._editWidth
fact: _failsafeBatteryEnable
indexModel: false
}
QGCLabel { QGCLabel {
id: leakDetectorLabel text: "Voltage:"
text: qsTr("Leak Detector") width: failsafeSettings._labelWidth
font.family: ScreenTools.demiboldFontFamily visible: batteryEnableCombo.currentIndex != 0
} anchors.baseline: batteryEnableCombo.baseline
}
Rectangle { FactTextField {
id: leakDetectorSettings width: failsafeSettings._editWidth
width: leakLogicCombo.x + leakLogicCombo.width + _margins visible: batteryEnableCombo.currentIndex != 0
height: leakLogicCombo.y + leakLogicCombo.height + _margins anchors.baseline: batteryEnableCombo.baseline
color: ggcPal.windowShade fact: _failsafeBatteryVoltage
}
QGCLabel { QGCLabel {
id: leakPinLabel text: "Remaining Capacity:"
anchors.margins: _margins width: failsafeSettings._labelWidth
anchors.left: parent.left visible: batteryEnableCombo.currentIndex != 0
anchors.top: parent.top anchors.baseline: batteryEnableCombo.baseline
text: qsTr("Pin:") }
}
FactComboBox { FactTextField {
id: leakPinCombo width: failsafeSettings._editWidth
anchors.margins: _margins visible: batteryEnableCombo.currentIndex != 0
anchors.left: leakLogicLabel.right anchors.baseline: batteryEnableCombo.baseline
anchors.baseline: leakPinLabel.baseline fact: _failsafeBatteryCapacity
width: ScreenTools.defaultFontPixelWidth*15 }
fact: _leakPin }
indexModel: false
}
QGCLabel { Row {
id: leakLogicLabel spacing: _margins / 2
anchors.margins: _margins visible: !_firmware34
anchors.left: parent.left
anchors.top: leakPinLabel.bottom
text: qsTr("Logic (when dry):")
}
FactComboBox { QGCLabel {
id: leakLogicCombo id: ekfEnableLabel
anchors.margins: _margins width: failsafeSettings._labelWidth
anchors.left: leakLogicLabel.right anchors.baseline: ekfEnableCombo.baseline
anchors.baseline: leakLogicLabel.baseline text: qsTr("EKF:")
width: ScreenTools.defaultFontPixelWidth*15 }
fact: _leakLogic
indexModel: false FactComboBox {
} id: ekfEnableCombo
} // Rectangle - Leak Detector Settings width: failsafeSettings._editWidth
} // Column - Leak Detector Settings fact: _failsafeEKFEnable
indexModel: false
}
QGCLabel {
text: "Threshold:"
width: failsafeSettings._labelWidth
visible: ekfEnableCombo.currentIndex != 0
anchors.baseline: ekfEnableCombo.baseline
}
FactTextField {
width: failsafeSettings._editWidth
visible: ekfEnableCombo.currentIndex != 0
anchors.baseline: ekfEnableCombo.baseline
fact: _failsafeEKFThreshold
}
}
Row {
spacing: _margins / 2
visible: !_firmware34
QGCLabel {
id: pilotEnableLabel
width: failsafeSettings._labelWidth
anchors.baseline: pilotEnableCombo.baseline
text: qsTr("Pilot Input:")
}
FactComboBox {
id: pilotEnableCombo
width: failsafeSettings._editWidth
fact: _failsafePilotEnable
indexModel: false
}
QGCLabel {
text: "Timeout:"
width: failsafeSettings._labelWidth
visible: pilotEnableCombo.currentIndex != 0
anchors.baseline: pilotEnableCombo.baseline
}
FactTextField {
width: failsafeSettings._editWidth
visible: pilotEnableCombo.currentIndex != 0
anchors.baseline: pilotEnableCombo.baseline
fact: _failsafePilotTimeout
}
}
Row {
spacing: _margins / 2
QGCLabel {
id: temperatureEnableLabel
width: failsafeSettings._labelWidth
anchors.baseline: temperatureEnableCombo.baseline
text: qsTr("Internal Temperature:")
}
FactComboBox {
id: temperatureEnableCombo
width: failsafeSettings._editWidth
fact: _failsafeTemperatureEnable
indexModel: false
}
QGCLabel {
text: "Threshold:"
width: failsafeSettings._labelWidth
visible: temperatureEnableCombo.currentIndex != 0
anchors.baseline: temperatureEnableCombo.baseline
}
FactTextField {
width: failsafeSettings._editWidth
visible: temperatureEnableCombo.currentIndex != 0
anchors.baseline: temperatureEnableCombo.baseline
fact: _failsafeTemperatureThreshold
}
}
Row {
spacing: _margins / 2
QGCLabel {
id: pressureEnableLabel
width: failsafeSettings._labelWidth
anchors.baseline: pressureEnableCombo.baseline
text: qsTr("Internal Pressure:")
}
FactComboBox {
id: pressureEnableCombo
width: failsafeSettings._editWidth
fact: _failsafePressureEnable
indexModel: false
}
QGCLabel {
text: "Threshold:"
width: failsafeSettings._labelWidth
visible: pressureEnableCombo.currentIndex != 0
anchors.baseline: pressureEnableCombo.baseline
}
FactTextField {
width: failsafeSettings._editWidth
visible: pressureEnableCombo.currentIndex != 0
anchors.baseline: pressureEnableCombo.baseline
fact: _failsafePressureThreshold
}
}
} // Column - Failsafe Settings
}// Rectangle - Failsafe Settings
} // Column - Failsafe Settings
Column { Column {
spacing: _margins / 2 spacing: _margins / 2
......
...@@ -14,14 +14,24 @@ FactPanel { ...@@ -14,14 +14,24 @@ FactPanel {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel } FactPanelController { id: controller; factPanel: panel }
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") // Enable/Action parameters
property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE") property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE")
property Fact _failsafeEKFEnable: controller.getParameterFact(-1, "FS_EKF_ACTION")
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
property Fact _failsafePilotEnable: controller.getParameterFact(-1, "FS_PILOT_INPUT")
property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
property Fact _failsafeTemperatureEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE")
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") // Threshold parameters
property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE") property Fact _failsafePressureThreshold: controller.getParameterFact(-1, "FS_PRESS_MAX")
property Fact _fenceType: controller.getParameterFact(-1, "FENCE_TYPE") property Fact _failsafeTemperatureThreshold: controller.getParameterFact(-1, "FS_TEMP_MAX")
property Fact _failsafePilotTimeout: controller.getParameterFact(-1, "FS_PILOT_TIMEOUT")
property Fact _leakPin: controller.getParameterFact(-1, "LEAK1_PIN") property Fact _failsafeLeakPin: controller.getParameterFact(-1, "LEAK1_PIN")
property Fact _failsafeLeakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC")
property Fact _failsafeEKFThreshold: controller.getParameterFact(-1, "FS_EKF_THRESH")
property Fact _failsafeBatteryVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE")
property Fact _failsafeBatteryCapacity: controller.getParameterFact(-1, "FS_BATT_MAH")
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
...@@ -32,35 +42,33 @@ FactPanel { ...@@ -32,35 +42,33 @@ FactPanel {
labelText: qsTr("Arming Checks:") labelText: qsTr("Arming Checks:")
valueText: _armingCheck.value & 1 ? qsTr("Enabled") : qsTr("Some disabled") valueText: _armingCheck.value & 1 ? qsTr("Enabled") : qsTr("Some disabled")
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("GCS failsafe:") labelText: qsTr("GCS failsafe:")
valueText: _failsafeGCSEnable.enumOrValueString valueText: _failsafeGCSEnable.enumOrValueString
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Leak failsafe:") labelText: qsTr("Leak failsafe:")
valueText: _failsafeLeakEnable.enumOrValueString valueText: _failsafeLeakEnable.enumOrValueString
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Leak detector:") labelText: qsTr("Battery failsafe:")
valueText: _leakPin.enumOrValueString valueText: _failsafeBatteryEnable.enumOrValueString
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("GeoFence:") labelText: qsTr("EKF failsafe:")
valueText: _fenceEnable.value == 0 || _fenceType == 0 ? valueText: _failsafeEKFEnable.enumOrValueString
qsTr("Disabled") : }
(_fenceType.value == 1 ? VehicleSummaryRow {
qsTr("Depth") : labelText: qsTr("Pilot Input failsafe:")
(_fenceType.value == 2 ? qsTr("Circle") : qsTr("Depth,Circle"))) valueText: _failsafePilotEnable.enumOrValueString
}
VehicleSummaryRow {
labelText: qsTr("Int. Temperature failsafe:")
valueText: _failsafeTemperatureEnable.enumOrValueString
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("GeoFence:") labelText: qsTr("Int. Pressure failsafe:")
valueText: qsTr("Report only") valueText: _failsafePressureEnable.enumOrValueString
visible: _fenceEnable.value != 0
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment