xbmc / peripheral.joystick

Kodi joystick support (drivers and button maps)
GNU General Public License v2.0
24 stars 46 forks source link

fix axis when not aligned on 0 #274

Closed nadenislamarre closed 4 months ago

garbear commented 1 year ago

Thanks for the collection of PRs! I'll review as soon as time allows.

nadenislamarre commented 1 year ago

for information, patches are from here : https://github.com/batocera-linux/batocera.linux/tree/master/board/batocera/patches/kodi-peripheral-joystick i did them initially cause people having trouble on batocera

garbear commented 1 year ago

I see you also include https://github.com/xbmc/peripheral.joystick/pull/251. I'll make sure to get this reviewed too (sorry for the long delay!)

nadenislamarre commented 1 year ago

don't worry for the delay. i've the patches system on my side :-) i took a long time before doing the pr too. don't hesitate if you've questions

nadenislamarre commented 1 year ago

oh and i forgot the most important ! thanks a lot for peripheral.joystick. it is an important project for batocera.linux, because we deal with automatic joystick configuration and all go throw udev.

garbear commented 1 year ago

@nadenislamarre Can you rebase on the Omega branch after https://github.com/xbmc/peripheral.joystick/pull/280? I think it's time to get your udev patches in.

garbear commented 1 year ago

There seems to be a degenerate commit in your math.

You have:

SetAxisValue(axisIndex, event.value - middle, length);

and:

SetAxisValue(axisIndex, -(middle - event.value), length);

But you can transform the second to equal the first because event.value - middle == -(middle - event.value)

Or am I wrong?

Trihy commented 1 year ago

for information, patches are from here : https://github.com/batocera-linux/batocera.linux/tree/master/board/batocera/patches/kodi-peripheral-joystick i did them initially cause people having trouble on batocera

Hi. Sorry to bother here, but saw you are pretty active on wiimote dev, at least on linux, but this one is for Windows 🗡️ We are scratching our heads here to add calibration support to wiimote through touchmote. Also we have some problems with screen top and below reach. https://github.com/simphax/Touchmote/issues/65

If you could bring us any ideas, it will be welcome. Trying to achieve some wiimote lightgun improvements on windows. Thanks.

nadenislamarre commented 1 year ago

@Trihy don't hesitate to join the batocera discord to discuss with me or the man who did the windows lightgun support for the wiimote on this projet : https://github.com/fabricecaruso/WiimoteGun

garbear commented 4 months ago

Merged with a fix for the degenerative math in 6a8810705043b4656aaa03d32a8bc574e1d3049b.

Simplified Patch

The transformation mentioned in the PR conversation shows that event.value - middle and -(middle - event.value) are equivalent. Thus, we can simplify the code by using absolute values.

Explanation of the resulting patch

Let me know if that looks correct!