|
|
|
@ -293,7 +293,7 @@ void Joystick::run(void)
@@ -293,7 +293,7 @@ void Joystick::run(void)
|
|
|
|
|
|
|
|
|
|
// Adjust throttle to 0:1 range
|
|
|
|
|
if (_throttleMode == ThrottleModeCenterZero) { |
|
|
|
|
throttle = std::max(0.0f, throttle); |
|
|
|
|
throttle = std::max(0.0f, throttle); |
|
|
|
|
} else {
|
|
|
|
|
throttle = (throttle + 1.0f) / 2.0f; |
|
|
|
|
} |
|
|
|
@ -312,15 +312,14 @@ void Joystick::run(void)
@@ -312,15 +312,14 @@ void Joystick::run(void)
|
|
|
|
|
for (int buttonIndex=0; buttonIndex<_buttonCount; buttonIndex++) { |
|
|
|
|
quint16 buttonBit = 1 << buttonIndex; |
|
|
|
|
|
|
|
|
|
if (_rgButtonValues[buttonIndex]) { |
|
|
|
|
// Button pressed down, just record it
|
|
|
|
|
if (!_rgButtonValues[buttonIndex]) { |
|
|
|
|
// Button up, just record it
|
|
|
|
|
newButtonBits |= buttonBit; |
|
|
|
|
} else { |
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (buttonIndex >= reservedButtonCount) { |
|
|
|
|
// Button is above firmware reserved set
|
|
|
|
|
int buttonAction =_rgButtonActions[buttonIndex]; |
|
|
|
@ -328,13 +327,11 @@ void Joystick::run(void)
@@ -328,13 +327,11 @@ void Joystick::run(void)
|
|
|
|
|
qCDebug(JoystickLog) << "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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|