Commit 7695c019 authored by DonLakeFlyer's avatar DonLakeFlyer

Create standalone controls for PreFlight

parent 119f88e1
......@@ -152,7 +152,12 @@
<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/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/PreFlightCheckList.qml">src/FlightDisplay/PreFlightCheckList.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/PreFlightSoundCheck.qml">src/FlightDisplay/PreFlightSoundCheck.qml</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/CenterMapDropButton.qml">src/FlightMap/Widgets/CenterMapDropButton.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")
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
on_UnhealthySensorsChanged: updateItem()
on_ActiveVehicleChanged: updateItem()
Component.onCompleted: updateItem()
function updateItem() {
if (!_activeVehicle) {
state = stateNotChecked
} else {
if (_unhealthySensors & Vehicle.SysStatusSensorAHRS) {
state = stateMajorIssue
} else {
state = statePassed
}
}
}
}
/****************************************************************************
*
* (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
// This class stores the data and functions of the check list but NOT the GUI (which is handled somewhere else).
PreFlightCheckButton {
name: qsTr("Battery")
pendingtext: qsTr("Healthy & charged > %1. Battery connector firmly plugged?").arg(failureVoltage)
property int failureVoltage: 40
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property var _batPercentRemaining: _activeVehicle ? _activeVehicle.battery.percentRemaining.value : 0
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
on_BatPercentRemainingChanged: updateItem()
on_UnhealthySensorsChanged: updateItem()
on_ActiveVehicleChanged: updateItem()
Component.onCompleted: updateItem()
function updateItem() {
if (!_activeVehicle) {
state = stateNotChecked
} else {
if (_unhealthySensors & Vehicle.SysStatusSensorBattery) {
failuretext = qsTr("Not healthy. Check console.")
state = stateMajorIssue
} else if (_batPercentRemaining < failureVoltage) {
failuretext = qsTr("Low (below %1). Please recharge.").arg(failureVoltage)
state = stateMajorIssue
} else {
state = _nrClicked > 0 ? statePassed : statePending
}
}
}
}
......@@ -20,41 +20,10 @@ 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();
......@@ -78,88 +47,18 @@ Item {
name: "Hardware"
defaulttext: "Props mounted? Wings secured? Tail secured?"
}
PreFlightCheckButton {
id: buttonBattery
name: "Battery"
pendingtext: "Healthy & charged > 40%. Battery connector firmly plugged?"
function updateItem() {
if (!_activeVehicle) {
state = statePassed
} else {
if (unhealthySensors & Vehicle.SysStatusSensorBattery) {
failuretext = qsTr("Not healthy. Check console.")
state = stateMajorIssue
} else if (batPercentRemaining < 40.0) {
failuretext = qsTr("Low (below 40%). Please recharge.")
state = stateMajorIssue
} else {
state = _nrClicked > 0 ? statePassed : statePending
}
}
}
PreFlightBatteryCheck {
id: buttonBattery
failureVoltage: 40
}
PreFlightCheckButton {
PreFlightSensorsCheck {
id: buttonSensors
name: "Sensors"
function updateItem() {
if (!_activeVehicle) {
state = statePassed
} else {
if(!(unhealthySensors & Vehicle.SysStatusSensor3dMag) &&
!(unhealthySensors & Vehicle.SysStatusSensor3dAccel) &&
!(unhealthySensors & Vehicle.SysStatusSensor3dGyro) &&
!(unhealthySensors & Vehicle.SysStatusSensorAbsolutePressure) &&
!(unhealthySensors & Vehicle.SysStatusSensorDifferentialPressure) &&
!(unhealthySensors & Vehicle.SysStatusSensorGPS)) {
if (!gpsLock) {
pendingtext = qsTr("Pending. Waiting for GPS lock.")
state = statePending
} else {
state = statePassed
}
} 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 = stateMajorIssue
}
}
}
}
PreFlightCheckButton {
PreFlightRCCheck {
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 = statePassed
} else {
if (unhealthySensors & Vehicle.SysStatusSensorRCReceiver) {
state = stateMajorIssue
} else {
state = _nrClicked > 0 ? statePassed : statePending
}
}
}
}
PreFlightCheckButton {
PreFlightAHRSCheck {
id: buttonEstimator
name: "Global position estimate"
function updateItem() {
if (!_activeVehicle) {
state = statePassed
} else {
if (unhealthySensors & Vehicle.SysStatusSensorAHRS) {
state = stateMajorIssue
} else {
state = statePassed
}
}
}
}
// Check list item group 1 - Require arming
......@@ -182,24 +81,9 @@ Item {
group: 1
defaulttext: "Please confirm mission is valid (waypoints valid, no terrain collision)."
}
PreFlightCheckButton {
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 = statePassed
} else {
if (audioMuted) {
state = stateMajorIssue
_nrClicked = 0
} else {
state = _nrClicked > 0 ? statePassed : statePending
}
}
}
PreFlightSoundCheck {
id: buttonSoundOutput
group: 1
}
// Check list item group 2 - Final checks before launch
......
/****************************************************************************
*
* (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("Radio Control")
pendingtext: qsTr("Receiving signal. Perform range test & confirm.")
failuretext: qsTr("No signal or invalid autopilot-RC config. Check RC and console.")
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
on_UnhealthySensorsChanged: updateItem()
on_ActiveVehicleChanged: updateItem()
Component.onCompleted: updateItem()
function updateItem() {
if (!_activeVehicle) {
state = stateNotChecked
} else {
if (_unhealthySensors & Vehicle.SysStatusSensorRCReceiver) {
state = stateMajorIssue
} else {
state = _nrClicked > 0 ? statePassed : statePending
}
}
}
}
/****************************************************************************
*
* (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("Sensors")
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property bool _gpsLock: _activeVehicle ? _activeVehicle.gps.lock.rawValue>=3 : 0
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
on_GpsLockChanged: updateItem()
on_UnhealthySensorsChanged: updateItem()
on_ActiveVehicleChanged: updateItem()
Component.onCompleted: updateItem()
function updateItem() {
if (!_activeVehicle) {
state = stateNotChecked
} else {
if(!(_unhealthySensors & Vehicle.SysStatusSensor3dMag) &&
!(_unhealthySensors & Vehicle.SysStatusSensor3dAccel) &&
!(_unhealthySensors & Vehicle.SysStatusSensor3dGyro) &&
!(_unhealthySensors & Vehicle.SysStatusSensorAbsolutePressure) &&
!(_unhealthySensors & Vehicle.SysStatusSensorDifferentialPressure) &&
!(_unhealthySensors & Vehicle.SysStatusSensorGPS)) {
if (!_gpsLock) {
pendingtext = qsTr("Pending. Waiting for GPS lock.")
state = statePending
} else {
state = statePassed
}
} else {
if (_unhealthySensors & Vehicle.SysStatusSensor3dMag) failuretext=qsTr("Failure. Magnetometer issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensor3dAccel) failuretext=qsTr("Failure. Accelerometer issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensor3dGyro) failuretext=qsTr("Failure. Gyroscope issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensorAbsolutePressure) failuretext=qsTr("Failure. Barometer issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensorDifferentialPressure) failuretext=qsTr("Failure. Airspeed sensor issues. Check console.")
else if(_unhealthySensors & Vehicle.SysStatusSensorGPS) failuretext=qsTr("Failure. No valid or low quality GPS signal. Check console.")
state = stateMajorIssue
}
}
}
}
/****************************************************************************
*
* (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("Sound output")
pendingtext: qsTr("QGC audio output enabled. System audio output enabled, too?")
failuretext: qsTr("Failure, QGC audio output is disabled. Please enable it under application settings->general to hear audio warnings!")
property bool _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted.rawValue
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
on_AudioMutedChanged: updateItem()
on_ActiveVehicleChanged: updateItem()
Component.onCompleted: updateItem()
function onActiveVehicleChanged() {
buttonSoundOutput.updateItem(); // Just updated here for initialization once we connect to a vehicle
updateVehicleDependentItems();
}
function updateItem() {
if (!_activeVehicle) {
state = stateNotChecked
} else {
if (_audioMuted) {
state = stateMajorIssue
_nrClicked = 0
} else {
state = _nrClicked > 0 ? statePassed : statePending
}
}
}
}
......@@ -9,5 +9,10 @@ GuidedActionsController 1.0 GuidedActionsController.qml
GuidedActionList 1.0 GuidedActionList.qml
GuidedAltitudeSlider 1.0 GuidedAltitudeSlider.qml
MultiVehicleList 1.0 MultiVehicleList.qml
PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml
PreFlightAHRSCheck 1.0 PreFlightAHRSCheck.qml
PreFlightCheckList 1.0 PreFlightCheckList.qml
PreFlightRCCheck 1.0 PreFlightRCCheck.qml
PreFlightSensorsCheck 1.0 PreFlightSensorsCheck.qml
PreFlightSoundCheck 1.0 PreFlightSoundCheck.qml
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