1
0
Fork 0

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:
Erik Hofman 2020-01-27 09:15:53 +01:00
parent 2d0b44ee63
commit 65a20b5829

View file

@ -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;
}