Commit 82e8b33b authored by Don Gagne's avatar Don Gagne

Handle missing channel options

parent 8eced4a7
...@@ -36,6 +36,7 @@ QGCView { ...@@ -36,6 +36,7 @@ QGCView {
viewPanel: panel viewPanel: panel
property real _margins: ScreenTools.defaultFontPixelHeight property real _margins: ScreenTools.defaultFontPixelHeight
property bool _channelOptionsAvailable: controller.parameterExists(-1, "CH7_OPT") // Not available in all firmware types
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
...@@ -116,6 +117,7 @@ QGCView { ...@@ -116,6 +117,7 @@ QGCView {
anchors.left: flightModeSettings.right anchors.left: flightModeSettings.right
text: "Channel Options" text: "Channel Options"
font.weight: Font.DemiBold font.weight: Font.DemiBold
visible: _channelOptionsAvailable
} }
Rectangle { Rectangle {
...@@ -126,6 +128,7 @@ QGCView { ...@@ -126,6 +128,7 @@ QGCView {
width: channelOptColumn.width + (_margins * 2) width: channelOptColumn.width + (_margins * 2)
height: channelOptColumn.height + ScreenTools.defaultFontPixelHeight height: channelOptColumn.height + ScreenTools.defaultFontPixelHeight
color: qgcPal.windowShade color: qgcPal.windowShade
visible: _channelOptionsAvailable
Column { Column {
id: channelOptColumn id: channelOptColumn
...@@ -141,19 +144,18 @@ QGCView { ...@@ -141,19 +144,18 @@ QGCView {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
property int index: modelData + 7 property int index: modelData + 7
property Fact nullFact: Fact { }
QGCLabel { QGCLabel {
anchors.baseline: optCombo.baseline anchors.baseline: optCombo.baseline
text: "Channel option " + index + ":" text: "Channel option " + index + ":"
color: controller.channelOptionEnabled[modelData] ? qgcPal.buttonHighlight : qgcPal.text color: controller.channelOptionEnabled[modelData] ? qgcPal.buttonHighlight : qgcPal.text
Component.onCompleted: console.log(index, controller.channelOptionEnabled[modelData])
} }
FactComboBox { FactComboBox {
id: optCombo id: optCombo
width: ScreenTools.defaultFontPixelWidth * 15 width: ScreenTools.defaultFontPixelWidth * 15
fact: controller.getParameterFact(-1, "CH" + index + "_OPT") fact: _channelOptionsAvailable ? controller.getParameterFact(-1, "CH" + index + "_OPT") : nullFact
indexModel: false indexModel: false
} }
} }
......
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