Joystick issue, help!
  • Hi

    I spent the weekend setting up my Pi with PiPlay and am REALLY impressed with how it all works so far :) I'm building a retro arcade machine "for my children" and am putting the Pi and parts into a control panel with joystick and buttons etc. These work through an encoder (Xin Mo compatible) and work fine using Mame on a PC once configured.

    The problem I'm having is that the joystick isn't working in either the menu or within games. The buttons are so I "think" I've set the config files up correctly. When tested using "jstest /dev/input/js0" then I can see the joystick is working ok and it gives the following results:

    Up, 4, 32767
    Down, 4, -32767
    Right, 5, -32767
    Left, 5, 32767

    I've edited the "controller.yaml" file under "/home/pi/pimame/pimame-menu/" to match my joystick controls as follows:

    JOYSTICK:
    HORIZONTAL_AXIS: 5
    VERTICAL_AXIS: 4
    LEFT: 32767
    RIGHT: -32676
    UP: 32676
    DOWN: -32676

    But it's still not working :(

    Any ideas as I've spent ages on this now but haven't made any progress???

    Thanks

    Richard
  • It should be like this, (pygame, the underlying software of piplay, works on a -1 -> +1 basis).
    JOYSTICK:
    HORIZONTAL_AXIS: 5
    VERTICAL_AXIS: 4

    DIRECTIONAL:
    LEFT: -1
    RIGHT: 1
    UP: -1
    DOWN: 1
  • Thanks for the speedy reply!

    I did try this previously (and just did again to double check!) but it's still not working :(

    Wouldn't pygame be looking for a 1/-1 and be getting returned the 32676/-32676 value hence it not working? Do you know if there is any way to map the joystick output to the correct values maybe?

    Thanks

    Richard
  • no, it's not that pygame is looking for -1/1, its that pygame normalizes joystick output to -1/1, no matter what jstest is outputting.

    try changing:
    OPTIONS:
    AXIS_DRIFT_TOLERANCE: .9

    to
    OPTIONS:
    AXIS_DRIFT_TOLERANCE: .1


    maybe your joystick just isn't getting all the way to 1 or -1, in which case adjusting the axis drift will make it more sensitive.

    also, make sure that you haven't altered any of the blank spaces in the file, yaml is very picky when it comes to spacing.
  • Boo! I just tried that change to the drift and it made no difference :( I'm sure the spacing is correct and even started with the original file again.

    Just to clarify, as I'm not sure if this makes a difference; the joystick isn't analogue but has 4 microswitches. In jstest it goes from 0 straight to 32676 or -32676.

    I'm stumped and gutted as I really wanted to have it ready for tomorrow when my 5 year old returns from holiday :(

    Anything else you can think of?

    P.S. Thanks again for trying to help btw!
  • what brand joystick is it?
  • also, why don't you go ahead and send me a copy of your controller.yaml file? Holgate.mark1@gmail.com
  • It was this I bought which worked fine on a PC Linux Mame setup a couple of weeks ago. http://www.arcadeworlduk.com/products/1-Player-Arcade-Joystick-Buttons-And-Arcade-Controller-Wiring-Kit-No9.html

    The Joystick shows as a Xin-Mo in jstest
  • Thanks, I just tried your suggestion but still no joy :(

    All still ok in jstest though... in fact, maybe the output of that may help diagnose the issue...

    "
    Driver version is 2.1.0.
    Joystick (Xin-Mo Xin-Mo Controller) has 6 axes (X, Y, Z, Rz, Hat0X, Hat0Y)
    and 13 buttons (BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR, ?).
    Testing...
    Axes: 0:-32767 1:-32767 2:-32767 3:-32767 4:0 5:0 ...
    "

    And when I move the joystick then Axes 4 and 5 move from 0 to 32767 (or -32767) as expected.
  • Hi Richard,

    I have had a similar problem. Different joystick, but similar symptoms. Here you have the thread for you to take a look:

    http://piplay.org/forum/discussion/1823/solvedusb-joystick-not-working-on-pimame-but-working-on-advmame-emulator-mayflash-joystick#Item_4

    Your joytick is reporting the movments on Hat0X and Hat0Y, and for whatever reason this is not working in Piplay UI, Mame4All, but working properly on AdvMame.

    I was able to change my joystick from Hat mode to Analog mode reporting the movments on 0 & 1 axis. This solved the issue.

    Again, this is not going to provide you a solution but will give you some hints to investigate further.

    Good luck!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!