Read the raw values and check them against the saturation value, if one of them is larger then initialization of the joystick is still in progress.
This commit is contained in:
parent
2d0b44ee63
commit
65a20b5829
1 changed files with 5 additions and 1 deletions
|
@ -358,8 +358,12 @@ void FGJoystickInput::updateJoystick(int index, FGJoystickInput::joystick* joy,
|
|||
// Joystick axes can get initialized to extreme values, at least on Linux.
|
||||
// https://sourceforge.net/p/flightgear/codetickets/2185/
|
||||
if (initializing[index]) {
|
||||
float axis_values[MAX_JOYSTICK_AXES];
|
||||
int buttons;
|
||||
|
||||
js->rawRead(&buttons, axis_values);
|
||||
for (int j = 0; j < joy->naxes; j++) {
|
||||
if (fabsf(axis_values[j]) > 0.5f) return;
|
||||
if (fabsf(axis_values[j]) > js->getSaturation(j)) return;
|
||||
}
|
||||
initializing[index] = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue