As some people already noticed (see viewtopic.php?f=29&t=12891), there is no possibility to define a deadzone for joysticks as HID input devices.
My controller for example is too worn out for a relative control of XY pads for example, even when I don't touch the joysticks, they fade slowly away, in the one or other direction.
It would be great to reduce the valid range of values to a "safe" range, for example when the joystick sends values from 0 to 100, but it is worn out in some parts, being able to define a so called dead zone would it make possible to use older (and maybe newer sticks that are not high quality) for relative movements.
As every joystick has it's dead zone in the middle, it is sufficient to define a range from 0 to 50 (half of the complete range) in a single additional "dead zone" field, at best at the slider profile or a clone of the slider specifically made for joysticks (like there exist knobs and encoders).
It's value is then applied to the center of the valid values range (from 0 to 100 in this example) in both directions.
So this means, when the stick is centered at value 50 (I assume that every joystick has it's center in the middle of the valid range) with a defined dead zone of 20, it's "real" valid range goes from 0 to 40 and from 60 to 100. For this to work, the original values from 0 to 50 and from 50 to 100 have to be remapped to the ranges from 0 to 40 and from 60 to 100 for having the full capabilities. If it would be cutted of, the joystick would loose it's sensitive range.
The recalculation can be done like this (pseudocode):
Code: Select all
# assume $max is 100 and $dead_zone is 20
# (could be percentages, too, of course, for example when the $max is 255 and the $dead_zone is 20%, then 255 * 0,2 gives the right absolute $dead_zone value)
$new_range = ($max - $dead_zone) / 2 = (100 - 20) / 2 = 40
$center = $max / 2 = 100 / 2 = 50
if $real_value < $center; then
# assume $real_value is 25 (0,5 from 0 to 50), then it should become 20 (0,5 from 0 to 40)
$new_value = $real_value / $center * $new_range = 25 / 50 * 40 = 20
else; then
# assume $real_value is 80 (0,6 from 50 to 100), then it should become 84 (0,6 from 60 to 100)
$new_value = $max - $new_range + (($real_value - $center) / $center * $new_range) = 100 - 40 + ((80 - 50) / 50 * 40) = 60 + (30 / 50 * 40) = 60 + 24 = 84
endif
I think, with one additional field "dead zone" either at the slider or at a clone of the slider called for example "joystick-axis" and with the code snippet above for remapping the real value to the new ranges outside the dead zone, it should be possible to use gamepads and joysticks for relative movements of XY pads and sliders without the problem of small movements without touching anything because of worn out sticks. Most of the recent games have such dead zones implemented, by the way... so the problem is quite common... and I think the solution should not be too difficult to implement, I hope
By the way: As a joystick is detected as two sliders (or joystick axis) and as with this solution, the dead zone can be set individually for each axis, this would result in some kind of diamond dead zone in reality. Just what should do it when the joystick is more worn out in one axis than in the other.
Thank you!
(I already see myself sitting with an XBox Controller doing the live show )