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
87bbb74d
Commit
87bbb74d
authored
Sep 18, 2017
by
Jacob Walser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix joystick tx mode initialization
parent
add505fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Joystick.cc
src/Joystick/Joystick.cc
+16
-3
Joystick.h
src/Joystick/Joystick.h
+1
-0
No files found.
src/Joystick/Joystick.cc
View file @
87bbb74d
...
...
@@ -75,6 +75,8 @@ Joystick::Joystick(const QString& name, int axisCount, int buttonCount, int hatC
_rgButtonValues
[
i
]
=
false
;
}
_updateTXModeSettingsKey
(
_multiVehicleManager
->
activeVehicle
());
_loadSettings
();
connect
(
_multiVehicleManager
,
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
Joystick
::
_activeVehicleChanged
);
...
...
@@ -119,7 +121,7 @@ void Joystick::_setDefaultCalibration(void) {
_saveSettings
();
}
void
Joystick
::
_
activeVehicleChanged
(
Vehicle
*
activeVehicle
)
void
Joystick
::
_
updateTXModeSettingsKey
(
Vehicle
*
activeVehicle
)
{
if
(
activeVehicle
)
{
if
(
activeVehicle
->
fixedWing
())
{
...
...
@@ -137,7 +139,16 @@ void Joystick::_activeVehicleChanged(Vehicle *activeVehicle)
qWarning
()
<<
"No valid joystick TXmode settings key for selected vehicle"
;
return
;
}
}
else
{
_txModeSettingsKey
=
NULL
;
}
}
void
Joystick
::
_activeVehicleChanged
(
Vehicle
*
activeVehicle
)
{
_updateTXModeSettingsKey
(
activeVehicle
);
if
(
activeVehicle
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
int
mode
=
settings
.
value
(
_txModeSettingsKey
,
activeVehicle
->
firmwarePlugin
()
->
defaultJoystickTXMode
()).
toInt
();
...
...
@@ -152,8 +163,10 @@ void Joystick::_loadSettings(void)
settings
.
beginGroup
(
_settingsGroup
);
if
(
_txModeSettingsKey
)
_transmitterMode
=
settings
.
value
(
_txModeSettingsKey
,
2
).
toInt
();
Vehicle
*
activeVehicle
=
_multiVehicleManager
->
activeVehicle
();
if
(
_txModeSettingsKey
&&
activeVehicle
)
_transmitterMode
=
settings
.
value
(
_txModeSettingsKey
,
activeVehicle
->
firmwarePlugin
()
->
defaultJoystickTXMode
()).
toInt
();
settings
.
beginGroup
(
_name
);
...
...
src/Joystick/Joystick.h
View file @
87bbb74d
...
...
@@ -181,6 +181,7 @@ private:
virtual
int
_getAxis
(
int
i
)
=
0
;
virtual
uint8_t
_getHat
(
int
hat
,
int
i
)
=
0
;
void
_updateTXModeSettingsKey
(
Vehicle
*
activeVehicle
);
int
_mapFunctionMode
(
int
mode
,
int
function
);
void
_remapAxes
(
int
currentMode
,
int
newMode
,
int
(
&
newMapping
)[
maxFunction
]);
...
...
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