Commit 13358501 authored by Philipp Oettershagen's avatar Philipp Oettershagen

Fixes and cleanup according to comments by @dongagne

parent 4466d289
...@@ -193,6 +193,7 @@ ...@@ -193,6 +193,7 @@
<file alias="VibrationPageWidget.qml">src/FlightMap/Widgets/VibrationPageWidget.qml</file> <file alias="VibrationPageWidget.qml">src/FlightMap/Widgets/VibrationPageWidget.qml</file>
<file alias="VideoPageWidget.qml">src/FlightMap/Widgets/VideoPageWidget.qml</file> <file alias="VideoPageWidget.qml">src/FlightMap/Widgets/VideoPageWidget.qml</file>
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file> <file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="QGroundControl/FlightDisplay/CheckList.qml">src/FlightDisplay/CheckList.qml</file>
</qresource> </qresource>
<qresource prefix="/json"> <qresource prefix="/json">
<file alias="CameraCalc.FactMetaData.json">src/MissionManager/CameraCalc.FactMetaData.json</file> <file alias="CameraCalc.FactMetaData.json">src/MissionManager/CameraCalc.FactMetaData.json</file>
......
import QtQuick 2.3
import QtQml.Models 2.1
import QGroundControl 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
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).
Item {
// Properties
property int unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property bool gpsLock: _activeVehicle ? _activeVehicle.gps.lock.rawValue>=3 : 0
property var batPercentRemaining: _activeVehicle ? _activeVehicle.battery.percentRemaining.value : 0
property bool audioMuted: QGroundControl.settingsManager.appSettings.audioMuted.rawValue
property ObjectModel checkListItems: _checkListItems
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property int _checkState: _activeVehicle ? (_activeVehicle.armed ? 1 + (buttonActuators._state + buttonMotors._state + buttonMission._state + buttonSoundOutput._state) / 4 / 4 : 0) : 0 ; // Shows progress of checks inside the checklist - unlocks next check steps in groups
// Connections
onBatPercentRemainingChanged: buttonBattery.updateItem();
onGpsLockChanged: buttonSensors.updateItem();
onAudioMutedChanged: buttonSoundOutput.updateItem();
onUnhealthySensorsChanged: updateVehicleDependentItems();
Connections {
target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: onActiveVehicleChanged();
}
Component.onCompleted: {
if(QGroundControl.multiVehicleManager.vehicles.count > 0) {
onActiveVehicleChanged();
}
}
// Functions
function updateVehicleDependentItems() {
buttonSensors.updateItem();
buttonBattery.updateItem();
buttonRC.updateItem();
buttonEstimator.updateItem();
}
function onActiveVehicleChanged() {
buttonSoundOutput.updateItem(); // Just updated here for initialization once we connect to a vehicle
updateVehicleDependentItems();
}
function resetNrClicks() {
buttonHardware.resetNrClicks();
buttonBattery.resetNrClicks();
buttonRC.resetNrClicks();
buttonActuators.resetNrClicks();
buttonMotors.resetNrClicks();
buttonMission.resetNrClicks();
buttonSoundOutput.resetNrClicks();
buttonPayload.resetNrClicks();
buttonWeather.resetNrClicks();
buttonFlightAreaFree.resetNrClicks();
}
// Check list item data
ObjectModel {
id: _checkListItems
// Standard check list items (group 0) - Available from the start
QGCCheckListItem {
id: buttonHardware
name: "Hardware"
defaulttext: "Props mounted? Wings secured? Tail secured?"
}
QGCCheckListItem {
id: buttonBattery
name: "Battery"
pendingtext: "Healthy & charged > 40%. Battery connector firmly plugged?"
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if (!(unhealthySensors & Vehicle.SysStatusSensorBattery) && batPercentRemaining>=40.0) _state = 1+3*(_nrClicked>0);
else {
if(unhealthySensors & Vehicle.SysStatusSensorBattery) failuretext="Not healthy. Check console.";
else if(batPercentRemaining<40.0) failuretext="Low (below 40%). Please recharge.";
_state = 3;
}
}
}
}
QGCCheckListItem {
id: buttonSensors
name: "Sensors"
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if(!(unhealthySensors & Vehicle.SysStatusSensor3dMag) &&
!(unhealthySensors & Vehicle.SysStatusSensor3dAccel) &&
!(unhealthySensors & Vehicle.SysStatusSensor3dGyro) &&
!(unhealthySensors & Vehicle.SysStatusSensorAbsolutePressure) &&
!(unhealthySensors & Vehicle.SysStatusSensorDifferentialPressure) &&
!(unhealthySensors & Vehicle.SysStatusSensorGPS)) {
if(!gpsLock) {
pendingtext="Pending. Waiting for GPS lock.";
_state=1;
} else {
_state = 4; // All OK
}
} else {
if(unhealthySensors & Vehicle.SysStatusSensor3dMag) failuretext="Failure. Magnetometer issues. Check console.";
else if(unhealthySensors & Vehicle.SysStatusSensor3dAccel) failuretext="Failure. Accelerometer issues. Check console.";
else if(unhealthySensors & Vehicle.SysStatusSensor3dGyro) failuretext="Failure. Gyroscope issues. Check console.";
else if(unhealthySensors & Vehicle.SysStatusSensorAbsolutePressure) failuretext="Failure. Barometer issues. Check console.";
else if(unhealthySensors & Vehicle.SysStatusSensorDifferentialPressure) failuretext="Failure. Airspeed sensor issues. Check console.";
else if(unhealthySensors & Vehicle.SysStatusSensorGPS) failuretext="Failure. No valid or low quality GPS signal. Check console.";
_state = 3;
}
}
}
}
QGCCheckListItem {
id: buttonRC
name: "Radio Control"
pendingtext: "Receiving signal. Perform range test & confirm."
failuretext: "No signal or invalid autopilot-RC config. Check RC and console."
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if (unhealthySensors & Vehicle.SysStatusSensorRCReceiver) {_state = 3}
else {_state = 1+3*(_nrClicked>0);}
}
}
}
QGCCheckListItem {
id: buttonEstimator
name: "Global position estimate"
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if (unhealthySensors & Vehicle.SysStatusSensorAHRS) {_state = 3;}
else {_state = 4;}
}
}
}
// Check list item group 1 - Require arming
QGCLabel {text:qsTr("<i>Please arm the vehicle here.</i>") ; opacity: 0.2+0.8*(QGroundControl.multiVehicleManager.vehicles.count > 0) ; anchors.horizontalCenter:buttonHardware.horizontalCenter ; anchors.topMargin:40 ; anchors.bottomMargin:40;}
QGCCheckListItem {
id: buttonActuators
name: "Actuators"
group: 1
defaulttext: "Move all control surfaces. Did they work properly?"
}
QGCCheckListItem {
id: buttonMotors
name: "Motors"
group: 1
defaulttext: "Propellers free? Then throttle up gently. Working properly?"
}
QGCCheckListItem {
id: buttonMission
name: "Mission"
group: 1
defaulttext: "Please confirm mission is valid (waypoints valid, no terrain collision)."
}
QGCCheckListItem {
id: buttonSoundOutput
name: "Sound output"
group: 1
pendingtext: "QGC audio output enabled. System audio output enabled, too?"
failuretext: "Failure, QGC audio output is disabled. Please enable it under application settings->general to hear audio warnings!"
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if (audioMuted) {_state = 3 ; _nrClicked=0;}
else {_state = 1+3*(_nrClicked>0);}
}
}
}
// Check list item group 2 - Final checks before launch
QGCLabel {text:qsTr("<i>Last preparations before launch</i>") ; opacity : 0.2+0.8*(_checkState >= 2); anchors.horizontalCenter:buttonHardware.horizontalCenter}
QGCCheckListItem {
id: buttonPayload
name: "Payload"
group: 2
defaulttext: "Configured and started?"
pendingtext: "Payload lid closed?"
}
QGCCheckListItem {
id: buttonWeather
name: "Wind & weather"
group: 2
defaulttext: "OK for your platform?"
pendingtext: "Launching into the wind?"
}
QGCCheckListItem {
id: buttonFlightAreaFree
name: "Flight area"
group: 2
defaulttext: "Launch area and path free of obstacles/people?"
}
} // Object Model
}
...@@ -17,6 +17,7 @@ import QtPositioning 5.3 ...@@ -17,6 +17,7 @@ import QtPositioning 5.3
import QtMultimedia 5.5 import QtMultimedia 5.5
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQml.Models 2.1
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.FlightDisplay 1.0 import QGroundControl.FlightDisplay 1.0
...@@ -46,13 +47,13 @@ QGCView { ...@@ -46,13 +47,13 @@ QGCView {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true
property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue
property real _savedZoomLevel: 0 property real _savedZoomLevel: 0
property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _pipSize: flightView.width * 0.2 property real _pipSize: flightView.width * 0.2
property alias _guidedController: guidedActionsController property alias _guidedController: guidedActionsController
property alias _altitudeSlider: altitudeSlider property alias _altitudeSlider: altitudeSlider
readonly property var _dynamicCameras: _activeVehicle ? _activeVehicle.dynamicCameras : null readonly property var _dynamicCameras: _activeVehicle ? _activeVehicle.dynamicCameras : null
readonly property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false readonly property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false
readonly property bool isBackgroundDark: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true readonly property bool isBackgroundDark: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
...@@ -112,6 +113,10 @@ QGCView { ...@@ -112,6 +113,10 @@ QGCView {
Component.onCompleted: start(true /* flyView */) Component.onCompleted: start(true /* flyView */)
} }
CheckList {
id: checklist
}
Connections { Connections {
target: _missionController target: _missionController
onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady) onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady)
...@@ -504,8 +509,8 @@ QGCView { ...@@ -504,8 +509,8 @@ QGCView {
z: _panel.z + 4 z: _panel.z + 4
title: qsTr("Fly") title: qsTr("Fly")
maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y
buttonVisible: [ QGroundControl.settingsManager.appSettings.useChecklist.rawValue, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true, _guidedController.smartShotsAvailable ] buttonVisible: [ _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true, _guidedController.smartShotsAvailable ]
buttonEnabled: [ QGroundControl.settingsManager.appSettings.useChecklist.rawValue, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable, _anySmartShotAvailable ] buttonEnabled: [ _useChecklist, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable, _anySmartShotAvailable ]
property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort
property bool _anySmartShotAvailable: _guidedController.showOrbit property bool _anySmartShotAvailable: _guidedController.showOrbit
...@@ -683,291 +688,58 @@ QGCView { ...@@ -683,291 +688,58 @@ QGCView {
} }
} }
//-- Checklist GUI
Component { Component {
id: checklistDropPanel id: checklistDropPanel
Rectangle { Rectangle {
id: checklist id: checklistRect
width: mainColumn.width + (ScreenTools.defaultFontPixelWidth * 4) visible: true
height: (headerColumn.height+mainColumn.height) * 1.07 width: mainColumn.width + 3*ScreenTools.defaultFontPixelWidth
height: mainColumn.height * 1.04
color: qgcPal.windowShade color: qgcPal.windowShade
radius: 20 radius: 3
enabled: QGroundControl.multiVehicleManager.vehicles.count > 0; enabled: QGroundControl.multiVehicleManager.vehicles.count > 0;
onBatPercentRemainingChanged: {if(_initialized) buttonBattery.updateItem();}
onGpsLockChanged: {buttonSensors.updateItem();}
// Connections
Connections {
target: _activeVehicle
onUnhealthySensorsChanged: checklist.onUnhealthySensorsChanged();
}
Connections {
target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: checklist.onActiveVehicleChanged();
onActiveVehicleAvailableChanged: {}
}
Connections {
target: QGroundControl.settingsManager.appSettings.audioMuted
onValueChanged: buttonSoundOutput.updateItem(); //TODO(philippoe): We are binding to a signal which is explicitly marked as "only for QT internal use" here.
}
Component.onCompleted: {
if(QGroundControl.multiVehicleManager.vehicles.count > 0) {
onActiveVehicleChanged();
_initialized=true;
}
}
function updateVehicleDependentItems() {
buttonSensors.updateItem();
buttonBattery.updateItem();
buttonRC.updateItem();
buttonEstimator.updateItem();
}
function onActiveVehicleChanged() {
buttonSoundOutput.updateItem(); // Just updated here for initialization once we connect to a vehicle
onUnhealthySensorsChanged(); // The health states could all have changed - need to update them.
}
function onUnhealthySensorsChanged() {
var unhealthySensorsStr = _activeVehicle.unhealthySensors;
// Set to healthy per default
for(var i=0;i<32;i++) _healthFlags[i]=true;
for(i=0;i<unhealthySensorsStr.length;i++) { // TODO (philippoe): This is terrible, having this data available in the form of a bitfield would be much better than a string list!
switch(unhealthySensorsStr[i]) {
case "Gyro": _healthFlags[0]=false; break;
case "Accelerometer": _healthFlags[1]=false; break;
case "Magnetometer": _healthFlags[2]=false; break;
case "Absolute pressure": _healthFlags[3]=false; break;
case "Differential pressure": _healthFlags[4]=false; break;
case "GPS": _healthFlags[5]=false; break;
case "Optical flow": _healthFlags[6]=false; break;
case "Computer vision position":_healthFlags[7]=false; break;
case "Laser based position": _healthFlags[8]=false; break;
case "External ground truth": _healthFlags[9]=false; break;
case "Angular rate control": _healthFlags[10]=false; break;
case "Attitude stabilization": _healthFlags[11]=false; break;
case "Yaw position": _healthFlags[12]=false; break;
case "Z/altitude control": _healthFlags[13]=false; break;
case "X/Y position control": _healthFlags[14]=false; break;
case "Motor outputs / control": _healthFlags[15]=false; break;
case "RC receiver": _healthFlags[16]=false; break;
case "Gyro 2": _healthFlags[17]=false; break;
case "Accelerometer 2": _healthFlags[18]=false; break;
case "Magnetometer 2": _healthFlags[19]=false; break;
case "GeoFence": _healthFlags[20]=false; break;
case "AHRS": _healthFlags[21]=false; break;
case "Terrain": _healthFlags[22]=false; break;
case "Motors reversed": _healthFlags[23]=false; break;
case "Logging": _healthFlags[24]=false; break;
case "Battery": _healthFlags[25]=false; break;
default:
}
}
updateVehicleDependentItems();
}
Column {
id: headerColumn
x: 2*ScreenTools.defaultFontPixelWidth
y: 2*ScreenTools.defaultFontPixelWidth
width: 320
spacing: 8
// Header/title of checklist
QGCLabel {anchors.horizontalCenter: parent.horizontalCenter ; font.pointSize: ScreenTools.mediumFontPointSize ; text: _activeVehicle ? qsTr("Pre-flight checklist")+" (MAV ID:"+_activeVehicle.id+")" : qsTr("Pre-flight checklist (awaiting vehicle...)");}
Rectangle {anchors.left:parent.left ; anchors.right:parent.right ; height:1 ; color:qgcPal.text}
}
Column { Column {
id: mainColumn id: mainColumn
x: 2*ScreenTools.defaultFontPixelWidth x: 1.5*ScreenTools.defaultFontPixelWidth
anchors.top:headerColumn.bottom y: 0.4*ScreenTools.defaultFontPixelWidth
anchors.topMargin:ScreenTools.defaultFontPixelWidth width: 40*ScreenTools.defaultFontPixelWidth
width: 320 spacing: 0.8*ScreenTools.defaultFontPixelWidth
spacing: 6
enabled : QGroundControl.multiVehicleManager.vehicles.count > 0;
opacity : 0.2+0.8*(QGroundControl.multiVehicleManager.vehicles.count > 0);
// Checklist items: Standard
QGCCheckListItem {
id: buttonHardware
name: "Hardware"
defaulttext: "Props mounted? Wings secured? Tail secured?"
}
QGCCheckListItem {
id: buttonBattery
name: "Battery"
pendingtext: "Healthy & charged > 40%. Battery connector firmly plugged?"
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if (checklist._healthFlags[25] && batPercentRemaining>=40.0) _state = 1+3*(_nrClicked>0);
else {
if(!checklist._healthFlags[25]) buttonBattery.failuretext="Not healthy. Check console.";
else if(batPercentRemaining<40.0) buttonBattery.failuretext="Low (below 40%). Please recharge.";
buttonBattery._state = 3;
}
}
}
}
QGCCheckListItem {
id: buttonSensors
name: "Sensors"
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if(checklist._healthFlags[0] &&
checklist._healthFlags[1] &&
checklist._healthFlags[2] &&
checklist._healthFlags[3] &&
checklist._healthFlags[4] &&
checklist._healthFlags[5]) {
if(!gpsLock) {
buttonSensors.pendingtext="Pending. Waiting for GPS lock.";
buttonSensors._state=1;
} else {
_state = 4; // All OK
}
} else {
if(!checklist._healthFlags[0]) failuretext="Failure. Gyroscope issues. Check console.";
else if(!checklist._healthFlags[1]) failuretext="Failure. Accelerometer issues. Check console.";
else if(!checklist._healthFlags[2]) failuretext="Failure. Magnetometer issues. Check console.";
else if(!checklist._healthFlags[3]) failuretext="Failure. Barometer issues. Check console.";
else if(!checklist._healthFlags[4]) failuretext="Failure. Airspeed sensor issues. Check console.";
else if(!checklist._healthFlags[5]) failuretext="Failure. No valid or low quality GPS signal. Check console.";
_state = 3;
}
}
}
}
QGCCheckListItem {
id: buttonRC
name: "Radio Control"
pendingtext: "Receiving signal. Perform range test & confirm."
failuretext: "No signal or invalid autopilot-RC config. Check RC and console."
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if (_healthFlags[16]) {_state = 1+3*(_nrClicked>0);}
else {_state = 3;}
}
}
}
QGCCheckListItem { // Header/title of checklist
id: buttonEstimator Item {
name: "Global position estimate" width: parent.width
function updateItem() { height: 1.75*ScreenTools.defaultFontPixelHeight
if (!_activeVehicle) {
_state = 0;
} else {
if (_healthFlags[21]) {_state = 4;}
else {_state = 3;}
}
}
}
// Arming header
//Rectangle {anchors.left:parent.left ; anchors.right:parent.right ; height:1 ; color:qgcPal.text}
QGCLabel {anchors.horizontalCenter:parent.horizontalCenter ; text:qsTr("<i>Please arm the vehicle here.</i>")}
//Rectangle {anchors.left:parent.left ; anchors.right:parent.right ; height:1 ; color:qgcPal.text}
QGCCheckListItem {
id: buttonActuators
name: "Actuators"
group: 1
defaulttext: "Move all control surfaces. Did they work properly?"
}
QGCCheckListItem { QGCLabel {
id: buttonMotors text: _activeVehicle ? qsTr("Pre-flight checklist")+" (MAV ID:"+_activeVehicle.id+")" : qsTr("Pre-flight checklist (no vehicle)")
name: "Motors" anchors.left: parent.left
group: 1 anchors.verticalCenter: parent.verticalCenter
defaulttext: "Propellers free? Then throttle up gently. Working properly?" font.pointSize: ScreenTools.mediumFontPointSize
} }
QGCButton {
width: 1.2*ScreenTools.defaultFontPixelHeight
height: 1.2*ScreenTools.defaultFontPixelHeight
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
opacity : 0.2+0.8*(QGroundControl.multiVehicleManager.vehicles.count > 0)
tooltip: "Reset the checklist (e.g. after a vehicle reboot)"
QGCCheckListItem { onClicked: checklist.resetNrClicks()
id: buttonMission
name: "Mission"
group: 1
defaulttext: "Please confirm mission is valid (waypoints valid, no terrain collision)."
}
QGCCheckListItem { Image { source:"/qmlimages/MapSyncBlack.svg" ; anchors.fill: parent }
id: buttonSoundOutput
name: "Sound output"
group: 1
pendingtext: "QGC audio output enabled. System audio output enabled, too?"
failuretext: "Failure, QGC audio output is disabled. Please enable it under application settings->general to hear audio warnings!"
function updateItem() {
if (!_activeVehicle) {
_state = 0;
} else {
if (QGroundControl.settingsManager.appSettings.audioMuted.rawValue) {_state = 3;_nrClicked=0;}
else {_state = 1+3*(_nrClicked>0);}
} }
} }
}
// Directly before launch header
//Rectangle {anchors.left:parent.left ; anchors.right:parent.right ; height:1 ; color:qgcPal.text}
QGCLabel {anchors.horizontalCenter:parent.horizontalCenter ; text:qsTr("<i>Last preparations before launch</i>") ; opacity : 0.2+0.8*(_checkState >= 2);}
//Rectangle {anchors.left:parent.left ; anchors.right:parent.right ; height:1 ; color:qgcPal.text}
QGCCheckListItem { Rectangle {width:parent.width ; height:1 ; color:qgcPal.text}
id: buttonPayload
name: "Payload"
group: 2
defaulttext: "Configured and started?"
pendingtext: "Payload lid closed?"
}
QGCCheckListItem { // All check list items
id: buttonWeather Repeater {
name: "Wind & weather" model: checklist.checkListItems
group: 2
defaulttext: "OK for your platform?"
pendingtext: "Launching into the wind?"
} }
QGCCheckListItem {
id: buttonFlightAreaFree
name: "Flight area"
group: 2
defaulttext: "Launch area and path free of obstacles/people?"
}
} // Column } // Column
property bool _initialized:false
property var _healthFlags: []
property int _checkState: _activeVehicle ? (_activeVehicle.armed ? 1 + (buttonActuators._state + buttonMotors._state + buttonMission._state + buttonSoundOutput._state) / 4 / 4 : 0) : 0 ; // Shows progress of checks inside the checklist - unlocks next check steps in groups
property bool gpsLock: _activeVehicle ? _activeVehicle.gps.lock.rawValue>=3 : 0
property var batPercentRemaining: _activeVehicle ? _activeVehicle.battery.getFact("percentRemaining").value : 0
// TODO: Having access to MAVLINK enums (or at least QML consts) would be much cleaner than the code below
property int subsystem_type_gyro : 1
property int subsystem_type_acc : 2
property int subsystem_type_mag : 4
property int subsystem_type_abspressure : 8
property int subsystem_type_diffpressure : 16
property int subsystem_type_gps : 32
property int subsystem_type_positioncontrol : 16384
property int subsystem_type_motorcontrol : 32768
property int subsystem_type_rcreceiver : 65536
property int subsystem_type_ahrs : 2097152
property int subsystem_type_terrain : 4194304
property int subsystem_type_reversemotor : 8388608
property int subsystem_type_logging : 16777216
property int subsystem_type_sensorbattery : 33554432
property int subsystem_type_rangefinder : 67108864
} //Rectangle } //Rectangle
} //Component } //Component
} //QGC View } //QGC View
...@@ -9,4 +9,5 @@ GuidedActionsController 1.0 GuidedActionsController.qml ...@@ -9,4 +9,5 @@ GuidedActionsController 1.0 GuidedActionsController.qml
GuidedActionList 1.0 GuidedActionList.qml 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
CheckList 1.0 CheckList.qml
...@@ -64,7 +64,7 @@ Item { ...@@ -64,7 +64,7 @@ Item {
} }
if (visible) { if (visible) {
visible = false visible = false
//_dropDownComponent = undefined //TODO (philippoe) such that drop down component state is not deleted - check with don gagne whether this is necessary _dropDownComponent = undefined
toolStrip.uncheckAll() toolStrip.uncheckAll()
} }
} }
......
...@@ -8,19 +8,18 @@ import QGroundControl.ScreenTools 1.0 ...@@ -8,19 +8,18 @@ import QGroundControl.ScreenTools 1.0
QGCButton { QGCButton {
property string name: "" property string name: ""
property int _state: 0
property var _color: qgcPal.button;//qgcPal.windowShade;//qgcPal.windowShadeDark;//Qt.rgba(0.5,0.5,0.5,1) //qgcPal.window;//
property int _nrClicked: 0
property int group: 0 property int group: 0
property string defaulttext: "Not checked yet" property string defaulttext: "Not checked yet"
property string pendingtext: "" property string pendingtext: ""
property string failuretext: "Failure. Check console." property string failuretext: "Failure. Check console."
property int _state: 0
property var _color: qgcPal.button
property int _nrClicked: 0
property string _text: qsTr(name)+ ": " + qsTr(defaulttext) property string _text: qsTr(name)+ ": " + qsTr(defaulttext)
enabled : (_activeVehicle==null || _activeVehicle.connectionLost) ? false : _checkState>=group enabled : (_activeVehicle==null || _activeVehicle.connectionLost) ? false : checklist._checkState>=group
opacity : (_activeVehicle==null || _activeVehicle.connectionLost) ? 0.4 : 0.2+0.8*(_checkState >= group); opacity : (_activeVehicle==null || _activeVehicle.connectionLost) ? 0.4 : 0.2+0.8*(checklist._checkState >= group);
width: 40*ScreenTools.defaultFontPixelWidth
width: parent.width
style: ButtonStyle { style: ButtonStyle {
background: Rectangle {color:_color; border.color: qgcPal.button; radius:3} background: Rectangle {color:_color; border.color: qgcPal.button; radius:3}
label: Label { label: Label {
...@@ -31,30 +30,25 @@ QGCButton { ...@@ -31,30 +30,25 @@ QGCButton {
} }
} }
// Connections
onPendingtextChanged: { if(_state==1) {getTextFromState(); getColorFromState();} }
onFailuretextChanged: { if(_state==3) {getTextFromState(); getColorFromState();} }
on_StateChanged: { getTextFromState(); getColorFromState(); }
onClicked: { onClicked: {
if(_state<2) _nrClicked=_nrClicked+1; //Only allow click-counter to increase when not failed yet if(_state<2) _nrClicked=_nrClicked+1; //Only allow click-counter to increase when not failed yet
updateItem(); updateItem();
} }
onPendingtextChanged: { if(_state==1) {getTextFromState(); getColorFromState();} }
onFailuretextChanged: { if(_state==3) {getTextFromState(); getColorFromState();} }
on_StateChanged: { getTextFromState(); getColorFromState(); }
// onEnabledChanged: { //Dont do this for now, because if we only accidentially lose connection, we don't want to delete the checklist state. Instead, we'd need to detect a re-connect, maybe based on the timesincesystemstart (i.e. when it decreases)?
// if(enabled==false && group > 0) {
// // Reset all check list items of group > 0 if it is disabled again (which e.g. happens after a vehicle reboot or disarm).
// _nrClicked = 0;
// _state = 0;
// }
// }
//Functions
function updateItem() { function updateItem() {
// This is the default updateFunction. It assumes the item is a MANUAL check list item, i.e. one that // This is the default updateFunction. It assumes the item is a MANUAL check list item, i.e. one that
// only requires user clicks (one click if pendingtext="", two clicks otherwise) for completion. // only requires user clicks (one click if pendingtext="", two clicks otherwise) for completion.
//if(_nrClicked>0) _state = 4;
if(_nrClicked===1) { if(_nrClicked===0) _state = 0;
else if(_nrClicked===1) {
if(pendingtext.length === 0) _state = 4; if(pendingtext.length === 0) _state = 4;
else _state = 1; else _state = 1;
} else if(_nrClicked>1) _state = 4; } else _state = 4;
getTextFromState(); getTextFromState();
getColorFromState(); getColorFromState();
...@@ -73,4 +67,8 @@ QGCButton { ...@@ -73,4 +67,8 @@ QGCButton {
else if(_state === 3) {_color=Qt.rgba(0.92,0.22,0.22,1)} // Big problem else if(_state === 3) {_color=Qt.rgba(0.92,0.22,0.22,1)} // Big problem
else {_color=Qt.rgba(0.27,0.67,0.42,1)} // All OK else {_color=Qt.rgba(0.27,0.67,0.42,1)} // All OK
} }
function resetNrClicks() {
_nrClicked=0;
updateItem();
}
} }
...@@ -380,7 +380,7 @@ public: ...@@ -380,7 +380,7 @@ public:
SysStatusSensor3dGyro = MAV_SYS_STATUS_SENSOR_3D_GYRO, SysStatusSensor3dGyro = MAV_SYS_STATUS_SENSOR_3D_GYRO,
SysStatusSensor3dAccel = MAV_SYS_STATUS_SENSOR_3D_ACCEL, SysStatusSensor3dAccel = MAV_SYS_STATUS_SENSOR_3D_ACCEL,
SysStatusSensor3dMag = MAV_SYS_STATUS_SENSOR_3D_MAG, SysStatusSensor3dMag = MAV_SYS_STATUS_SENSOR_3D_MAG,
SysStatusSensorAsolutePressure = MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE, SysStatusSensorAbsolutePressure = MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE,
SysStatusSensorDifferentialPressure = MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE, SysStatusSensorDifferentialPressure = MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE,
SysStatusSensorGPS = MAV_SYS_STATUS_SENSOR_GPS, SysStatusSensorGPS = MAV_SYS_STATUS_SENSOR_GPS,
SysStatusSensorOpticalFlow = MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW, SysStatusSensorOpticalFlow = MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW,
......
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