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
bf4ab002
Commit
bf4ab002
authored
Apr 21, 2016
by
Gregory Dymarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Activating Joystick module for all builds
parent
151af212
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
36 deletions
+11
-36
qgroundcontrol.pro
qgroundcontrol.pro
+2
-2
Joystick.cc
src/Joystick/Joystick.cc
+5
-14
Joystick.h
src/Joystick/Joystick.h
+0
-2
JoystickManager.cc
src/Joystick/JoystickManager.cc
+2
-11
QGCApplication.cc
src/QGCApplication.cc
+2
-3
Vehicle.cc
src/Vehicle/Vehicle.cc
+0
-4
No files found.
qgroundcontrol.pro
View file @
bf4ab002
...
...
@@ -266,6 +266,7 @@ HEADERS += \
src
/
HomePositionManager
.
h
\
src
/
Joystick
/
Joystick
.
h
\
src
/
Joystick
/
JoystickManager
.
h
\
src
/
VehicleSetup
/
JoystickConfigController
.
h
\
src
/
FollowMe
/
FollowMe
.
h
\
src
/
PositionManager
/
SimulatedPosition
.
h
\
src
/
JsonHelper
.
h
\
...
...
@@ -390,7 +391,6 @@ HEADERS += \
src
/
GPS
/
GPSManager
.
h
\
src
/
GPS
/
GPSPositionMessage
.
h
\
src
/
GPS
/
GPSProvider
.
h
\
src
/
VehicleSetup
/
JoystickConfigController
.
h
\
src
/
ViewWidgets
/
CustomCommandWidget
.
h
\
src
/
ViewWidgets
/
CustomCommandWidgetController
.
h
\
src
/
ViewWidgets
/
LogDownload
.
h
\
...
...
@@ -423,6 +423,7 @@ SOURCES += \
src
/
HomePositionManager
.
cc
\
src
/
Joystick
/
Joystick
.
cc
\
src
/
Joystick
/
JoystickManager
.
cc
\
src
/
VehicleSetup
/
JoystickConfigController
.
cc
\
src
/
JsonHelper
.
cc
\
src
/
FollowMe
/
FollowMe
.
cc
\
src
/
LogCompressor
.
cc
\
...
...
@@ -531,7 +532,6 @@ SOURCES += \
src
/
GPS
/
RTCM
/
RTCMMavlink
.
cc
\
src
/
GPS
/
GPSManager
.
cc
\
src
/
GPS
/
GPSProvider
.
cc
\
src
/
VehicleSetup
/
JoystickConfigController
.
cc
\
src
/
ViewWidgets
/
CustomCommandWidget
.
cc
\
src
/
ViewWidgets
/
CustomCommandWidgetController
.
cc
\
src
/
ViewWidgets
/
LogDownload
.
cc
\
...
...
src/Joystick/Joystick.cc
View file @
bf4ab002
...
...
@@ -29,6 +29,7 @@
#include <QSettings>
#ifndef __mobile__
#define __sdljoystick__
#ifdef Q_OS_MAC
#include <SDL.h>
#else
...
...
@@ -52,7 +53,6 @@ const char* Joystick::_rgFunctionSettingsKey[Joystick::maxFunction] = {
};
Joystick
::
Joystick
(
const
QString
&
name
,
int
axisCount
,
int
buttonCount
,
int
sdlIndex
,
MultiVehicleManager
*
multiVehicleManager
)
#ifndef __mobile__
:
_sdlIndex
(
sdlIndex
)
,
_exitThread
(
false
)
,
_name
(
name
)
...
...
@@ -68,15 +68,8 @@ Joystick::Joystick(const QString& name, int axisCount, int buttonCount, int sdlI
,
_activeVehicle
(
NULL
)
,
_pollingStartedForCalibration
(
false
)
,
_multiVehicleManager
(
multiVehicleManager
)
#endif // __mobile__
{
#ifdef __mobile__
Q_UNUSED
(
name
)
Q_UNUSED
(
axisCount
)
Q_UNUSED
(
buttonCount
)
Q_UNUSED
(
sdlIndex
)
Q_UNUSED
(
multiVehicleManager
)
#else
_rgAxisValues
=
new
int
[
_axisCount
];
_rgCalibration
=
new
Calibration_t
[
_axisCount
];
_rgButtonValues
=
new
bool
[
_buttonCount
];
...
...
@@ -90,20 +83,17 @@ Joystick::Joystick(const QString& name, int axisCount, int buttonCount, int sdlI
}
_loadSettings
();
#endif // __mobile __
}
Joystick
::~
Joystick
()
{
#ifndef __mobile__
delete
_rgAxisValues
;
delete
_rgCalibration
;
delete
_rgButtonValues
;
delete
_rgButtonActions
;
#endif
}
#ifndef __mobile__
void
Joystick
::
_loadSettings
(
void
)
{
...
...
@@ -257,6 +247,7 @@ float Joystick::_adjustRange(int value, Calibration_t calibration)
void
Joystick
::
run
(
void
)
{
#ifdef __sdljoystick__
SDL_Joystick
*
sdlJoystick
=
SDL_JoystickOpen
(
_sdlIndex
);
if
(
!
sdlJoystick
)
{
...
...
@@ -363,6 +354,7 @@ void Joystick::run(void)
}
SDL_JoystickClose
(
sdlJoystick
);
#endif
}
void
Joystick
::
startPolling
(
Vehicle
*
vehicle
)
...
...
@@ -579,4 +571,3 @@ bool Joystick::_validButton(int button)
return
button
>=
0
&&
button
<
_buttonCount
;
}
#endif // __mobile__
src/Joystick/Joystick.h
View file @
bf4ab002
...
...
@@ -63,7 +63,6 @@ public:
ThrottleModeMax
}
ThrottleMode_t
;
#ifndef __mobile__
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
bool
calibrated
MEMBER
_calibrated
NOTIFY
calibratedChanged
)
...
...
@@ -174,7 +173,6 @@ private:
bool
_pollingStartedForCalibration
;
MultiVehicleManager
*
_multiVehicleManager
;
#endif // __mobile__
private:
static
const
char
*
_rgFunctionSettingsKey
[
maxFunction
];
...
...
src/Joystick/JoystickManager.cc
View file @
bf4ab002
...
...
@@ -27,6 +27,7 @@
#include <QQmlEngine>
#ifndef __mobile__
#define __sdljoystick__
#ifdef Q_OS_MAC
#include <SDL.h>
#else
...
...
@@ -55,7 +56,7 @@ void JoystickManager::setToolbox(QGCToolbox *toolbox)
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
#if
ndef __mobile
__
#if
def __sdljoystick
__
if
(
SDL_InitSubSystem
(
SDL_INIT_JOYSTICK
|
SDL_INIT_NOPARACHUTE
)
<
0
)
{
qWarning
()
<<
"Couldn't initialize SimpleDirectMediaLayer:"
<<
SDL_GetError
();
return
;
...
...
@@ -95,7 +96,6 @@ void JoystickManager::setToolbox(QGCToolbox *toolbox)
void
JoystickManager
::
_setActiveJoystickFromSettings
(
void
)
{
#ifndef __mobile__
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
...
...
@@ -107,7 +107,6 @@ void JoystickManager::_setActiveJoystickFromSettings(void)
setActiveJoystick
(
_name2JoystickMap
.
value
(
name
,
_name2JoystickMap
.
first
()));
settings
.
setValue
(
_settingsKeyActiveJoystick
,
_activeJoystick
->
name
());
#endif
}
Joystick
*
JoystickManager
::
activeJoystick
(
void
)
...
...
@@ -117,9 +116,6 @@ Joystick* JoystickManager::activeJoystick(void)
void
JoystickManager
::
setActiveJoystick
(
Joystick
*
joystick
)
{
#ifdef __mobile__
Q_UNUSED
(
joystick
)
#else
QSettings
settings
;
if
(
!
_name2JoystickMap
.
contains
(
joystick
->
name
()))
{
...
...
@@ -138,7 +134,6 @@ void JoystickManager::setActiveJoystick(Joystick* joystick)
emit
activeJoystickChanged
(
_activeJoystick
);
emit
activeJoystickNameChanged
(
_activeJoystick
->
name
());
#endif
}
QVariantList
JoystickManager
::
joysticks
(
void
)
...
...
@@ -159,11 +154,7 @@ QStringList JoystickManager::joystickNames(void)
QString
JoystickManager
::
activeJoystickName
(
void
)
{
#ifdef __mobile__
return
QString
();
#else
return
_activeJoystick
?
_activeJoystick
->
name
()
:
QString
();
#endif
}
void
JoystickManager
::
setActiveJoystickName
(
const
QString
&
name
)
...
...
src/QGCApplication.cc
View file @
bf4ab002
...
...
@@ -85,6 +85,7 @@
#include "PX4/PX4FirmwarePlugin.h"
#include "Vehicle.h"
#include "MavlinkQmlSingleton.h"
#include "JoystickConfigController.h"
#include "JoystickManager.h"
#include "QmlObjectListModel.h"
#include "MissionManager.h"
...
...
@@ -115,7 +116,6 @@
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "FirmwareUpgradeController.h"
#include "JoystickConfigController.h"
#include "MainWindow.h"
#endif
...
...
@@ -463,12 +463,11 @@ void QGCApplication::_initCommon(void)
qmlRegisterType
<
ValuesWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ValuesWidgetController"
);
qmlRegisterType
<
QGCMobileFileDialogController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"QGCMobileFileDialogController"
);
qmlRegisterType
<
RCChannelMonitorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"RCChannelMonitorController"
);
qmlRegisterType
<
JoystickConfigController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"JoystickConfigController"
);
#ifndef __mobile__
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
CustomCommandWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"CustomCommandWidgetController"
);
qmlRegisterType
<
FirmwareUpgradeController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"FirmwareUpgradeController"
);
qmlRegisterType
<
JoystickConfigController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"JoystickConfigController"
);
qmlRegisterType
<
LogDownloadController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"LogDownloadController"
);
#endif
...
...
src/Vehicle/Vehicle.cc
View file @
bf4ab002
...
...
@@ -1095,7 +1095,6 @@ void Vehicle::setJoystickEnabled(bool enabled)
void
Vehicle
::
_startJoystick
(
bool
start
)
{
#ifndef __mobile__
Joystick
*
joystick
=
_joystickManager
->
activeJoystick
();
if
(
joystick
)
{
if
(
start
)
{
...
...
@@ -1106,9 +1105,6 @@ void Vehicle::_startJoystick(bool start)
joystick
->
stopPolling
();
}
}
#else
Q_UNUSED
(
start
);
#endif
}
bool
Vehicle
::
active
(
void
)
...
...
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