From 480f09bb7bb09ab3f689c7189fb605837af9f908 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sat, 16 Feb 2019 10:28:15 -0800 Subject: [PATCH] Move position of HITL to bottom. Handle no SYS_HITL param. --- src/AutoPilotPlugins/PX4/SafetyComponent.qml | 103 ++++++++++--------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml index 4b9e00dca..a654239aa 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml @@ -29,13 +29,15 @@ SetupPage { Item { width: Math.max(availableWidth, outerGrid.width) - height: lastRect.y + lastRect.height + height: _hitlAvailable ? (lastRect.y + lastRect.height) : (otherLastRect.y + otherLastRect.height) FactPanelController { id: controller factPanel: safetyPage.viewPanel } + readonly property string hitlParam: "SYS_HITL" + property real _margins: ScreenTools.defaultFontPixelHeight property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 20 property real _imageWidth: ScreenTools.defaultFontPixelWidth * 15 @@ -50,18 +52,11 @@ SetupPage { property Fact _dlLossAction: controller.getParameterFact(-1, "NAV_DLL_ACT") property Fact _disarmLandDelay: controller.getParameterFact(-1, "COM_DISARM_LAND") property Fact _landSpeedMC: controller.getParameterFact(-1, "MPC_LAND_SPEED", false) - property Fact _hitlEnabled: controller.getParameterFact(-1, "SYS_HITL", false) + property bool _hitlAvailable: controller.parameterExists(-1, hitlParam) + property Fact _hitlEnabled: controller.getParameterFact(-1, hitlParam, false) ExclusiveGroup { id: homeLoiterGroup } - Rectangle { - x: hitlGrid.x + outerGrid.x - _margins - y: hitlGrid.y + outerGrid.y - _margins - width: hitlGrid.width + (_margins * 2) - height: hitlGrid.height + (_margins * 2) - color: qgcPal.windowShade - } - Rectangle { x: lowBattGrid.x + outerGrid.x - _margins y: lowBattGrid.y + outerGrid.y - _margins @@ -103,7 +98,7 @@ SetupPage { } Rectangle { - id: lastRect + id: otherLastRect x: landModeGrid.x + outerGrid.x - _margins y: landModeGrid.y + outerGrid.y - _margins width: landModeGrid.width + (_margins * 2) @@ -111,48 +106,21 @@ SetupPage { color: qgcPal.windowShade } + Rectangle { + id: lastRect + x: hitlGrid.x + outerGrid.x - _margins + y: hitlGrid.y + outerGrid.y - _margins + width: hitlGrid.width + (_margins * 2) + height: hitlGrid.height + (_margins * 2) + color: qgcPal.windowShade + visible: _hitlAvailable + } + GridLayout { id: outerGrid columns: 3 anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Hardware in the Loop Simulation") - Layout.columnSpan: 3 - } - - Item { width: 1; height: _margins; Layout.columnSpan: 3 } - - Item { width: _margins; height: 1 } - - GridLayout { - id: hitlGrid - columns: 3 - - Image { - mipmap: true - fillMode: Image.PreserveAspectFit - source: qgcPal.globalTheme === qgcPal.Light ? "/qmlimages/VehicleSummaryIcon.png" : "/qmlimages/VehicleSummaryIcon.png" - Layout.rowSpan: 3 - Layout.maximumWidth: _imageWidth - Layout.maximumHeight: _imageHeight - width: _imageWidth - height: _imageHeight - } - - QGCLabel { - text: qsTr("HITL Enabled:") - Layout.fillWidth: true - } - FactComboBox { - fact: _hitlEnabled - indexModel: false - Layout.minimumWidth: _editFieldWidth - } - } - - Item { width: 1; height: _margins; Layout.columnSpan: 3 } - QGCLabel { text: qsTr("Low Battery Failsafe Trigger") Layout.columnSpan: 3 @@ -517,6 +485,45 @@ SetupPage { Layout.minimumWidth: _editFieldWidth } } + + Item { width: 1; height: _margins; Layout.columnSpan: 3; visible: _hitlAvailable } + + QGCLabel { + text: qsTr("Hardware in the Loop Simulation") + Layout.columnSpan: 3 + visible: _hitlAvailable + } + + Item { width: 1; height: _margins; Layout.columnSpan: 3; visible: _hitlAvailable } + + Item { width: _margins; height: 1; visible: _hitlAvailable } + + GridLayout { + id: hitlGrid + columns: 3 + visible: _hitlAvailable + + Image { + mipmap: true + fillMode: Image.PreserveAspectFit + source: qgcPal.globalTheme === qgcPal.Light ? "/qmlimages/VehicleSummaryIcon.png" : "/qmlimages/VehicleSummaryIcon.png" + Layout.rowSpan: 3 + Layout.maximumWidth: _imageWidth + Layout.maximumHeight: _imageHeight + width: _imageWidth + height: _imageHeight + } + + QGCLabel { + text: qsTr("HITL Enabled:") + Layout.fillWidth: true + } + FactComboBox { + fact: _hitlEnabled + indexModel: false + Layout.minimumWidth: _editFieldWidth + } + } } } } -- 2.22.0