13 changed files with 807 additions and 1 deletions
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
|
||||
/// @file
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
/// @author Rustom Jehangir <rusty@bluerobotics.com>
|
||||
|
||||
#include "APMLightsComponent.h" |
||||
#include "QGCQmlWidgetHolder.h" |
||||
#include "APMAutoPilotPlugin.h" |
||||
#include "APMAirframeComponent.h" |
||||
|
||||
APMLightsComponent::APMLightsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) |
||||
: VehicleComponent(vehicle, autopilot, parent) |
||||
, _name(tr("Lights")) |
||||
{ |
||||
} |
||||
|
||||
QString APMLightsComponent::name(void) const |
||||
{ |
||||
return _name; |
||||
} |
||||
|
||||
QString APMLightsComponent::description(void) const |
||||
{ |
||||
return tr("Lights setup is used to adjust light output channels."); |
||||
} |
||||
|
||||
QString APMLightsComponent::iconResource(void) const |
||||
{ |
||||
return QStringLiteral("/qmlimages/LightsComponentIcon.png"); |
||||
} |
||||
|
||||
bool APMLightsComponent::requiresSetup(void) const |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool APMLightsComponent::setupComplete(void) const |
||||
{ |
||||
return true; |
||||
} |
||||
|
||||
QStringList APMLightsComponent::setupCompleteChangedTriggerList(void) const |
||||
{ |
||||
return QStringList(); |
||||
} |
||||
|
||||
QUrl APMLightsComponent::setupSource(void) const |
||||
{ |
||||
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/APMLightsComponent.qml")); |
||||
} |
||||
|
||||
QUrl APMLightsComponent::summaryQmlSource(void) const |
||||
{ |
||||
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/APMLightsComponentSummary.qml")); |
||||
} |
||||
|
||||
QString APMLightsComponent::prerequisiteSetup(void) const |
||||
{ |
||||
APMAutoPilotPlugin* plugin = dynamic_cast<APMAutoPilotPlugin*>(_autopilot); |
||||
Q_ASSERT(plugin); |
||||
|
||||
if (!plugin->airframeComponent()->setupComplete()) { |
||||
return plugin->airframeComponent()->name(); |
||||
} |
||||
|
||||
return QString(); |
||||
} |
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (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. |
||||
* |
||||
****************************************************************************/ |
||||
|
||||
|
||||
#ifndef APMLightsComponent_H |
||||
#define APMLightsComponent_H |
||||
|
||||
#include "VehicleComponent.h" |
||||
|
||||
class APMLightsComponent : public VehicleComponent |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
APMLightsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); |
||||
|
||||
// Virtuals from VehicleComponent
|
||||
QStringList setupCompleteChangedTriggerList(void) const final; |
||||
|
||||
// Virtuals from VehicleComponent
|
||||
QString name(void) const final; |
||||
QString description(void) const final; |
||||
QString iconResource(void) const final; |
||||
bool requiresSetup(void) const final; |
||||
bool setupComplete(void) const final; |
||||
QUrl setupSource(void) const final; |
||||
QUrl summaryQmlSource(void) const final; |
||||
QString prerequisiteSetup(void) const final; |
||||
|
||||
private: |
||||
const QString _name; |
||||
}; |
||||
|
||||
#endif |
@ -0,0 +1,190 @@
@@ -0,0 +1,190 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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.5 |
||||
import QtQuick.Controls 1.2 |
||||
|
||||
import QGroundControl.FactSystem 1.0 |
||||
import QGroundControl.FactControls 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
SetupPage { |
||||
id: lightsPage |
||||
pageComponent: lightsPageComponent |
||||
|
||||
Component { |
||||
id: lightsPageComponent |
||||
|
||||
Column { |
||||
spacing: _margins |
||||
width: availableWidth |
||||
|
||||
FactPanelController { id: controller; factPanel: lightsPage.viewPanel } |
||||
|
||||
QGCPalette { id: palette; colorGroupEnabled: true } |
||||
|
||||
property Fact _rc5Function: controller.getParameterFact(-1, "RC5_FUNCTION") |
||||
property Fact _rc6Function: controller.getParameterFact(-1, "RC6_FUNCTION") |
||||
property Fact _rc7Function: controller.getParameterFact(-1, "RC7_FUNCTION") |
||||
property Fact _rc8Function: controller.getParameterFact(-1, "RC8_FUNCTION") |
||||
property Fact _rc9Function: controller.getParameterFact(-1, "RC9_FUNCTION") |
||||
property Fact _rc10Function: controller.getParameterFact(-1, "RC10_FUNCTION") |
||||
property Fact _rc11Function: controller.getParameterFact(-1, "RC11_FUNCTION") |
||||
property Fact _rc12Function: controller.getParameterFact(-1, "RC12_FUNCTION") |
||||
property Fact _rc13Function: controller.getParameterFact(-1, "RC13_FUNCTION") |
||||
property Fact _rc14Function: controller.getParameterFact(-1, "RC14_FUNCTION") |
||||
|
||||
readonly property real _margins: ScreenTools.defaultFontPixelHeight |
||||
readonly property int _rcFunctionDisabled: 0 |
||||
readonly property int _rcFunctionRCIN9: 59 |
||||
readonly property int _rcFunctionRCIN10: 60 |
||||
readonly property int _firstLightsOutChannel: 5 |
||||
readonly property int _lastLightsOutChannel: 14 |
||||
|
||||
Component.onCompleted: { |
||||
calcLightOutValues() |
||||
} |
||||
|
||||
/// Light output channels are stored in RC#_FUNCTION parameters. We need to loop through those |
||||
/// to find them and setup the ui accordindly. |
||||
function calcLightOutValues() { |
||||
lightsLoader.lights1OutIndex = 0 |
||||
lightsLoader.lights2OutIndex = 0 |
||||
for (var channel=_firstLightsOutChannel; channel<=_lastLightsOutChannel; channel++) { |
||||
var functionFact = controller.getParameterFact(-1, "RC" + channel + "_FUNCTION") |
||||
if (functionFact.value == _rcFunctionRCIN9) { |
||||
lightsLoader.lights1OutIndex = channel - 4 |
||||
} else if (functionFact.value == _rcFunctionRCIN10) { |
||||
lightsLoader.lights2OutIndex = channel - 4 |
||||
} |
||||
} |
||||
} |
||||
|
||||
function setRCFunction(channel, rcFunction) { |
||||
// First clear any previous settings for this function |
||||
for (var index=_firstLightsOutChannel; index<=_lastLightsOutChannel; index++) { |
||||
var functionFact = controller.getParameterFact(-1, "RC" + index + "_FUNCTION") |
||||
if (functionFact.value != _rcFunctionDisabled && functionFact.value == rcFunction) { |
||||
functionFact.value = _rcFunctionDisabled |
||||
} |
||||
} |
||||
|
||||
// Now set the function into the new channel |
||||
if (channel != 0) { |
||||
var functionFact = controller.getParameterFact(-1, "RC" + channel + "_FUNCTION") |
||||
functionFact.value = rcFunction |
||||
} |
||||
} |
||||
|
||||
// Whenever any RC#_FUNCTION parameters chagnes we need to go looking for light output channels again |
||||
Connections { target: _rc5Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc6Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc7Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc8Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc9Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc10Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc11Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc12Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc13Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc14Function; onValueChanged: calcLightOutValues() } |
||||
|
||||
ListModel { |
||||
id: lightsOutModel |
||||
ListElement { text: qsTr("Disabled"); value: 0 } |
||||
ListElement { text: qsTr("Channel 5"); value: 5 } |
||||
ListElement { text: qsTr("Channel 6"); value: 6 } |
||||
ListElement { text: qsTr("Channel 7"); value: 7 } |
||||
ListElement { text: qsTr("Channel 8"); value: 8 } |
||||
ListElement { text: qsTr("Channel 9"); value: 9 } |
||||
ListElement { text: qsTr("Channel 10"); value: 10 } |
||||
ListElement { text: qsTr("Channel 11"); value: 11 } |
||||
ListElement { text: qsTr("Channel 12"); value: 12 } |
||||
ListElement { text: qsTr("Channel 13"); value: 13 } |
||||
ListElement { text: qsTr("Channel 14"); value: 14 } |
||||
} |
||||
|
||||
Component { |
||||
id: lightSettings |
||||
|
||||
Item { |
||||
width: rectangle.x + rectangle.width |
||||
height: rectangle.y + rectangle.height |
||||
|
||||
QGCLabel { |
||||
id: settingsLabel |
||||
text: qsTr("Light Output Channels") |
||||
font.family: ScreenTools.demiboldFontFamily |
||||
} |
||||
|
||||
Rectangle { |
||||
id: rectangle |
||||
anchors.topMargin: _margins / 2 |
||||
anchors.top: settingsLabel.bottom |
||||
width: lights1Combo.x + lights1Combo.width + _margins |
||||
height: lights2Combo.y + lights2Combo.height + _margins |
||||
color: palette.windowShade |
||||
|
||||
QGCLabel { |
||||
id: lights1Label |
||||
anchors.margins: _margins |
||||
anchors.left: parent.left |
||||
anchors.baseline: lights1Combo.baseline |
||||
text: qsTr("Lights 1:") |
||||
} |
||||
|
||||
QGCComboBox { |
||||
id: lights1Combo |
||||
anchors.margins: _margins |
||||
anchors.top: parent.top |
||||
anchors.left: lights1Label.right |
||||
width: ScreenTools.defaultFontPixelWidth * 15 |
||||
model: lightsOutModel |
||||
currentIndex: lights1OutIndex |
||||
|
||||
onActivated: setRCFunction(lightsOutModel.get(index).value, lights1Function) |
||||
} |
||||
|
||||
QGCLabel { |
||||
id: lights2Label |
||||
anchors.margins: _margins |
||||
anchors.left: parent.left |
||||
anchors.baseline: lights2Combo.baseline |
||||
text: qsTr("Lights 2:") |
||||
} |
||||
|
||||
QGCComboBox { |
||||
id: lights2Combo |
||||
anchors.margins: _margins |
||||
anchors.top: lights1Combo.bottom |
||||
anchors.left: lights2Label.right |
||||
width: lights1Combo.width |
||||
model: lightsOutModel |
||||
currentIndex: lights2OutIndex |
||||
|
||||
onActivated: setRCFunction(lightsOutModel.get(index).value, lights2Function) |
||||
} |
||||
} // Rectangle |
||||
} // Item |
||||
} // Component - lightSettings |
||||
|
||||
Loader { |
||||
id: lightsLoader |
||||
sourceComponent: lightSettings |
||||
|
||||
property int lights1OutIndex: 0 |
||||
property int lights2OutIndex: 0 |
||||
property int lights1Function: _rcFunctionRCIN9 |
||||
property int lights2Function: _rcFunctionRCIN10 |
||||
} |
||||
} // Column |
||||
} // Component |
||||
} // SetupPage |
@ -0,0 +1,101 @@
@@ -0,0 +1,101 @@
|
||||
import QtQuick 2.5 |
||||
import QtQuick.Controls 1.2 |
||||
|
||||
import QGroundControl.FactSystem 1.0 |
||||
import QGroundControl.FactControls 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
|
||||
FactPanel { |
||||
id: panel |
||||
anchors.fill: parent |
||||
color: qgcPal.windowShadeDark |
||||
|
||||
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } |
||||
FactPanelController { id: controller; factPanel: panel } |
||||
|
||||
property Fact _rc5Function: controller.getParameterFact(-1, "RC5_FUNCTION") |
||||
property Fact _rc6Function: controller.getParameterFact(-1, "RC6_FUNCTION") |
||||
property Fact _rc7Function: controller.getParameterFact(-1, "RC7_FUNCTION") |
||||
property Fact _rc8Function: controller.getParameterFact(-1, "RC8_FUNCTION") |
||||
property Fact _rc9Function: controller.getParameterFact(-1, "RC9_FUNCTION") |
||||
property Fact _rc10Function: controller.getParameterFact(-1, "RC10_FUNCTION") |
||||
property Fact _rc11Function: controller.getParameterFact(-1, "RC11_FUNCTION") |
||||
property Fact _rc12Function: controller.getParameterFact(-1, "RC12_FUNCTION") |
||||
property Fact _rc13Function: controller.getParameterFact(-1, "RC13_FUNCTION") |
||||
property Fact _rc14Function: controller.getParameterFact(-1, "RC14_FUNCTION") |
||||
|
||||
readonly property int _rcFunctionRCIN9: 59 |
||||
readonly property int _rcFunctionRCIN10: 60 |
||||
readonly property int _firstLightsOutChannel: 5 |
||||
readonly property int _lastLightsOutChannel: 14 |
||||
|
||||
Component.onCompleted: { |
||||
calcLightOutValues() |
||||
} |
||||
|
||||
/// Light output channels are stored in RC#_FUNCTION parameters. We need to loop through those |
||||
/// to find them and setup the ui accordindly. |
||||
function calcLightOutValues() { |
||||
lightsLoader.lights1OutIndex = 0 |
||||
lightsLoader.lights2OutIndex = 0 |
||||
for (var channel=_firstLightsOutChannel; channel<=_lastLightsOutChannel; channel++) { |
||||
var functionFact = controller.getParameterFact(-1, "RC" + channel + "_FUNCTION") |
||||
if (functionFact.value == _rcFunctionRCIN9) { |
||||
lightsLoader.lights1OutIndex = channel - 4 |
||||
} else if (functionFact.value == _rcFunctionRCIN10) { |
||||
lightsLoader.lights2OutIndex = channel - 4 |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Whenever any RC#_FUNCTION parameters chagnes we need to go looking for light output channels again |
||||
Connections { target: _rc5Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc6Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc7Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc8Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc9Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc10Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc11Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc12Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc13Function; onValueChanged: calcLightOutValues() } |
||||
Connections { target: _rc14Function; onValueChanged: calcLightOutValues() } |
||||
|
||||
ListModel { |
||||
id: lightsOutModel |
||||
ListElement { text: qsTr("Disabled"); value: 0 } |
||||
ListElement { text: qsTr("Channel 5"); value: 5 } |
||||
ListElement { text: qsTr("Channel 6"); value: 6 } |
||||
ListElement { text: qsTr("Channel 7"); value: 7 } |
||||
ListElement { text: qsTr("Channel 8"); value: 8 } |
||||
ListElement { text: qsTr("Channel 9"); value: 9 } |
||||
ListElement { text: qsTr("Channel 10"); value: 10 } |
||||
ListElement { text: qsTr("Channel 11"); value: 11 } |
||||
ListElement { text: qsTr("Channel 12"); value: 12 } |
||||
ListElement { text: qsTr("Channel 13"); value: 13 } |
||||
ListElement { text: qsTr("Channel 14"); value: 14 } |
||||
} |
||||
|
||||
Loader { |
||||
id: lightsLoader |
||||
|
||||
property int lights1OutIndex: 0 |
||||
property int lights2OutIndex: 0 |
||||
property int lights1Function: _rcFunctionRCIN9 |
||||
property int lights2Function: _rcFunctionRCIN10 |
||||
} |
||||
|
||||
Column { |
||||
anchors.fill: parent |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("Lights Output 1:") |
||||
valueText: lightsOutModel.get(lightsLoader.lights1OutIndex).text |
||||
} |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("Lights Output 2:") |
||||
valueText: lightsOutModel.get(lightsLoader.lights2OutIndex).text |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,266 @@
@@ -0,0 +1,266 @@
|
||||
/**************************************************************************** |
||||
* |
||||
* (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.5 |
||||
import QtQuick.Controls 1.2 |
||||
import QtGraphicalEffects 1.0 |
||||
|
||||
import QGroundControl.FactSystem 1.0 |
||||
import QGroundControl.FactControls 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
SetupPage { |
||||
id: safetyPage |
||||
pageComponent: safetyPageComponent |
||||
|
||||
Component { |
||||
id: safetyPageComponent |
||||
|
||||
Flow { |
||||
id: flowLayout |
||||
width: availableWidth |
||||
spacing: _margins |
||||
|
||||
FactPanelController { id: controller; factPanel: safetyPage.viewPanel } |
||||
|
||||
QGCPalette { id: ggcPal; colorGroupEnabled: true } |
||||
|
||||
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") |
||||
property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE") |
||||
property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE") |
||||
property Fact _failsafePressureValue: controller.getParameterFact(-1, "FS_PRESS_MAX") |
||||
property Fact _failsafeTempEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE") |
||||
property Fact _failsafeTempValue: controller.getParameterFact(-1, "FS_TEMP_MAX") |
||||
|
||||
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") |
||||
property Fact _fenceAltMax: controller.getParameterFact(-1, "FENCE_ALT_MAX") |
||||
property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE") |
||||
property Fact _fenceMargin: controller.getParameterFact(-1, "FENCE_MARGIN") |
||||
property Fact _fenceType: controller.getParameterFact(-1, "FENCE_TYPE") |
||||
|
||||
property Fact _leakPin: controller.getParameterFact(-1, "LEAK1_PIN") |
||||
property Fact _leakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC") |
||||
|
||||
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") |
||||
|
||||
property real _margins: ScreenTools.defaultFontPixelHeight |
||||
property bool _showIcon: !ScreenTools.isTinyScreen |
||||
|
||||
ExclusiveGroup { id: fenceActionRadioGroup } |
||||
|
||||
Column { |
||||
spacing: _margins / 2 |
||||
|
||||
QGCLabel { |
||||
id: failsafeLabel |
||||
text: qsTr("Failsafe Actions") |
||||
font.family: ScreenTools.demiboldFontFamily |
||||
} |
||||
|
||||
Rectangle { |
||||
id: failsafeSettings |
||||
width: leakEnableCombo.x + leakEnableCombo.width + _margins |
||||
height: leakEnableCombo.y + leakEnableCombo.height + _margins |
||||
color: ggcPal.windowShade |
||||
|
||||
QGCLabel { |
||||
id: gcsEnableLabel |
||||
anchors.margins: _margins |
||||
anchors.left: parent.left |
||||
anchors.baseline: gcsEnableCombo.baseline |
||||
text: qsTr("Ground Station failsafe:") |
||||
} |
||||
|
||||
FactComboBox { |
||||
id: gcsEnableCombo |
||||
anchors.margins: _margins |
||||
anchors.left: gcsEnableLabel.right |
||||
anchors.top: parent.top |
||||
width: ScreenTools.defaultFontPixelWidth*15 |
||||
fact: _failsafeGCSEnable |
||||
indexModel: false |
||||
} |
||||
|
||||
QGCLabel { |
||||
id: leakEnableLabel |
||||
anchors.margins: _margins |
||||
anchors.left: parent.left |
||||
anchors.baseline: leakEnableCombo.baseline |
||||
text: qsTr("Leak failsafe:") |
||||
} |
||||
|
||||
FactComboBox { |
||||
id: leakEnableCombo |
||||
anchors.topMargin: _margins |
||||
anchors.left: gcsEnableCombo.left |
||||
anchors.top: gcsEnableCombo.bottom |
||||
width: ScreenTools.defaultFontPixelWidth*15 |
||||
fact: _failsafeLeakEnable |
||||
indexModel: false |
||||
} |
||||
} // Rectangle - Failsafe Settings |
||||
} // Column - Failsafe Settings |
||||
|
||||
Column { |
||||
spacing: _margins / 2 |
||||
|
||||
QGCLabel { |
||||
id: geoFenceLabel |
||||
text: qsTr("GeoFence") |
||||
font.family: ScreenTools.demiboldFontFamily |
||||
} |
||||
|
||||
Rectangle { |
||||
id: geoFenceSettings |
||||
width: fenceAltMaxField.x + fenceAltMaxField.width + _margins |
||||
height: fenceAltMaxField.y + fenceAltMaxField.height + _margins |
||||
color: ggcPal.windowShade |
||||
|
||||
QGCCheckBox { |
||||
id: altitudeGeo |
||||
anchors.margins: _margins |
||||
anchors.left: parent.left |
||||
anchors.top: parent.top |
||||
text: qsTr("Depth GeoFence enabled\n(report only)") |
||||
checked: _fenceEnable.value != 0 && _fenceType.value & 1 |
||||
|
||||
onClicked: { |
||||
if (checked) { |
||||
if (_fenceEnable.value == 1) { |
||||
_fenceType.value |= 1 |
||||
} else { |
||||
_fenceEnable.value = 1 |
||||
_fenceType.value = 1 |
||||
} |
||||
} else { |
||||
_fenceEnable.value = 0 |
||||
_fenceType.value = 0 |
||||
} |
||||
} |
||||
} |
||||
|
||||
QGCLabel { |
||||
id: fenceAltMaxLabel |
||||
anchors.left: altitudeGeo.left |
||||
anchors.baseline: fenceAltMaxField.baseline |
||||
text: qsTr("Max depth:") |
||||
} |
||||
|
||||
FactTextField { |
||||
id: fenceAltMaxField |
||||
anchors.topMargin: _margins / 2 |
||||
anchors.leftMargin: _margins |
||||
anchors.left: fenceAltMaxLabel.right |
||||
anchors.top: altitudeGeo.bottom |
||||
fact: _fenceAltMax |
||||
showUnits: true |
||||
} |
||||
} // Rectangle - GeoFence Settings |
||||
} // Column - GeoFence Settings |
||||
|
||||
Column { |
||||
spacing: _margins / 2 |
||||
|
||||
QGCLabel { |
||||
id: leakDetectorLabel |
||||
text: qsTr("Leak detector") |
||||
font.family: ScreenTools.demiboldFontFamily |
||||
} |
||||
|
||||
Rectangle { |
||||
id: leakDetectorSettings |
||||
width: leakLogicCombo.x + leakLogicCombo.width + _margins |
||||
height: leakLogicCombo.y + leakLogicCombo.height + _margins |
||||
color: ggcPal.windowShade |
||||
|
||||
QGCLabel { |
||||
id: leakPinLabel |
||||
anchors.margins: _margins |
||||
anchors.left: parent.left |
||||
anchors.top: parent.top |
||||
text: qsTr("Pin:") |
||||
} |
||||
|
||||
FactComboBox { |
||||
id: leakPinCombo |
||||
anchors.margins: _margins |
||||
anchors.left: leakLogicLabel.right |
||||
anchors.baseline: leakPinLabel.baseline |
||||
width: ScreenTools.defaultFontPixelWidth*15 |
||||
fact: _leakPin |
||||
indexModel: false |
||||
} |
||||
|
||||
QGCLabel { |
||||
id: leakLogicLabel |
||||
anchors.margins: _margins |
||||
anchors.left: parent.left |
||||
anchors.top: leakPinLabel.bottom |
||||
text: qsTr("Logic:") |
||||
} |
||||
|
||||
FactComboBox { |
||||
id: leakLogicCombo |
||||
anchors.margins: _margins |
||||
anchors.left: leakLogicLabel.right |
||||
anchors.baseline: leakLogicLabel.baseline |
||||
width: ScreenTools.defaultFontPixelWidth*15 |
||||
fact: _leakLogic |
||||
indexModel: false |
||||
} |
||||
} // Rectangle - Leak Detector Settings |
||||
} // Column - Leak Detector Settings |
||||
|
||||
Column { |
||||
spacing: _margins / 2 |
||||
|
||||
QGCLabel { |
||||
text: qsTr("Arming Checks") |
||||
font.family: ScreenTools.demiboldFontFamily |
||||
} |
||||
|
||||
Rectangle { |
||||
width: flowLayout.width |
||||
height: armingCheckInnerColumn.height + (_margins * 2) |
||||
color: ggcPal.windowShade |
||||
|
||||
Column { |
||||
id: armingCheckInnerColumn |
||||
anchors.margins: _margins |
||||
anchors.top: parent.top |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
spacing: _margins |
||||
|
||||
FactBitmask { |
||||
id: armingCheckBitmask |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
firstEntryIsAll: true |
||||
fact: _armingCheck |
||||
} |
||||
|
||||
QGCLabel { |
||||
id: armingCheckWarning |
||||
anchors.left: parent.left |
||||
anchors.right: parent.right |
||||
wrapMode: Text.WordWrap |
||||
color: qgcPal.warningText |
||||
text: qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.") |
||||
visible: _armingCheck.value != 1 |
||||
} |
||||
} |
||||
} // Rectangle - Arming checks |
||||
} // Column - Arming Checks |
||||
} // Flow |
||||
} // Component - safetyPageComponent |
||||
} // SetupView |
@ -0,0 +1,94 @@
@@ -0,0 +1,94 @@
|
||||
import QtQuick 2.2 |
||||
import QtQuick.Controls 1.2 |
||||
|
||||
import QGroundControl.FactSystem 1.0 |
||||
import QGroundControl.FactControls 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
|
||||
FactPanel { |
||||
id: panel |
||||
anchors.fill: parent |
||||
color: qgcPal.windowShadeDark |
||||
|
||||
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } |
||||
FactPanelController { id: controller; factPanel: panel } |
||||
|
||||
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE") |
||||
property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE") |
||||
|
||||
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION") |
||||
property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE") |
||||
property Fact _fenceType: controller.getParameterFact(-1, "FENCE_TYPE") |
||||
|
||||
property Fact _leakPin: controller.getParameterFact(-1, "LEAK1_PIN") |
||||
|
||||
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") |
||||
|
||||
property string _failsafeGCSEnableText |
||||
|
||||
Component.onCompleted: { |
||||
setFailsafeGCSEnableText() |
||||
} |
||||
|
||||
Connections { |
||||
target: _failsafeGCSEnable |
||||
|
||||
onValueChanged: setFailsafeGCSEnableText() |
||||
} |
||||
|
||||
function setFailsafeGCSEnableText() { |
||||
switch (_failsafeGCSEnable.value) { |
||||
case 0: |
||||
_failsafeGCSEnableText = qsTr("Disabled") |
||||
break |
||||
case 1: |
||||
_failsafeGCSEnableText = qsTr("Always RTL") |
||||
break |
||||
case 2: |
||||
_failsafeGCSEnableText = qsTr("Continue with Mission in Auto Mode") |
||||
break |
||||
default: |
||||
_failsafeGCSEnableText = qsTr("Unknown") |
||||
} |
||||
} |
||||
|
||||
Column { |
||||
anchors.fill: parent |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("Arming Checks:") |
||||
valueText: _armingCheck.value & 1 ? qsTr("Enabled") : qsTr("Some disabled") |
||||
} |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("GCS failsafe:") |
||||
valueText: _failsafeGCSEnableText |
||||
} |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("Leak failsafe:") |
||||
valueText: _failsafeLeakEnable.value ? qsTr("Enabled") : qsTr("Disabled") |
||||
} |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("Leak detector:") |
||||
valueText: _leakPin.value > 0 ? qsTr("Enabled") : qsTr("Disabled") |
||||
} |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("GeoFence:") |
||||
valueText: _fenceEnable.value == 0 || _fenceType == 0 ? |
||||
qsTr("Disabled") : |
||||
(_fenceType.value == 1 ? |
||||
qsTr("Depth") : |
||||
(_fenceType.value == 2 ? qsTr("Circle") : qsTr("Depth,Circle"))) |
||||
} |
||||
|
||||
VehicleSummaryRow { |
||||
labelText: qsTr("GeoFence:") |
||||
valueText: qsTr("Report only") |
||||
visible: _fenceEnable.value != 0 |
||||
} |
||||
} |
||||
} |
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in new issue