|
|
@ -312,15 +312,14 @@ void Joystick::run(void) |
|
|
|
for (int buttonIndex=0; buttonIndex<_buttonCount; buttonIndex++) { |
|
|
|
for (int buttonIndex=0; buttonIndex<_buttonCount; buttonIndex++) { |
|
|
|
quint16 buttonBit = 1 << buttonIndex; |
|
|
|
quint16 buttonBit = 1 << buttonIndex; |
|
|
|
|
|
|
|
|
|
|
|
if (_rgButtonValues[buttonIndex]) { |
|
|
|
if (!_rgButtonValues[buttonIndex]) { |
|
|
|
// Button pressed down, just record it
|
|
|
|
// Button up, just record it
|
|
|
|
newButtonBits |= buttonBit; |
|
|
|
newButtonBits |= buttonBit; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (_lastButtonBits & buttonBit) { |
|
|
|
if (_lastButtonBits & buttonBit) { |
|
|
|
// Button was down last time through, but is now up which indicates a button press
|
|
|
|
// Button was up last time through, but is now down which indicates a button press
|
|
|
|
qCDebug(JoystickLog) << "button triggered" << buttonIndex; |
|
|
|
qCDebug(JoystickLog) << "button triggered" << buttonIndex; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (buttonIndex >= reservedButtonCount) { |
|
|
|
if (buttonIndex >= reservedButtonCount) { |
|
|
|
// Button is above firmware reserved set
|
|
|
|
// Button is above firmware reserved set
|
|
|
|
int buttonAction =_rgButtonActions[buttonIndex]; |
|
|
|
int buttonAction =_rgButtonActions[buttonIndex]; |
|
|
@ -328,13 +327,11 @@ void Joystick::run(void) |
|
|
|
qCDebug(JoystickLog) << "buttonActionTriggered" << buttonAction; |
|
|
|
qCDebug(JoystickLog) << "buttonActionTriggered" << buttonAction; |
|
|
|
emit buttonActionTriggered(buttonAction); |
|
|
|
emit buttonActionTriggered(buttonAction); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
// Button is within firmware reserved set
|
|
|
|
|
|
|
|
// Record the button press for manualControl signal
|
|
|
|
|
|
|
|
buttonPressedBits |= buttonBit; |
|
|
|
|
|
|
|
qCDebug(JoystickLog) << "button press recorded for manualControl" << buttonIndex; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mark the button as pressed as long as its pressed
|
|
|
|
|
|
|
|
buttonPressedBits |= buttonBit; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|