|
|
|
@ -25,11 +25,32 @@ Item {
@@ -25,11 +25,32 @@ Item {
|
|
|
|
|
//property var qgcView - QGCView control |
|
|
|
|
//property var qgcViewPanel - QGCViewPanel control |
|
|
|
|
|
|
|
|
|
property real _margins: ScreenTools.defaultFontPixelHeight / 2 |
|
|
|
|
property real _margins: ScreenTools.defaultFontPixelHeight / 2 |
|
|
|
|
property var _switchNameList: [ "ACRO", "ARM", "GEAR", "KILL", "LOITER", "OFFB", "POSCTL", "RATT", "RETURN", "STAB" ] |
|
|
|
|
property var _switchFactList: [ ] |
|
|
|
|
property var _switchTHFactList: [ ] |
|
|
|
|
|
|
|
|
|
readonly property real _flightModeComboWidth: ScreenTools.defaultFontPixelWidth * 13 |
|
|
|
|
readonly property real _channelComboWidth: ScreenTools.defaultFontPixelWidth * 13 |
|
|
|
|
|
|
|
|
|
Component.onCompleted: { |
|
|
|
|
if (controller.vehicle.fixedWing) { |
|
|
|
|
_switchNameList.push("MAN") |
|
|
|
|
} |
|
|
|
|
if (controller.vehicle.vtol) { |
|
|
|
|
_switchNameList.push("TRANS") |
|
|
|
|
} |
|
|
|
|
for (var i=0; i<_switchNameList.length; i++) { |
|
|
|
|
_switchFactList.push("RC_MAP_" + _switchNameList[i] + "_SW") |
|
|
|
|
_switchTHFactList.push("RC_" + _switchNameList[i] + "_TH") |
|
|
|
|
} |
|
|
|
|
if (controller.vehicle.fixedWing) { |
|
|
|
|
_switchFactList.push("RC_MAP_FLAPS") |
|
|
|
|
_switchTHFactList.push("") |
|
|
|
|
} |
|
|
|
|
switchRepeater.model = _switchFactList |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PX4SimpleFlightModesController { |
|
|
|
|
id: controller |
|
|
|
|
factPanel: qgcViewPanel |
|
|
|
@ -138,98 +159,43 @@ Item {
@@ -138,98 +159,43 @@ Item {
|
|
|
|
|
columnSpacing: ScreenTools.defaultFontPixelWidth |
|
|
|
|
|
|
|
|
|
Repeater { |
|
|
|
|
model: [ "RC_MAP_ACRO_SW", "RC_MAP_ARM_SW", "RC_MAP_GEAR_SW", "RC_MAP_KILL_SW", "RC_MAP_LOITER_SW", "RC_MAP_OFFB_SW", "RC_MAP_POSCTL_SW", "RC_MAP_RATT_SW", "RC_MAP_RETURN_SW", "RC_MAP_STAB_SW" ] |
|
|
|
|
id: switchRepeater |
|
|
|
|
|
|
|
|
|
RowLayout { |
|
|
|
|
spacing: ScreenTools.defaultFontPixelWidth |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
|
|
|
|
property Fact fact: controller.getParameterFact(-1, modelData) |
|
|
|
|
|
|
|
|
|
property string thFactName: _switchTHFactList[index] |
|
|
|
|
property bool thFactExists: thFactName == "" |
|
|
|
|
property Fact swFact: controller.getParameterFact(-1, modelData) |
|
|
|
|
property Fact thFact: thFactExists ? controller.getParameterFact(-1, thFactName) : null |
|
|
|
|
property real thValue: thFactExists ? thFact.rawValue : 0.5 |
|
|
|
|
property real thPWM: 1000 + (1000 * thValue) |
|
|
|
|
property int swChannel: swFact.rawValue - 1 |
|
|
|
|
property bool swActive: swChannel < 0 ? |
|
|
|
|
false : |
|
|
|
|
(thValue >= 0 ? |
|
|
|
|
(controller.rcChannelValues[swChannel] > thPWM) : |
|
|
|
|
(controller.rcChannelValues[swChannel] <= thPWM)) |
|
|
|
|
QGCLabel { |
|
|
|
|
text: fact.shortDescription |
|
|
|
|
text: swFact.shortDescription |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
color: swActive ? "yellow" : qgcPal.text |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FactComboBox { |
|
|
|
|
Layout.preferredWidth: _channelComboWidth |
|
|
|
|
fact: parent.fact |
|
|
|
|
fact: swFact |
|
|
|
|
indexModel: false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Repeater { |
|
|
|
|
model: [ "RC_MAP_FLAPS", "RC_MAP_MAN_SW" ] |
|
|
|
|
|
|
|
|
|
RowLayout { |
|
|
|
|
spacing: ScreenTools.defaultFontPixelWidth |
|
|
|
|
visible: controller.vehicle.fixedWing |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
|
|
|
|
property Fact fact: controller.getParameterFact(-1, modelData) |
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
text: fact.shortDescription |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FactComboBox { |
|
|
|
|
Layout.preferredWidth: _channelComboWidth |
|
|
|
|
fact: parent.fact |
|
|
|
|
indexModel: false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Repeater { |
|
|
|
|
model: [ "RC_MAP_TRANS_SW" ] |
|
|
|
|
|
|
|
|
|
RowLayout { |
|
|
|
|
spacing: ScreenTools.defaultFontPixelWidth |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
visible: controller.vehicle.vtol |
|
|
|
|
|
|
|
|
|
property Fact fact: controller.getParameterFact(-1, modelData) |
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
text: fact.shortDescription |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FactComboBox { |
|
|
|
|
Layout.preferredWidth: _channelComboWidth |
|
|
|
|
fact: parent.fact |
|
|
|
|
indexModel: false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Row { |
|
|
|
|
spacing: ScreenTools.defaultFontPixelWidth |
|
|
|
|
|
|
|
|
|
property Fact fact: controller.getParameterFact(-1, "RC_MAP_TRANS_SW", false) |
|
|
|
|
visible: (controller.vehicle.vtol && controller.parameterExists(-1, "RC_MAP_TRANS_SW")) |
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
anchors.baseline: vtolCombo.baseline |
|
|
|
|
text: qsTr("VTOL mode switch:") |
|
|
|
|
color: parent.fact.value === 0 ? qgcPal.text : (controller.rcChannelValues[parent.fact.value - 1] >= 1500 ? "yellow" : qgcPal.text) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FactComboBox { |
|
|
|
|
id: vtolCombo |
|
|
|
|
width: _channelComboWidth |
|
|
|
|
fact: parent.fact |
|
|
|
|
indexModel: false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} // Column |
|
|
|
|
} // Rectangle |
|
|
|
|
|
|
|
|
|
RCChannelMonitor { |
|
|
|
|
width: switchSettingsRect.width |
|
|
|
|
width: switchSettingsRect.width |
|
|
|
|
twoColumn: true |
|
|
|
|
} |
|
|
|
|
} // Column - Switch settings |
|
|
|
|
} // Row - Settings |
|
|
|
|