Skip to content

Commit

Permalink
Joystick: SDL & Android cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Dec 21, 2024
1 parent f1fb8e0 commit fd9e451
Show file tree
Hide file tree
Showing 14 changed files with 321 additions and 324 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
path = libs/qmdnsengine
url = https://github.com/nitroshare/qmdnsengine.git
[submodule "resources/SDL_GameControllerDB"]
path = resources/SDL_GameControllerDB
path = libs/SDL_GameControllerDB
url = https://github.com/mdqinc/SDL_GameControllerDB.git
3 changes: 0 additions & 3 deletions qgcresources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@
<file alias="radioYawLeft.png">resources/calibration/mode2/radioYawLeft.png</file>
<file alias="radioYawRight.png">resources/calibration/mode2/radioYawRight.png</file>
</qresource>
<qresource prefix="/db/mapping/joystick">
<file alias="gamecontrollerdb.txt">resources/SDL_GameControllerDB/gamecontrollerdb.txt</file>
</qresource>
<qresource prefix="/res/audio">
<file alias="Alert">resources/audio/alert.wav</file>
</qresource>
Expand Down
10 changes: 3 additions & 7 deletions src/Joystick/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ target_sources(Joystick
JoystickSDL.h
)

target_compile_definitions(Joystick PRIVATE QGC_SDL_JOYSTICK)
target_compile_definitions(Joystick PRIVATE QGC_SDL_JOYSTICK SDL_MAIN_HANDLED)

FetchContent_Declare(SDL_GameControllerDB
GIT_REPOSITORY https://github.com/mdqinc/SDL_GameControllerDB.git
Expand All @@ -62,14 +62,10 @@ qt_add_resources(Joystick "gamecontrollerdb.txt"
qt_add_qml_module(Joystick
URI QGroundControl.JoystickManager
VERSION 1.0
OUTPUT_TARGETS Joystick_targets
IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY}
)

cmake_print_variables(Joystick_targets)

set(MINIMUM_SDL2_VERSION 2.30.0)

set(MINIMUM_SDL2_VERSION 2.24.0)
if(NOT QGC_BUILD_DEPENDENCIES)
find_package(SDL2 ${MINIMUM_SDL2_VERSION})
if(TARGET SDL2::SDL2)
Expand All @@ -93,7 +89,7 @@ message(STATUS "Building JoystickSDL")
include(FetchContent)
FetchContent_Declare(SDL
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-2.30.7
GIT_TAG release-2.30.10
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
Expand Down
7 changes: 4 additions & 3 deletions src/Joystick/Joystick.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <QtCore/QSettings>
#include <QtCore/QThread>

// JoystickLog Category declaration moved to QGCLoggingCategory.cc to allow access in Vehicle
QGC_LOGGING_CATEGORY(JoystickLog, "Joystick")
QGC_LOGGING_CATEGORY(JoystickValuesLog, "JoystickValuesLog")

int Joystick::_transmitterMode = 2;
Expand All @@ -41,8 +41,9 @@ AssignableButtonAction::AssignableButtonAction(QObject* parent, QString action_,
{
}

Joystick::Joystick(const QString& name, int axisCount, int buttonCount, int hatCount)
: _name (name)
Joystick::Joystick(const QString& name, int axisCount, int buttonCount, int hatCount, QObject *parent)
: QThread(parent)
, _name (name)
, _axisCount (axisCount)
, _buttonCount (buttonCount)
, _hatCount (hatCount)
Expand Down
4 changes: 2 additions & 2 deletions src/Joystick/Joystick.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <QtCore/QLoggingCategory>
#include <QtQmlIntegration/QtQmlIntegration>

// JoystickLog Category declaration moved to QGCLoggingCategory.cc to allow access in Vehicle
Q_DECLARE_LOGGING_CATEGORY(JoystickLog)
Q_DECLARE_LOGGING_CATEGORY(JoystickValuesLog)
Q_DECLARE_METATYPE(GRIPPER_ACTIONS)

Expand Down Expand Up @@ -62,7 +62,7 @@ class Joystick : public QThread
Q_MOC_INCLUDE("QmlObjectListModel.h")
Q_MOC_INCLUDE("Vehicle.h")
public:
Joystick(const QString& name, int axisCount, int buttonCount, int hatCount);
Joystick(const QString& name, int axisCount, int buttonCount, int hatCount, QObject *parent = nullptr);

virtual ~Joystick();

Expand Down
Loading

0 comments on commit fd9e451

Please sign in to comment.