diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 8dfabfe8be454972191af464a046dd39b9911bbd..f6ac32a3212418f3666f406ba3f80c6954c89205 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -152,7 +152,12 @@ src/FlightDisplay/GuidedActionsController.qml src/FlightDisplay/GuidedAltitudeSlider.qml src/FlightDisplay/MultiVehicleList.qml + src/FlightDisplay/PreFlightAHRSCheck.qml + src/FlightDisplay/PreFlightBatteryCheck.qml src/FlightDisplay/PreFlightCheckList.qml + src/FlightDisplay/PreFlightRCCheck.qml + src/FlightDisplay/PreFlightSensorsCheck.qml + src/FlightDisplay/PreFlightSoundCheck.qml src/FlightDisplay/qmldir src/FlightMap/MapItems/CameraTriggerIndicator.qml src/FlightMap/Widgets/CenterMapDropButton.qml diff --git a/src/FlightDisplay/PreFlightAHRSCheck.qml b/src/FlightDisplay/PreFlightAHRSCheck.qml new file mode 100644 index 0000000000000000000000000000000000000000..29d17e8d1b1e4841f4bfe17f08d6ac0152d6c105 --- /dev/null +++ b/src/FlightDisplay/PreFlightAHRSCheck.qml @@ -0,0 +1,38 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * 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 + } + } + } +} diff --git a/src/FlightDisplay/PreFlightBatteryCheck.qml b/src/FlightDisplay/PreFlightBatteryCheck.qml new file mode 100644 index 0000000000000000000000000000000000000000..e95840c0fff7f3cc2cd199a8fe79b287eb2be751 --- /dev/null +++ b/src/FlightDisplay/PreFlightBatteryCheck.qml @@ -0,0 +1,48 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * 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 + } + } + } +} diff --git a/src/FlightDisplay/PreFlightCheckList.qml b/src/FlightDisplay/PreFlightCheckList.qml index de04b34dd4f54f7b3d7d9e5141d937aa68bd35b3..61ba21b7e44901cc142ad7adb0e6b3b4a7677593 100644 --- a/src/FlightDisplay/PreFlightCheckList.qml +++ b/src/FlightDisplay/PreFlightCheckList.qml @@ -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 diff --git a/src/FlightDisplay/PreFlightRCCheck.qml b/src/FlightDisplay/PreFlightRCCheck.qml new file mode 100644 index 0000000000000000000000000000000000000000..a6c77b691b017a11ab00f2e852698999243bcbb3 --- /dev/null +++ b/src/FlightDisplay/PreFlightRCCheck.qml @@ -0,0 +1,40 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * 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 + } + } + } +} diff --git a/src/FlightDisplay/PreFlightSensorsCheck.qml b/src/FlightDisplay/PreFlightSensorsCheck.qml new file mode 100644 index 0000000000000000000000000000000000000000..79b39ae0b7da9de3a3d31de976bcac5491b7e2e9 --- /dev/null +++ b/src/FlightDisplay/PreFlightSensorsCheck.qml @@ -0,0 +1,56 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * 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 + } + } + } +} diff --git a/src/FlightDisplay/PreFlightSoundCheck.qml b/src/FlightDisplay/PreFlightSoundCheck.qml new file mode 100644 index 0000000000000000000000000000000000000000..2a6e4d382a359a5c1ab9455ac456036672c53bc4 --- /dev/null +++ b/src/FlightDisplay/PreFlightSoundCheck.qml @@ -0,0 +1,46 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * 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 + } + } + } +} diff --git a/src/FlightDisplay/qmldir b/src/FlightDisplay/qmldir index 816bd8d08b09c374720b0066b4b7031769e1e8cd..c77b047539f7e243f11893e80661f167c3a6ba34 100644 --- a/src/FlightDisplay/qmldir +++ b/src/FlightDisplay/qmldir @@ -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