Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
501c0fe3
Commit
501c0fe3
authored
Jan 27, 2017
by
Jacob Walser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close SDL joystick threads after joystick is unplugged
parent
a44be8b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
JoystickManager.cc
src/Joystick/JoystickManager.cc
+6
-6
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+16
-16
No files found.
src/Joystick/JoystickManager.cc
View file @
501c0fe3
...
...
@@ -92,11 +92,10 @@ void JoystickManager::_setActiveJoystickFromSettings(void)
qCDebug
(
JoystickManagerLog
)
<<
"Releasing joystick:"
<<
i
.
key
();
if
(
_activeJoystick
&&
!
newMap
.
contains
(
_activeJoystick
->
name
()))
{
qCDebug
(
JoystickManagerLog
)
<<
"
\t
was active"
;
_activeJoystick
->
stopPolling
();
_activeJoystick
=
NULL
;
setActiveJoystick
(
NULL
);
}
// FIXME: Don't leave this hanging! We need to free the object.
//
i.value()->deleteLater();
i
.
value
()
->
wait
(
1000
);
i
.
value
()
->
deleteLater
();
}
}
...
...
@@ -150,9 +149,10 @@ void JoystickManager::setActiveJoystick(Joystick* joystick)
settings
.
beginGroup
(
_settingsGroup
);
settings
.
setValue
(
_settingsKeyActiveJoystick
,
_activeJoystick
->
name
());
emit
activeJoystickChanged
(
_activeJoystick
);
emit
activeJoystickNameChanged
(
_activeJoystick
->
name
());
}
emit
activeJoystickChanged
(
_activeJoystick
);
emit
activeJoystickNameChanged
(
_activeJoystick
?
_activeJoystick
->
name
()
:
""
);
}
QVariantList
JoystickManager
::
joysticks
(
void
)
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
501c0fe3
...
...
@@ -369,8 +369,8 @@ SetupPage {
QGCCheckBox
{
id
:
enabledCheckBox
enabled
:
_activeJoystick
.
calibrated
text
:
_activeJoystick
.
calibrated
?
qsTr
(
"
Enable joystick input
"
)
:
qsTr
(
"
Enable not allowed (Calibrate First)
"
)
enabled
:
_activeJoystick
?
_activeJoystick
.
calibrated
:
false
text
:
_activeJoystick
?
_activeJoystick
.
calibrated
?
qsTr
(
"
Enable joystick input
"
)
:
qsTr
(
"
Enable not allowed (Calibrate First)
"
)
:
""
checked
:
_activeVehicle
.
joystickEnabled
onClicked
:
_activeVehicle
.
joystickEnabled
=
checked
...
...
@@ -379,7 +379,9 @@ SetupPage {
target
:
joystickManager
onActiveJoystickChanged
:
{
if
(
_activeJoystick
)
{
enabledCheckBox
.
checked
=
Qt
.
binding
(
function
()
{
return
_activeJoystick
.
calibrated
&&
_activeVehicle
.
joystickEnabled
})
}
}
}
}
...
...
@@ -414,9 +416,7 @@ SetupPage {
target
:
joystickManager
onAvailableJoysticksChanged
:
{
var
index
=
joystickCombo
.
find
(
joystickManager
.
activeJoystickName
)
if
(
index
==
-
1
)
{
console
.
warn
(
qsTr
(
"
Active joystick name not in combo
"
),
joystickManager
.
activeJoystickName
)
}
else
{
if
(
index
>=
0
)
{
joystickCombo
.
currentIndex
=
index
}
}
...
...
@@ -433,7 +433,7 @@ SetupPage {
QGCRadioButton
{
exclusiveGroup
:
throttleModeExclusiveGroup
text
:
qsTr
(
"
Center stick is zero throttle
"
)
checked
:
_activeJoystick
.
throttleMode
==
0
checked
:
_activeJoystick
?
_activeJoystick
.
throttleMode
==
0
:
false
onClicked
:
_activeJoystick
.
throttleMode
=
0
}
...
...
@@ -442,11 +442,11 @@ SetupPage {
x
:
20
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
_activeJoystick
.
throttleMode
==
0
visible
:
_activeJoystick
?
_activeJoystick
.
throttleMode
==
0
:
false
QGCCheckBox
{
id
:
accumulator
checked
:
_activeJoystick
.
accumulator
checked
:
_activeJoystick
?
_activeJoystick
.
accumulator
:
false
text
:
qsTr
(
"
Spring loaded throttle smoothing
"
)
onClicked
:
_activeJoystick
.
accumulator
=
checked
...
...
@@ -456,7 +456,7 @@ SetupPage {
QGCRadioButton
{
exclusiveGroup
:
throttleModeExclusiveGroup
text
:
qsTr
(
"
Full down stick is zero throttle
"
)
checked
:
_activeJoystick
.
throttleMode
==
1
checked
:
_activeJoystick
?
_activeJoystick
.
throttleMode
==
1
:
false
onClicked
:
_activeJoystick
.
throttleMode
=
1
}
...
...
@@ -467,7 +467,7 @@ SetupPage {
QGCCheckBox
{
id
:
exponential
checked
:
_activeJoystick
.
exponential
checked
:
_activeJoystick
?
_activeJoystick
.
exponential
:
false
text
:
qsTr
(
"
Use exponential curve on roll, pitch, yaw
"
)
onClicked
:
_activeJoystick
.
exponential
=
checked
...
...
@@ -556,7 +556,7 @@ SetupPage {
Repeater
{
id
:
buttonActionRepeater
model
:
_activeJoystick
.
totalButtonCount
model
:
_activeJoystick
?
_activeJoystick
.
totalButtonCount
:
0
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
...
...
@@ -566,7 +566,7 @@ SetupPage {
QGCCheckBox
{
anchors.verticalCenter
:
parent
.
verticalCenter
checked
:
_activeJoystick
.
buttonActions
[
modelData
]
!=
""
checked
:
_activeJoystick
?
_activeJoystick
.
buttonActions
[
modelData
]
!=
""
:
false
onClicked
:
_activeJoystick
.
setButtonAction
(
modelData
,
checked
?
buttonActionCombo
.
textAt
(
buttonActionCombo
.
currentIndex
)
:
""
)
}
...
...
@@ -592,7 +592,7 @@ SetupPage {
QGCComboBox
{
id
:
buttonActionCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
model
:
_activeJoystick
.
actions
model
:
_activeJoystick
?
_activeJoystick
.
actions
:
0
onActivated
:
_activeJoystick
.
setButtonAction
(
modelData
,
textAt
(
index
))
Component.onCompleted
:
currentIndex
=
find
(
_activeJoystick
.
buttonActions
[
modelData
])
...
...
@@ -623,7 +623,7 @@ SetupPage {
Repeater
{
id
:
jsButtonActionRepeater
model
:
_activeJoystick
.
totalButtonCount
model
:
_activeJoystick
?
_activeJoystick
.
totalButtonCount
:
0
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
...
...
@@ -704,7 +704,7 @@ SetupPage {
Repeater
{
id
:
axisMonitorRepeater
model
:
_activeJoystick
.
axisCount
model
:
_activeJoystick
?
_activeJoystick
.
axisCount
:
0
width
:
parent
.
width
Row
{
...
...
@@ -756,7 +756,7 @@ SetupPage {
Repeater
{
id
:
buttonMonitorRepeater
model
:
_activeJoystick
.
totalButtonCount
model
:
_activeJoystick
?
_activeJoystick
.
totalButtonCount
:
0
Rectangle
{
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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