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
Show 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)
...
@@ -221,14 +221,14 @@ float Joystick::_adjustRange(int value, Calibration_t calibration)
void
Joystick
::
run
(
void
)
void
Joystick
::
run
(
void
)
{
{
open
();
_
open
();
while
(
!
_exitThread
)
{
while
(
!
_exitThread
)
{
update
();
_
update
();
// Update axes
// Update axes
for
(
int
axisIndex
=
0
;
axisIndex
<
_axisCount
;
axisIndex
++
)
{
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
// Calibration code requires signal to be emitted even if value hasn't changed
_rgAxisValues
[
axisIndex
]
=
newAxisValue
;
_rgAxisValues
[
axisIndex
]
=
newAxisValue
;
emit
rawAxisValueChanged
(
axisIndex
,
newAxisValue
);
emit
rawAxisValueChanged
(
axisIndex
,
newAxisValue
);
...
@@ -236,7 +236,7 @@ void Joystick::run(void)
...
@@ -236,7 +236,7 @@ void Joystick::run(void)
// Update buttons
// Update buttons
for
(
int
buttonIndex
=
0
;
buttonIndex
<
_buttonCount
;
buttonIndex
++
)
{
for
(
int
buttonIndex
=
0
;
buttonIndex
<
_buttonCount
;
buttonIndex
++
)
{
bool
newButtonValue
=
getButton
(
buttonIndex
);
bool
newButtonValue
=
_
getButton
(
buttonIndex
);
if
(
newButtonValue
!=
_rgButtonValues
[
buttonIndex
])
{
if
(
newButtonValue
!=
_rgButtonValues
[
buttonIndex
])
{
_rgButtonValues
[
buttonIndex
]
=
newButtonValue
;
_rgButtonValues
[
buttonIndex
]
=
newButtonValue
;
emit
rawButtonPressedChanged
(
buttonIndex
,
newButtonValue
);
emit
rawButtonPressedChanged
(
buttonIndex
,
newButtonValue
);
...
@@ -321,7 +321,7 @@ void Joystick::run(void)
...
@@ -321,7 +321,7 @@ void Joystick::run(void)
QGC
::
SLEEP
::
msleep
(
40
);
QGC
::
SLEEP
::
msleep
(
40
);
}
}
close
();
_
close
();
}
}
void
Joystick
::
startPolling
(
Vehicle
*
vehicle
)
void
Joystick
::
startPolling
(
Vehicle
*
vehicle
)
...
...
src/Joystick/Joystick.h
View file @
92422bd5
...
@@ -132,12 +132,12 @@ protected:
...
@@ -132,12 +132,12 @@ protected:
bool
_validButton
(
int
button
);
bool
_validButton
(
int
button
);
private:
private:
virtual
bool
open
()
=
0
;
virtual
bool
_
open
()
=
0
;
virtual
void
close
()
=
0
;
virtual
void
_
close
()
=
0
;
virtual
bool
update
()
=
0
;
virtual
bool
_
update
()
=
0
;
virtual
bool
getButton
(
int
i
)
=
0
;
virtual
bool
_
getButton
(
int
i
)
=
0
;
virtual
int
getAxis
(
int
i
)
=
0
;
virtual
int
_
getAxis
(
int
i
)
=
0
;
// Override from QThread
// Override from QThread
virtual
void
run
(
void
);
virtual
void
run
(
void
);
...
...
src/Joystick/JoystickSDL.cc
View file @
92422bd5
...
@@ -42,7 +42,7 @@ QMap<QString, Joystick*> JoystickSDL::discover(MultiVehicleManager* _multiVehicl
...
@@ -42,7 +42,7 @@ QMap<QString, Joystick*> JoystickSDL::discover(MultiVehicleManager* _multiVehicl
return
ret
;
return
ret
;
}
}
bool
JoystickSDL
::
open
(
void
)
{
bool
JoystickSDL
::
_
open
(
void
)
{
sdlJoystick
=
SDL_JoystickOpen
(
_index
);
sdlJoystick
=
SDL_JoystickOpen
(
_index
);
if
(
!
sdlJoystick
)
{
if
(
!
sdlJoystick
)
{
...
@@ -53,21 +53,21 @@ bool JoystickSDL::open(void) {
...
@@ -53,21 +53,21 @@ bool JoystickSDL::open(void) {
return
true
;
return
true
;
}
}
void
JoystickSDL
::
close
(
void
)
{
void
JoystickSDL
::
_
close
(
void
)
{
SDL_JoystickClose
(
sdlJoystick
);
SDL_JoystickClose
(
sdlJoystick
);
}
}
bool
JoystickSDL
::
update
(
void
)
bool
JoystickSDL
::
_
update
(
void
)
{
{
SDL_JoystickUpdate
();
SDL_JoystickUpdate
();
return
true
;
return
true
;
}
}
bool
JoystickSDL
::
getButton
(
int
i
)
{
bool
JoystickSDL
::
_
getButton
(
int
i
)
{
return
!!
SDL_JoystickGetButton
(
sdlJoystick
,
i
);
return
!!
SDL_JoystickGetButton
(
sdlJoystick
,
i
);
}
}
int
JoystickSDL
::
getAxis
(
int
i
)
{
int
JoystickSDL
::
_
getAxis
(
int
i
)
{
return
SDL_JoystickGetAxis
(
sdlJoystick
,
i
);
return
SDL_JoystickGetAxis
(
sdlJoystick
,
i
);
}
}
src/Joystick/JoystickSDL.h
View file @
92422bd5
...
@@ -20,12 +20,12 @@ public:
...
@@ -20,12 +20,12 @@ public:
static
QMap
<
QString
,
Joystick
*>
discover
(
MultiVehicleManager
*
_multiVehicleManager
);
static
QMap
<
QString
,
Joystick
*>
discover
(
MultiVehicleManager
*
_multiVehicleManager
);
private:
private:
virtual
bool
open
()
;
bool
_open
()
final
;
v
irtual
void
close
()
;
v
oid
_close
()
final
;
virtual
bool
update
()
;
bool
_update
()
final
;
virtual
bool
getButton
(
int
i
)
;
bool
_getButton
(
int
i
)
final
;
virtual
int
getAxis
(
int
i
)
;
int
_getAxis
(
int
i
)
final
;
SDL_Joystick
*
sdlJoystick
;
SDL_Joystick
*
sdlJoystick
;
int
_index
;
///< Index for SDL_JoystickOpen
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