Commit d96940f7 authored by Rustom Jehangir's avatar Rustom Jehangir

Add joystick button function mapper for ArduSub

parent 571e7fb1
...@@ -18,6 +18,7 @@ import QGroundControl.Controls 1.0 ...@@ -18,6 +18,7 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
/// Joystick Config /// Joystick Config
QGCView { QGCView {
...@@ -448,6 +449,9 @@ QGCView { ...@@ -448,6 +449,9 @@ QGCView {
if (buttonActionRepeater.itemAt(index)) { if (buttonActionRepeater.itemAt(index)) {
buttonActionRepeater.itemAt(index).pressed = pressed buttonActionRepeater.itemAt(index).pressed = pressed
} }
if (subButtonActionRepeater.itemAt(index)) {
subButtonActionRepeater.itemAt(index).pressed = pressed
}
} }
} }
...@@ -470,7 +474,7 @@ QGCView { ...@@ -470,7 +474,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: _activeVehicle.manualControlReservedButtonCount == -1 ? false : modelData >= _activeVehicle.manualControlReservedButtonCount visible: (_activeVehicle.manualControlReservedButtonCount == -1 ? false : modelData >= _activeVehicle.manualControlReservedButtonCount) && !_activeVehicle.sub
property bool pressed property bool pressed
...@@ -509,6 +513,71 @@ QGCView { ...@@ -509,6 +513,71 @@ QGCView {
} }
} }
} // Repeater } // Repeater
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _activeVehicle.sub
QGCLabel {
horizontalAlignment: Text.AlignHCenter
width: ScreenTools.defaultFontPixelHeight * 1.5
text: qsTr("#")
}
QGCLabel {
width: ScreenTools.defaultFontPixelWidth * 15
text: qsTr("Function: ")
}
QGCLabel {
width: ScreenTools.defaultFontPixelWidth * 15
text: qsTr("Shift Function: ")
}
} // Row
Repeater {
id: subButtonActionRepeater
model: _activeJoystick.totalButtonCount
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _activeVehicle.sub
property bool pressed
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: ScreenTools.defaultFontPixelHeight * 1.5
height: width
border.width: 1
border.color: qgcPal.text
color: pressed ? qgcPal.buttonHighlight : qgcPal.button
QGCLabel {
anchors.fill: parent
color: pressed ? qgcPal.buttonHighlightText : qgcPal.buttonText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: modelData
}
}
FactComboBox {
id: mainSubButtonActionCombo
width: ScreenTools.defaultFontPixelWidth * 15
fact: controller.parameterExists(-1, "BTN"+index+"_FUNCTION") ? controller.getParameterFact(-1, "BTN" + index + "_FUNCTION") : null;
indexModel: false
}
FactComboBox {
id: shiftSubButtonActionCombo
width: ScreenTools.defaultFontPixelWidth * 15
fact: controller.parameterExists(-1, "BTN"+index+"_SFUNCTION") ? controller.getParameterFact(-1, "BTN" + index + "_SFUNCTION") : null;
indexModel: false
}
} // Row
} // Repeater
} // Column } // Column
} // Column - right setting column } // Column - right setting column
} // Row - Settings } // Row - Settings
......
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