1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00
This commit is contained in:
Bertrand Songis 2020-03-27 12:32:35 +01:00
parent 1d3f04482f
commit cb31b10b36
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
2 changed files with 20 additions and 11 deletions

View file

@ -693,11 +693,13 @@ class FlightModeField: public TransformedField {
internalField.Append(new UnsignedField<8>(this, phase.fadeIn)); internalField.Append(new UnsignedField<8>(this, phase.fadeIn));
internalField.Append(new UnsignedField<8>(this, phase.fadeOut)); internalField.Append(new UnsignedField<8>(this, phase.fadeOut));
for (int i=0; i<rotencCount; i++) { if (version < 219) {
internalField.Append(new SignedField<16>(this, phase.rotaryEncoders[i])); for (int i = 0; i < rotencCount; i++) {
internalField.Append(new SignedField<16>(this, phase.rotaryEncoders[i]));
}
} }
for (int i=0; i<MAX_GVARS(board, version); i++) { for (int i = 0; i < MAX_GVARS(board, version); i++) {
internalField.Append(new SignedField<16>(this, phase.gvars[i])); internalField.Append(new SignedField<16>(this, phase.gvars[i]));
} }
} }

View file

@ -99,8 +99,9 @@ void Joystick::processEvents()
axes[i] = moved; axes[i] = moved;
} }
} }
else else {
axisRepeatTimers[i].restart(); axisRepeatTimers[i].restart();
}
} }
else { else {
emit axisValueChanged(i, 0); emit axisValueChanged(i, 0);
@ -108,17 +109,20 @@ void Joystick::processEvents()
} }
for (i = 0; i < numButtons; i++) { for (i = 0; i < numButtons; i++) {
Uint8 changed = SDL_JoystickGetButton(joystick, i); Uint8 changed = SDL_JoystickGetButton(joystick, i);
if ( (changed != buttons[i]) ) { if ((changed != buttons[i])) {
emit buttonValueChanged(i, (bool) changed); emit buttonValueChanged(i, (bool) changed);
buttons[i] = changed; buttons[i] = changed;
buttonRepeatTimers[i].restart(); buttonRepeatTimers[i].restart();
} else if (autoRepeat && changed != 0) { }
else if (autoRepeat && changed != 0) {
if ( buttonRepeatTimers[i].elapsed() >= autoRepeatDelay ) { if ( buttonRepeatTimers[i].elapsed() >= autoRepeatDelay ) {
emit buttonValueChanged(i, (bool) changed); emit buttonValueChanged(i, (bool) changed);
buttons[i] = changed; buttons[i] = changed;
} }
} else }
else {
buttonRepeatTimers[i].restart(); buttonRepeatTimers[i].restart();
}
} }
for (i = 0; i < numHats; i++) { for (i = 0; i < numHats; i++) {
Uint8 changed = SDL_JoystickGetHat(joystick, i); Uint8 changed = SDL_JoystickGetHat(joystick, i);
@ -126,19 +130,22 @@ void Joystick::processEvents()
emit hatValueChanged(i, changed); emit hatValueChanged(i, changed);
hats[i] = changed; hats[i] = changed;
hatRepeatTimers[i].restart(); hatRepeatTimers[i].restart();
} else if (autoRepeat && changed != 0) { }
if ( hatRepeatTimers[i].elapsed() >= autoRepeatDelay ) { else if (autoRepeat && changed != 0) {
if (hatRepeatTimers[i].elapsed() >= autoRepeatDelay) {
emit hatValueChanged(i, changed); emit hatValueChanged(i, changed);
hats[i] = changed; hats[i] = changed;
} }
} else }
else {
hatRepeatTimers[i].restart(); hatRepeatTimers[i].restart();
}
} }
for (i = 0; i < numTrackballs; i++) { for (i = 0; i < numTrackballs; i++) {
int dx, dy; int dx, dy;
SDL_JoystickGetBall(joystick, i, &dx, &dy); SDL_JoystickGetBall(joystick, i, &dx, &dy);
if ( dx != 0 || dy != 0 ) if (dx != 0 || dy != 0)
emit trackballValueChanged(i, dx, dy); emit trackballValueChanged(i, dx, dy);
} }
} }