diff --git a/src/Joystick/Joystick.cc b/src/Joystick/Joystick.cc index 0e1abea405def84e1a2291b1f685a45618d8af15..a320cb273951855b495465f8de24e95473de02dc 100644 --- a/src/Joystick/Joystick.cc +++ b/src/Joystick/Joystick.cc @@ -89,7 +89,7 @@ void Joystick::run(void) open(); while (!_exitThread) { - update(); + update(); // Update axes for (int axisIndex=0; axisIndex<_axisCount; axisIndex++) { @@ -143,9 +143,9 @@ void Joystick::run(void) // We only send the buttons the firmwware has reserved int reservedButtonCount = _activeVehicle->manualControlReservedButtonCount(); - if (reservedButtonCount == -1) { + if (reservedButtonCount == -1) reservedButtonCount = _buttonCount; - } + quint16 newButtonBits = 0; // New set of button which are down quint16 buttonPressedBits = 0; // Buttons pressed for manualControl signal diff --git a/src/Joystick/JoystickAndroid.cc b/src/Joystick/JoystickAndroid.cc index 3de7ce4ca6567c67840dff44d886f3b49b7a7ed3..14bdcf9b8805e091b0c6af5f0b94d9f4b428133f 100644 --- a/src/Joystick/JoystickAndroid.cc +++ b/src/Joystick/JoystickAndroid.cc @@ -49,20 +49,20 @@ JoystickAndroid::JoystickAndroid(const QString& name, int id, MultiVehicleManage axisValue = new int[_axisCount]; axisCode = new int[_axisCount]; for (i=0;i<_axisCount;i++) { - QAndroidJniObject range = rangeListNative.callObjectMethod("get", "()Landroid/view/InputDevice/MotionRange;"); - if (range.isValid()) - axisCode[i] = range.callMethod("getAxis"); - axisValue[i] = 0; + QAndroidJniObject range = rangeListNative.callObjectMethod("get", "()Landroid/view/InputDevice/MotionRange;"); + if (range.isValid()) + axisCode[i] = range.callMethod("getAxis"); + axisValue[i] = 0; } - qDebug() << "joystick constructor:" << _name; + _axisCount = 4; + qDebug() << "axis:" <<_axisCount << "buttons:" <<_buttonCount; QtAndroidPrivate::registerGenericMotionEventListener(this); QtAndroidPrivate::registerKeyEventListener(this); } JoystickAndroid::~JoystickAndroid() { - qDebug() << "joystick destructor" << _name; delete btnCode; delete axisCode; @@ -150,11 +150,11 @@ bool JoystickAndroid::update(void) } bool JoystickAndroid::getButton(int i) { - return btnValue[ btnCode[i] ]; + return btnValue[ i ]; } int JoystickAndroid::getAxis(int i) { - return axisValue[ axisCode[i] ]; + return axisValue[ i ]; } diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index 18e50da45727022194981cf39baa9a048889a1d0..a5713a8e87242637d7df541bfce76b31e3c59395 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -279,6 +279,7 @@ Rectangle { setupComplete: joystickManager.activeJoystick ? joystickManager.activeJoystick.calibrated : false exclusiveGroup: setupButtonGroup visible: _fullParameterVehicleAvailable && joystickManager.joysticks.length != 0 + //visible: true text: "Joystick" onClicked: showJoystickPanel()