Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
e3195f26
Commit
e3195f26
authored
Jul 31, 2016
by
Don Gagne
Committed by
GitHub
Jul 31, 2016
Browse files
Merge pull request #3879 from bluerobotics/subJoystickSetup
Joystick button function selector for ArduSub
parents
5185cace
d96940f7
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/FactSystem/FactControls/FactComboBox.qml
View file @
e3195f26
...
...
@@ -10,7 +10,7 @@ QGCComboBox {
property
Fact
fact
:
Fact
{
}
property
bool
indexModel
:
true
///< true: model must be specifed, selected index is fact value, false: use enum meta data
model
:
fact
.
enumStrings
model
:
fact
?
fact
.
enumStrings
:
null
currentIndex
:
indexModel
?
fact
.
value
:
fact
.
enumIndex
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
e3195f26
...
...
@@ -79,7 +79,7 @@ public:
bool
setFlightMode
(
const
QString
&
flightMode
,
uint8_t
*
base_mode
,
uint32_t
*
custom_mode
)
final
;
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
final
;
void
pauseVehicle
(
Vehicle
*
vehicle
);
int
manualControlReservedButtonCount
(
void
)
final
;
int
manualControlReservedButtonCount
(
void
);
bool
adjustIncomingMavlinkMessage
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
final
;
void
adjustOutgoingMavlinkMessage
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
final
;
void
initializeVehicle
(
Vehicle
*
vehicle
)
final
;
...
...
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
View file @
e3195f26
...
...
@@ -47,3 +47,8 @@ ArduSubFirmwarePlugin::ArduSubFirmwarePlugin(void)
supportedFlightModes
<<
APMSubMode
(
APMSubMode
::
ALT_HOLD
,
true
);
setSupportedModes
(
supportedFlightModes
);
}
int
ArduSubFirmwarePlugin
::
manualControlReservedButtonCount
(
void
)
{
return
0
;
}
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h
View file @
e3195f26
...
...
@@ -67,6 +67,7 @@ public:
ArduSubFirmwarePlugin
(
void
);
// Overrides from FirmwarePlugin
int
manualControlReservedButtonCount
(
void
);
};
...
...
src/Joystick/Joystick.cc
View file @
e3195f26
...
...
@@ -284,7 +284,7 @@ void Joystick::run(void)
throttle
=
std
::
max
(
-
1.0
f
,
std
::
min
(
tanf
(
asinf
(
throttle_limited
)),
1.0
f
));
// Adjust throttle to 0:1 range
if
(
_throttleMode
==
ThrottleModeCenterZero
)
{
if
(
_throttleMode
==
ThrottleModeCenterZero
&&
!
_activeVehicle
->
sub
()
)
{
throttle
=
std
::
max
(
0.0
f
,
throttle
);
}
else
{
throttle
=
(
throttle
+
1.0
f
)
/
2.0
f
;
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
e3195f26
...
...
@@ -18,6 +18,7 @@ import QGroundControl.Controls 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
/// Joystick Config
QGCView
{
...
...
@@ -380,6 +381,7 @@ QGCView {
Column
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
3
visible
:
!
_activeVehicle
.
sub
ExclusiveGroup
{
id
:
throttleModeExclusiveGroup
}
...
...
@@ -447,6 +449,9 @@ QGCView {
if
(
buttonActionRepeater
.
itemAt
(
index
))
{
buttonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
}
if
(
subButtonActionRepeater
.
itemAt
(
index
))
{
subButtonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
}
}
}
...
...
@@ -469,7 +474,7 @@ QGCView {
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
_activeVehicle
.
manualControlReservedButtonCount
==
-
1
?
false
:
modelData
>=
_activeVehicle
.
manualControlReservedButtonCount
visible
:
(
_activeVehicle
.
manualControlReservedButtonCount
==
-
1
?
false
:
modelData
>=
_activeVehicle
.
manualControlReservedButtonCount
)
&&
!
_activeVehicle
.
sub
property
bool
pressed
...
...
@@ -508,6 +513,71 @@ QGCView {
}
}
}
// 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 - right setting column
}
// Row - Settings
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment