It's been awhile since I've played oolite, but I've managed to aquire a joystick (Microsoft sidewinder precision pro / gameport).
I'm having an issue that the game ignores the joystick if it is deflected < 5%. (STICK_DEADZONE in ./src/Core/OOJoystickManager.h:105-109)
0
Ignoring the fact that this is hard coded and can't be configured, the main issue is that as soon as the joystick is deflected 5% the roll/pitch/yaw jumps to 5%, meaning that it is impossible to have your roll/yaw/pitch at between 0-5% without using precision mode.
I'm using version 0.76.1.
Ideally the code should do something like this:
Code: Select all
double min_deflect = 0.05; // minimum deflection before movement.
double scale_power = 2.0; // optional extra to redistribute the precision of the joystick.
double axis_value = raw_value / 32768.0;
double axis_sign = axis_value ? value < 0 ? -1 : 1;
axis_value = abs(axis_value);
// Test if joystick is deflected beyond min_deflect.
if (axis_value > min_deflect) {
// subtract min_deflect from axis_value.
axis_value -= min_deflect;
// scale axis_value so it is between 0 and 1.
axis_value = axis_value / (1.0 - min_deflect);
}
// scale value to redistribute precision
axis_value = pow(axis_value, scale_power);
// restore sign.
axis_value *= axis_sign;
If you do add the suggested scale_power as well, it'd be great if that was also configurable, 1.0 would result in unmodified behaviour, and higher values result in the joystick being more accurate near the center and less towards the extremities.
If I can get the damn code to compile I'll send you a patch (I'm having issues with spidermonkey js being compiled with the wrong options on Ubuntu - no trace functionality).
Thanks,
-CT
P.S. By hexediting the binary so that STICK_DEADZONE became 0.0 I found the joystick performed great, however this had the unfortunate side effect of making Trumbles invulnerable