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
92422bd5
Commit
92422bd5
authored
Jun 01, 2016
by
Gregory Dymarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving coding style
parent
6e33df1a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
Joystick.cc
src/Joystick/Joystick.cc
+5
-5
Joystick.h
src/Joystick/Joystick.h
+5
-5
JoystickSDL.cc
src/Joystick/JoystickSDL.cc
+7
-7
JoystickSDL.h
src/Joystick/JoystickSDL.h
+5
-5
No files found.
src/Joystick/Joystick.cc
View file @
92422bd5
...
...
@@ -221,14 +221,14 @@ float Joystick::_adjustRange(int value, Calibration_t calibration)
void
Joystick
::
run
(
void
)
{
open
();
_
open
();
while
(
!
_exitThread
)
{
update
();
_
update
();
// Update axes
for
(
int
axisIndex
=
0
;
axisIndex
<
_axisCount
;
axisIndex
++
)
{
int
newAxisValue
=
getAxis
(
axisIndex
);
int
newAxisValue
=
_
getAxis
(
axisIndex
);
// Calibration code requires signal to be emitted even if value hasn't changed
_rgAxisValues
[
axisIndex
]
=
newAxisValue
;
emit
rawAxisValueChanged
(
axisIndex
,
newAxisValue
);
...
...
@@ -236,7 +236,7 @@ void Joystick::run(void)
// Update buttons
for
(
int
buttonIndex
=
0
;
buttonIndex
<
_buttonCount
;
buttonIndex
++
)
{
bool
newButtonValue
=
getButton
(
buttonIndex
);
bool
newButtonValue
=
_
getButton
(
buttonIndex
);
if
(
newButtonValue
!=
_rgButtonValues
[
buttonIndex
])
{
_rgButtonValues
[
buttonIndex
]
=
newButtonValue
;
emit
rawButtonPressedChanged
(
buttonIndex
,
newButtonValue
);
...
...
@@ -321,7 +321,7 @@ void Joystick::run(void)
QGC
::
SLEEP
::
msleep
(
40
);
}
close
();
_
close
();
}
void
Joystick
::
startPolling
(
Vehicle
*
vehicle
)
...
...
src/Joystick/Joystick.h
View file @
92422bd5
...
...
@@ -132,12 +132,12 @@ protected:
bool
_validButton
(
int
button
);
private:
virtual
bool
open
()
=
0
;
virtual
void
close
()
=
0
;
virtual
bool
update
()
=
0
;
virtual
bool
_
open
()
=
0
;
virtual
void
_
close
()
=
0
;
virtual
bool
_
update
()
=
0
;
virtual
bool
getButton
(
int
i
)
=
0
;
virtual
int
getAxis
(
int
i
)
=
0
;
virtual
bool
_
getButton
(
int
i
)
=
0
;
virtual
int
_
getAxis
(
int
i
)
=
0
;
// Override from QThread
virtual
void
run
(
void
);
...
...
src/Joystick/JoystickSDL.cc
View file @
92422bd5
...
...
@@ -42,32 +42,32 @@ QMap<QString, Joystick*> JoystickSDL::discover(MultiVehicleManager* _multiVehicl
return
ret
;
}
bool
JoystickSDL
::
open
(
void
)
{
bool
JoystickSDL
::
_
open
(
void
)
{
sdlJoystick
=
SDL_JoystickOpen
(
_index
);
if
(
!
sdlJoystick
)
{
qCWarning
(
JoystickLog
)
<<
"SDL_JoystickOpen failed:"
<<
SDL_GetError
();
return
false
;
qCWarning
(
JoystickLog
)
<<
"SDL_JoystickOpen failed:"
<<
SDL_GetError
();
return
false
;
}
return
true
;
}
void
JoystickSDL
::
close
(
void
)
{
void
JoystickSDL
::
_
close
(
void
)
{
SDL_JoystickClose
(
sdlJoystick
);
}
bool
JoystickSDL
::
update
(
void
)
bool
JoystickSDL
::
_
update
(
void
)
{
SDL_JoystickUpdate
();
return
true
;
}
bool
JoystickSDL
::
getButton
(
int
i
)
{
bool
JoystickSDL
::
_
getButton
(
int
i
)
{
return
!!
SDL_JoystickGetButton
(
sdlJoystick
,
i
);
}
int
JoystickSDL
::
getAxis
(
int
i
)
{
int
JoystickSDL
::
_
getAxis
(
int
i
)
{
return
SDL_JoystickGetAxis
(
sdlJoystick
,
i
);
}
src/Joystick/JoystickSDL.h
View file @
92422bd5
...
...
@@ -20,12 +20,12 @@ public:
static
QMap
<
QString
,
Joystick
*>
discover
(
MultiVehicleManager
*
_multiVehicleManager
);
private:
virtual
bool
open
()
;
v
irtual
void
close
()
;
virtual
bool
update
()
;
bool
_open
()
final
;
v
oid
_close
()
final
;
bool
_update
()
final
;
virtual
bool
getButton
(
int
i
)
;
virtual
int
getAxis
(
int
i
)
;
bool
_getButton
(
int
i
)
final
;
int
_getAxis
(
int
i
)
final
;
SDL_Joystick
*
sdlJoystick
;
int
_index
;
///< Index for SDL_JoystickOpen
...
...
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