Commit 8c0e81d9 authored by Gregory Dymarek's avatar Gregory Dymarek

Cleanup

parent e44fed2f
......@@ -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
......
......@@ -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<jint>("getAxis");
axisValue[i] = 0;
QAndroidJniObject range = rangeListNative.callObjectMethod("get", "()Landroid/view/InputDevice/MotionRange;");
if (range.isValid())
axisCode[i] = range.callMethod<jint>("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 ];
}
......
......@@ -287,6 +287,7 @@ Rectangle {
setupComplete: joystickManager.activeJoystick ? joystickManager.activeJoystick.calibrated : false
exclusiveGroup: setupButtonGroup
visible: _fullParameterVehicleAvailable && joystickManager.joysticks.length != 0
//visible: true
text: "Joystick"
onClicked: showJoystickPanel()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment