Commit 9dd768a3 authored by DonLakeFlyer's avatar DonLakeFlyer

Even more PreFlight reorg/support

parent 0801e473
...@@ -154,11 +154,11 @@ ...@@ -154,11 +154,11 @@
<file alias="QGroundControl/FlightDisplay/GuidedActionsController.qml">src/FlightDisplay/GuidedActionsController.qml</file> <file alias="QGroundControl/FlightDisplay/GuidedActionsController.qml">src/FlightDisplay/GuidedActionsController.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedAltitudeSlider.qml">src/FlightDisplay/GuidedAltitudeSlider.qml</file> <file alias="QGroundControl/FlightDisplay/GuidedAltitudeSlider.qml">src/FlightDisplay/GuidedAltitudeSlider.qml</file>
<file alias="QGroundControl/FlightDisplay/MultiVehicleList.qml">src/FlightDisplay/MultiVehicleList.qml</file> <file alias="QGroundControl/FlightDisplay/MultiVehicleList.qml">src/FlightDisplay/MultiVehicleList.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightAHRSCheck.qml">src/FlightDisplay/PreFlightAHRSCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightBatteryCheck.qml">src/FlightDisplay/PreFlightBatteryCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightBatteryCheck.qml">src/FlightDisplay/PreFlightBatteryCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightCheckModel.qml">src/FlightDisplay/PreFlightCheckModel.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightCheckModel.qml">src/FlightDisplay/PreFlightCheckModel.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightGPSCheck.qml">src/FlightDisplay/PreFlightGPSCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightRCCheck.qml">src/FlightDisplay/PreFlightRCCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightRCCheck.qml">src/FlightDisplay/PreFlightRCCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightSensorsCheck.qml">src/FlightDisplay/PreFlightSensorsCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightSensorsHealthCheck.qml">src/FlightDisplay/PreFlightSensorsHealthCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightSoundCheck.qml">src/FlightDisplay/PreFlightSoundCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightSoundCheck.qml">src/FlightDisplay/PreFlightSoundCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file> <file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file>
<file alias="QGroundControl/FlightMap/CameraTriggerIndicator.qml">src/FlightMap/MapItems/CameraTriggerIndicator.qml</file> <file alias="QGroundControl/FlightMap/CameraTriggerIndicator.qml">src/FlightMap/MapItems/CameraTriggerIndicator.qml</file>
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.3
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Vehicle 1.0
PreFlightCheckButton {
name: qsTr("Global position estimate")
telemetryTextFailure: qsTr("AHRS Unhealthy. Check console.")
telemetryFailure: _unhealthySensors & Vehicle.SysStatusSensorAHRS
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
}
...@@ -15,17 +15,18 @@ import QGroundControl.Vehicle 1.0 ...@@ -15,17 +15,18 @@ import QGroundControl.Vehicle 1.0
// This class stores the data and functions of the check list but NOT the GUI (which is handled somewhere else). // This class stores the data and functions of the check list but NOT the GUI (which is handled somewhere else).
PreFlightCheckButton { PreFlightCheckButton {
name: qsTr("Battery") name: qsTr("Battery")
manualText: qsTr("Healthy & charged > %1. Battery connector firmly plugged?").arg(failureVoltage) manualText: qsTr("Battery connector firmly plugged?")
telemetryTextFailure: _batUnHealthy ? telemetryFailure: _batLow
qsTr("Not healthy. Check console.") : telemetryTextFailure: allowTelemetryFailureOverride ?
("Low (below %1). Please recharge.").arg(failureVoltage) qsTr("Warning - Battery charge below %1%.").arg(failurePercent) :
qsTr("Battery charge below %1%. Please recharge.").arg(failurePercent)
allowTelemetryFailureOverride: allowFailurePercentOverride
property int failureVoltage: 40 property int failurePercent: 40
property bool allowFailurePercentOverride: false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property var _batPercentRemaining: _activeVehicle ? _activeVehicle.battery.percentRemaining.value : 0 property var _batPercentRemaining: _activeVehicle ? _activeVehicle.battery.percentRemaining.value : 0
property bool _batUnHealthy: _unhealthySensors & Vehicle.SysStatusSensorBattery property bool _batLow: _batPercentRemaining < failurePercent
property bool _batLow: _batPercentRemaining < failureVoltage
} }
...@@ -23,22 +23,24 @@ ObjectModel { ...@@ -23,22 +23,24 @@ ObjectModel {
// Standard check list items (group 0) - Available from the start // Standard check list items (group 0) - Available from the start
PreFlightCheckButton { PreFlightCheckButton {
id: buttonHardware
name: qsTr("Hardware") name: qsTr("Hardware")
manualText: qsTr("Props mounted? Wings secured? Tail secured?") manualText: qsTr("Props mounted? Wings secured? Tail secured?")
} }
PreFlightBatteryCheck { PreFlightBatteryCheck {
id: buttonBattery failurePercent: 40
failureVoltage: 40 allowFailurePercentOverride: false
} }
PreFlightSensorsCheck {
id: buttonSensors PreFlightSensorsHealthCheck {
} }
PreFlightRCCheck {
id: buttonRC PreFlightGPSCheck {
failureSatCount: 9
allowOverrideSatCount: true
} }
PreFlightAHRSCheck {
id: buttonEstimator PreFlightRCCheck {
} }
} }
...@@ -46,26 +48,21 @@ ObjectModel { ...@@ -46,26 +48,21 @@ ObjectModel {
name: qsTr("Please arm the vehicle here") name: qsTr("Please arm the vehicle here")
PreFlightCheckButton { PreFlightCheckButton {
id: buttonActuators
name: qsTr("Actuators") name: qsTr("Actuators")
group: 1
manualText: qsTr("Move all control surfaces. Did they work properly?") manualText: qsTr("Move all control surfaces. Did they work properly?")
} }
PreFlightCheckButton { PreFlightCheckButton {
id: buttonMotors
name: qsTr("Motors") name: qsTr("Motors")
group: 1
manualText: qsTr("Propellers free? Then throttle up gently. Working properly?") manualText: qsTr("Propellers free? Then throttle up gently. Working properly?")
} }
PreFlightCheckButton { PreFlightCheckButton {
id: buttonMission
name: qsTr("Mission") name: qsTr("Mission")
group: 1
manualText: qsTr("Please confirm mission is valid (waypoints valid, no terrain collision).") manualText: qsTr("Please confirm mission is valid (waypoints valid, no terrain collision).")
} }
PreFlightSoundCheck { PreFlightSoundCheck {
id: buttonSoundOutput
group: 1
} }
} }
...@@ -74,21 +71,17 @@ ObjectModel { ...@@ -74,21 +71,17 @@ ObjectModel {
// Check list item group 2 - Final checks before launch // Check list item group 2 - Final checks before launch
PreFlightCheckButton { PreFlightCheckButton {
id: buttonPayload
name: qsTr("Payload") name: qsTr("Payload")
group: 2
manualText: qsTr("Configured and started? Payload lid closed?") manualText: qsTr("Configured and started? Payload lid closed?")
} }
PreFlightCheckButton { PreFlightCheckButton {
id: buttonWeather
name: "Wind & weather" name: "Wind & weather"
group: 2
manualText: qsTr("OK for your platform? Lauching into the wind?") manualText: qsTr("OK for your platform? Lauching into the wind?")
} }
PreFlightCheckButton { PreFlightCheckButton {
id: buttonFlightAreaFree
name: qsTr("Flight area") name: qsTr("Flight area")
group: 2
manualText: qsTr("Launch area and path free of obstacles/people?") manualText: qsTr("Launch area and path free of obstacles/people?")
} }
} }
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.3
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Vehicle 1.0
PreFlightCheckButton {
name: qsTr("GPS")
telemetryFailure: _3dLockFailure || _satCountFailure
telemetryTextFailure: _3dLockFailure ?
qsTr("Waiting for 3D lock.") :
(_satCountFailure ? _satCountFailureText : "")
allowTelemetryFailureOverride: !_3dLockFailure && _satCountFailure && allowOverrideSatCount
property bool allowOverrideSatCount: false ///< true: sat count above failureSatCount reguired to pass, false: user can click past satCount <= failureSetCount
property int failureSatCount: -1 ///< -1 indicates no sat count check
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _3dLock: _activeVehicle ? _activeVehicle.gps.lock.rawValue >= 3 : false
property int _satCount: _activeVehicle ? _activeVehicle.gps.count.rawValue : 0
property bool _3dLockFailure: !_3dLock
property bool _satCountFailure: failureSatCount !== -1 && _satCount <= failureSatCount
property string _satCountFailureText: allowOverrideSatCount ? qsTr("Warning - Sat count below %1.").arg(failureSatCount + 1) : qsTr("Waiting for sat count above %1.").arg(failureSatCount)
}
...@@ -15,24 +15,18 @@ import QGroundControl.Vehicle 1.0 ...@@ -15,24 +15,18 @@ import QGroundControl.Vehicle 1.0
PreFlightCheckButton { PreFlightCheckButton {
name: qsTr("Sensors") name: qsTr("Sensors")
telemetryFailure: (_unhealthySensors & _allCheckedSensors) || !_gpsLock || _satCountFailure telemetryFailure: _unhealthySensors & _allCheckedSensors
property int failureSatCount: -1 ///< -1 indicates no sat count check
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0 property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property bool _gpsLock: _activeVehicle ? _activeVehicle.gps.lock.rawValue >= 3 : 0
property int _satCount: _activeVehicle ? _activeVehicle.gps.count.rawValue : 0
property bool _satCountFailure: failureSatCount !== -1 && _satCount <= failureSatCount
property int _allCheckedSensors: Vehicle.SysStatusSensor3dMag | property int _allCheckedSensors: Vehicle.SysStatusSensor3dMag |
Vehicle.SysStatusSensor3dAccel | Vehicle.SysStatusSensor3dAccel |
Vehicle.SysStatusSensor3dGyro | Vehicle.SysStatusSensor3dGyro |
Vehicle.SysStatusSensorAbsolutePressure | Vehicle.SysStatusSensorAbsolutePressure |
Vehicle.SysStatusSensorDifferentialPressure | Vehicle.SysStatusSensorDifferentialPressure |
Vehicle.SysStatusSensorGPS Vehicle.SysStatusSensorGPS |
Vehicle.SysStatusSensorAHRS
on_GpsLockChanged: updateTelemetryTextFailure()
on_SatCountFailureChanged: updateTelemetryTextFailure()
on_UnhealthySensorsChanged: updateTelemetryTextFailure() on_UnhealthySensorsChanged: updateTelemetryTextFailure()
Component.onCompleted: updateTelemetryTextFailure() Component.onCompleted: updateTelemetryTextFailure()
...@@ -44,11 +38,8 @@ PreFlightCheckButton { ...@@ -44,11 +38,8 @@ PreFlightCheckButton {
else if(_unhealthySensors & Vehicle.SysStatusSensor3dGyro) telemetryTextFailure = qsTr("Failure. Gyroscope issues. Check console.") else if(_unhealthySensors & Vehicle.SysStatusSensor3dGyro) telemetryTextFailure = qsTr("Failure. Gyroscope issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensorAbsolutePressure) telemetryTextFailure = qsTr("Failure. Barometer issues. Check console.") else if(_unhealthySensors & Vehicle.SysStatusSensorAbsolutePressure) telemetryTextFailure = qsTr("Failure. Barometer issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensorDifferentialPressure) telemetryTextFailure = qsTr("Failure. Airspeed sensor issues. Check console.") else if(_unhealthySensors & Vehicle.SysStatusSensorDifferentialPressure) telemetryTextFailure = qsTr("Failure. Airspeed sensor issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensorGPS) telemetryTextFailure = qsTr("Failure. No valid or low quality GPS signal. Check console.") else if(_unhealthySensors & Vehicle.SysStatusSensorAHRS) telemetryTextFailure = qsTr("Failure. AHRS issues. Check console.")
} else if (!_gpsLock) { else if(_unhealthySensors & Vehicle.SysStatusSensorGPS) telemetryTextFailure = qsTr("Failure. GPS issues. Check console.")
telemetryTextFailure = qsTr("Pending. Waiting for GPS lock.")
} else if (_satCountFailure) {
telemetryTextFailure = qsTr("Pending. Waiting for Sat Count > %1.").arg(failureSatCount)
} }
} }
} }
...@@ -10,9 +10,9 @@ GuidedActionList 1.0 GuidedActionList.qml ...@@ -10,9 +10,9 @@ GuidedActionList 1.0 GuidedActionList.qml
GuidedAltitudeSlider 1.0 GuidedAltitudeSlider.qml GuidedAltitudeSlider 1.0 GuidedAltitudeSlider.qml
MultiVehicleList 1.0 MultiVehicleList.qml MultiVehicleList 1.0 MultiVehicleList.qml
PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml
PreFlightAHRSCheck 1.0 PreFlightAHRSCheck.qml
PreFlightCheckModel 1.0 PreFlightCheckModel.qml PreFlightCheckModel 1.0 PreFlightCheckModel.qml
PreFlightGPSCheck 1.0 PreFlightGPSCheck.qml
PreFlightRCCheck 1.0 PreFlightRCCheck.qml PreFlightRCCheck 1.0 PreFlightRCCheck.qml
PreFlightSensorsCheck 1.0 PreFlightSensorsCheck.qml PreFlightSensorsHealthCheck 1.0 PreFlightSensorsHealthCheck.qml
PreFlightSoundCheck 1.0 PreFlightSoundCheck.qml PreFlightSoundCheck 1.0 PreFlightSoundCheck.qml
...@@ -35,8 +35,8 @@ Item { ...@@ -35,8 +35,8 @@ Item {
readonly property int dropUp: 3 readonly property int dropUp: 3
readonly property int dropDown: 4 readonly property int dropDown: 4
readonly property real _arrowBaseWidth: radius // Width of long side of arrow readonly property real _arrowBaseHeight: radius // Height of vertical side of arrow
readonly property real _arrowPointHeight: radius * 0.666 // Height is long side to point readonly property real _arrowPointWidth: radius * 0.666 // Distance from vertical side to point
readonly property real _dropCornerRadius: ScreenTools.defaultFontPixelWidth * 0.5 readonly property real _dropCornerRadius: ScreenTools.defaultFontPixelWidth * 0.5
readonly property real _dropCornerRadiusX2: _dropCornerRadius * 2 readonly property real _dropCornerRadiusX2: _dropCornerRadius * 2
readonly property real _dropMargin: _dropCornerRadius readonly property real _dropMargin: _dropCornerRadius
...@@ -44,9 +44,10 @@ Item { ...@@ -44,9 +44,10 @@ Item {
property var _dropEdgeTopPoint property var _dropEdgeTopPoint
property real _dropEdgeHeight property real _dropEdgeHeight
property alias _dropDownComponent: dropDownLoader.sourceComponent property alias _dropDownComponent: panelLoader.sourceComponent
property real _viewportMaxTop: 0 property real _viewportMaxTop: 0
property real _viewportMaxBottom: parent.parent.height - parent.y property real _viewportMaxBottom: parent.parent.height - parent.y
property real _viewportMaxHeight: _viewportMaxBottom - _viewportMaxTop
property var _dropPanelCancel property var _dropPanelCancel
function show(panelEdgeTopPoint, panelEdgeHeight, panelComponent) { function show(panelEdgeTopPoint, panelEdgeHeight, panelComponent) {
...@@ -70,37 +71,29 @@ Item { ...@@ -70,37 +71,29 @@ Item {
} }
function _calcPositions() { function _calcPositions() {
var dropComponentWidth = dropDownLoader.item.width var panelComponentWidth = panelLoader.item.width
var dropComponentHeight = dropDownLoader.item.height var panelComponentHeight = panelLoader.item.height
var dropRectWidth = dropComponentWidth + _dropMarginX2
var dropRectHeight = dropComponentHeight + _dropMarginX2
dropItemHolderRect.width = dropRectWidth dropDownItem.width = panelComponentWidth + _dropMarginX2 + _arrowPointWidth
dropItemHolderRect.height = dropRectHeight dropDownItem.height = panelComponentHeight + _dropMarginX2
dropDownItem.width = dropComponentWidth + _dropMarginX2
dropDownItem.height = dropComponentHeight + _dropMarginX2
dropDownItem.width += _arrowPointHeight
dropDownItem.y = _dropEdgeTopPoint.y -(dropDownItem.height / 2) + radius
dropItemHolderRect.y = 0
dropDownItem.x = _dropEdgeTopPoint.x + _dropMargin dropDownItem.x = _dropEdgeTopPoint.x + _dropMargin
dropItemHolderRect.x = _arrowPointHeight dropDownItem.y = _dropEdgeTopPoint.y -(dropDownItem.height / 2) + radius
// Validate that dropdown is within viewport // Validate that dropdown is within viewport
dropDownItem.y = Math.min(dropDownItem.y + dropDownItem.height, _viewportMaxBottom) - dropDownItem.height dropDownItem.y = Math.min(dropDownItem.y + dropDownItem.height, _viewportMaxBottom) - dropDownItem.height
dropDownItem.y = Math.max(dropDownItem.y, _viewportMaxTop) dropDownItem.y = Math.max(dropDownItem.y, _viewportMaxTop)
// Adjust height to not exceed viewport bounds
dropDownItem.height = Math.min(dropDownItem.height, _viewportMaxHeight - dropDownItem.y)
// Arrow points // Arrow points
arrowCanvas.arrowPoint.y = (_dropEdgeTopPoint.y + radius) - dropDownItem.y arrowCanvas.arrowPoint.y = (_dropEdgeTopPoint.y + radius) - dropDownItem.y
arrowCanvas.arrowPoint.x = 0 arrowCanvas.arrowPoint.x = 0
arrowCanvas.arrowBase1.x = _arrowPointHeight arrowCanvas.arrowBase1.x = _arrowPointWidth
arrowCanvas.arrowBase1.y = arrowCanvas.arrowPoint.y - (_arrowBaseWidth / 2) arrowCanvas.arrowBase1.y = arrowCanvas.arrowPoint.y - (_arrowBaseHeight / 2)
arrowCanvas.arrowBase2.x = arrowCanvas.arrowBase1.x arrowCanvas.arrowBase2.x = arrowCanvas.arrowBase1.x
arrowCanvas.arrowBase2.y = arrowCanvas.arrowBase1.y + _arrowBaseWidth arrowCanvas.arrowBase2.y = arrowCanvas.arrowBase1.y + _arrowBaseHeight
arrowCanvas.requestPaint() arrowCanvas.requestPaint()
} // function - _calcPositions } // function - _calcPositions
...@@ -117,6 +110,7 @@ Item { ...@@ -117,6 +110,7 @@ Item {
} }
} }
// This item is sized to hold the entirety of the drop panel including the arrow point
Item { Item {
id: dropDownItem id: dropDownItem
...@@ -133,29 +127,41 @@ Item { ...@@ -133,29 +127,41 @@ Item {
property point arrowBase2: Qt.point(0, 0) property point arrowBase2: Qt.point(0, 0)
onPaint: { onPaint: {
var panelX = _arrowPointWidth
var panelY = 0
var panelWidth = parent.width - _arrowPointWidth
var panelHeight = parent.height
var context = getContext("2d") var context = getContext("2d")
context.reset() context.reset()
context.beginPath() context.beginPath()
context.moveTo(dropItemHolderRect.x, dropItemHolderRect.y) context.moveTo(panelX, panelY) // top left
context.lineTo(dropItemHolderRect.x + dropItemHolderRect.width, dropItemHolderRect.y) context.lineTo(panelX + panelWidth, panelY) // top right
context.lineTo(dropItemHolderRect.x + dropItemHolderRect.width, dropItemHolderRect.y + dropItemHolderRect.height) context.lineTo(panelX + panelWidth, panelX + panelHeight) // bottom right
context.lineTo(dropItemHolderRect.x, dropItemHolderRect.y + dropItemHolderRect.height) context.lineTo(panelX, panelY + panelHeight) // bottom left
context.lineTo(arrowBase2.x, arrowBase2.y) context.lineTo(arrowBase2.x, arrowBase2.y)
context.lineTo(arrowPoint.x, arrowPoint.y) context.lineTo(arrowPoint.x, arrowPoint.y)
context.lineTo(arrowBase1.x, arrowBase1.y) context.lineTo(arrowBase1.x, arrowBase1.y)
context.lineTo(dropItemHolderRect.x, dropItemHolderRect.y) context.lineTo(panelX, panelY) // top left
context.closePath() context.closePath()
context.fillStyle = qgcPal.windowShade context.fillStyle = qgcPal.windowShade
context.fill() context.fill()
} }
} // Canvas - arrowCanvas } // Canvas - arrowCanvas
Item { QGCFlickable {
id: dropItemHolderRect id: panelItemFlickable
anchors.margins: _dropMargin
anchors.leftMargin: _dropMargin + _arrowPointWidth
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick
contentWidth: panelLoader.width
contentHeight: panelLoader.height
Loader { Loader {
id: dropDownLoader id: panelLoader
x: _dropMargin x: _dropMargin
y: _dropMargin y: _dropMargin
...@@ -165,6 +171,5 @@ Item { ...@@ -165,6 +171,5 @@ Item {
property var dropPanel: _root property var dropPanel: _root
} }
} }
} // Item - dropDownItem } // Item - dropDownItem
} }
...@@ -23,16 +23,15 @@ import QGroundControl.ScreenTools 1.0 ...@@ -23,16 +23,15 @@ import QGroundControl.ScreenTools 1.0
/// Manual - This is simply a check which the user must verify and confirm. It is not based on any system state. /// Manual - This is simply a check which the user must verify and confirm. It is not based on any system state.
/// Telemetry - This type of check can fail due to some state within the system. A telemetry check failure can be /// Telemetry - This type of check can fail due to some state within the system. A telemetry check failure can be
/// a hard stop in that there is no way to pass the checklist until the system state resolves itself. /// a hard stop in that there is no way to pass the checklist until the system state resolves itself.
/// Or it can also optionall be override by the user. /// Or it can also optionally be override by the user.
/// If a button uses both manual and telemetry checks, the telemetry check takes precendence and must be passed first. /// If a button uses both manual and telemetry checks, the telemetry check takes precendence and must be passed first.
QGCButton { QGCButton {
property string name: "" property string name: ""
property int group: 0 property string manualText: "" ///< text to show for a manual check, "" signals no manual check
property string manualText: "" ///< text to show for a manual check, "" signals no manual check property string telemetryTextFailure ///< text to show if telemetry check failed (override not allowed)
property string telemetryTextOverride: "" ///< text to show if telemetry check failed and override is allowed property bool telemetryFailure: false ///< true: telemetry check failing, false: telemetry check passing
property string telemetryTextFailure ///< text to show if telemetry check failed (override not allowed) property bool allowTelemetryFailureOverride: false ///< true: user can click past telemetry failure
property bool telemetryFailure: false ///< true: telemetry check failing, false: telemetry check passing property bool passed: _manualState === _statePassed && _telemetryState === _statePassed
property bool passed: _manualState === _statePassed && _telemetryState === _statePassed
property int _manualState: manualText === "" ? _statePassed : _statePending property int _manualState: manualText === "" ? _statePassed : _statePending
property int _telemetryState: _statePassed property int _telemetryState: _statePassed
...@@ -40,8 +39,8 @@ QGCButton { ...@@ -40,8 +39,8 @@ QGCButton {
property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight / 2) property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight / 2)
property real _stateFlagWidth: ScreenTools.defaultFontPixelWidth * 4 property real _stateFlagWidth: ScreenTools.defaultFontPixelWidth * 4
readonly property int _statePending: 0 ///< Telemetry check has failed or manual check not yet verified, user can click to make it pass readonly property int _statePending: 0 ///< Telemetry check is failing or manual check not yet verified, user can click to make it pass
readonly property int _stateFailed: 1 ///< Telemetry check has failed, user cannot click to make it pass readonly property int _stateFailed: 1 ///< Telemetry check is failing, user cannot click to make it pass
readonly property int _statePassed: 2 ///< Check has passed readonly property int _statePassed: 2 ///< Check has passed
readonly property color _passedColor: Qt.rgba(0.27,0.67,0.42,1) readonly property color _passedColor: Qt.rgba(0.27,0.67,0.42,1)
...@@ -50,8 +49,8 @@ QGCButton { ...@@ -50,8 +49,8 @@ QGCButton {
property string _text: "<b>" + name +"</b>: " + property string _text: "<b>" + name +"</b>: " +
((_telemetryState !== _statePassed) ? ((_telemetryState !== _statePassed) ?
(_telemetryState === _statePending ? telemetryTextOverride : telemetryTextFailure) : telemetryTextFailure :
(_manualState !== _statePassed ? manualText : qsTr("OK"))) (_manualState !== _statePassed ? manualText : qsTr("Passed")))
property color _color: _telemetryState === _statePassed && _manualState === _statePassed ? property color _color: _telemetryState === _statePassed && _manualState === _statePassed ?
_passedColor : _passedColor :
(_telemetryState == _stateFailed ? (_telemetryState == _stateFailed ?
...@@ -61,7 +60,6 @@ QGCButton { ...@@ -61,7 +60,6 @@ QGCButton {
_failedColor)) _failedColor))
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _allowTelemetryFailureOverride: telemetryTextOverride !== ""
width: 40 * ScreenTools.defaultFontPixelWidth width: 40 * ScreenTools.defaultFontPixelWidth
...@@ -94,21 +92,24 @@ QGCButton { ...@@ -94,21 +92,24 @@ QGCButton {
} }
} }
onTelemetryFailureChanged: { function _updateTelemetryState() {
if (telemetryFailure) { if (telemetryFailure) {
// We have a new telemetry failure, reset user pass // We have a new telemetry failure, reset user pass
_telemetryState = _allowTelemetryFailureOverride ? _statePending : _stateFailed _telemetryState = allowTelemetryFailureOverride ? _statePending : _stateFailed
} else { } else {
_telemetryState = _statePassed _telemetryState = _statePassed
} }
} }
onTelemetryFailureChanged: _updateTelemetryState()
onAllowTelemetryFailureOverrideChanged: _updateTelemetryState()
onClicked: { onClicked: {
if (telemetryFailure && !_allowTelemetryFailureOverride) { if (telemetryFailure && !allowTelemetryFailureOverride) {
// No way to proceed past this failure // No way to proceed past this failure
return return
} }
if (telemetryFailure && _allowTelemetryFailureOverride && _telemetryState !== _statePassed) { if (telemetryFailure && allowTelemetryFailureOverride && _telemetryState !== _statePassed) {
// User is allowed to proceed past this failure // User is allowed to proceed past this failure
_telemetryState = _statePassed _telemetryState = _statePassed
return return
...@@ -131,7 +132,7 @@ QGCButton { ...@@ -131,7 +132,7 @@ QGCButton {
function reset() { function reset() {
_manualState = manualText === "" ? _statePassed : _statePending _manualState = manualText === "" ? _statePassed : _statePending
if (telemetryFailure) { if (telemetryFailure) {
_telemetryState = _allowTelemetryFailureOverride ? _statePending : _stateFailed _telemetryState = allowTelemetryFailureOverride ? _statePending : _stateFailed
} else { } else {
_telemetryState = _statePassed _telemetryState = _statePassed
} }
......
...@@ -22,12 +22,7 @@ Column { ...@@ -22,12 +22,7 @@ Column {
property alias _checked: header.checked property alias _checked: header.checked
onPassedChanged: { onPassedChanged: parent.groupPassedChanged(ObjectModel.index)
parent.groupPassedChanged(ObjectModel.index)
if (passed) {
header.checked = false
}
}
Component.onCompleted: { Component.onCompleted: {
enabled = _checked enabled = _checked
......
...@@ -36,18 +36,18 @@ Rectangle { ...@@ -36,18 +36,18 @@ Rectangle {
Component.onCompleted: reset() Component.onCompleted: reset()
Column { // We delay the updates when a group passes so the user can see all items green for a moment prior to hiding
id: mainColumn Timer {
width: 40*ScreenTools.defaultFontPixelWidth id: delayedGroupPassed
spacing: 0.8*ScreenTools.defaultFontPixelWidth interval: 750
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: 0.6*ScreenTools.defaultFontPixelWidth
anchors.leftMargin: 1.5*ScreenTools.defaultFontPixelWidth
function groupPassedChanged(index) { property int index
onTriggered: {
var group = checkListRepeater.itemAt(index)
group._checked = false
if (index + 1 < checkListRepeater.count) { if (index + 1 < checkListRepeater.count) {
var group = checkListRepeater.itemAt(index + 1) group = checkListRepeater.itemAt(index + 1)
group.enabled = true group.enabled = true
group._checked = true group._checked = true
} }
...@@ -59,6 +59,21 @@ Rectangle { ...@@ -59,6 +59,21 @@ Rectangle {
} }
_passed = true _passed = true
} }
}
Column {
id: mainColumn
width: 40*ScreenTools.defaultFontPixelWidth
spacing: 0.8*ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: 0.6*ScreenTools.defaultFontPixelWidth
anchors.leftMargin: 1.5*ScreenTools.defaultFontPixelWidth
function groupPassedChanged(index) {
delayedGroupPassed.index = index
delayedGroupPassed.restart()
}
// Header/title of checklist // Header/title of checklist
Item { Item {
......
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