Page 1 of 2

[Solved] Very glitchy controls.

Posted: Tue Oct 03, 2017 6:57 am
by DeRock89
Hey,

I just finished my first build. The controls aren't working exactly right. I am using Leoranrdo microcontroller and a simple button PCB. It is wired exactly like SOTAs build. I used sotas guide for programming the leornaedo.

When a button is pushed one time, it's like the button was pushed really quickly twice. When scrolling through things, it skips every other thing as if it was pushed twice. when I select an emulator, it goes straight into a game and skips the list of roms most times. It's difficult to shut down because it skips the shutdown options And goes straight to restarting emulation station.

Also with the start and select buttons, I have to jam my nails way deep into the shell to push the those buttons in as far as I can to make them work. The button PCB is tight against the frame and screwed in well.

Also, my analog right/left is inverted with N64 games. Do I need to swap the wires for them, change the micro controller sketch, or the Retropie settings to fix that?

Re: Very glitchy controls.

Posted: Wed Oct 04, 2017 2:20 pm
by YaYa
Any pictures of the thing ?

Re: Very glitchy controls.

Posted: Thu Oct 05, 2017 5:31 am
by DeRock89
YaYa wrote:
Wed Oct 04, 2017 2:20 pm
Any pictures of the thing ?
Here ya go

Image


Image


Image

Re: Very glitchy controls.

Posted: Thu Oct 05, 2017 8:07 am
by Kenshin16
When you downloaded the sketch to the pro micro did you put it as the spark fun or the Leonardo for the device? I figured out that board has to be put as the Leonardo for mine to work. Mine works great with 2 joysticks and 14 buttons. No problem. Although I used the common button pcb from kitsch-bent

Re: Very glitchy controls.

Posted: Thu Oct 05, 2017 8:34 am
by Fixmylife
Im actually having this same issue .. i think it started after i put the two analog sticks i tryed using different wire and still the same issue .. while in games the buttons work great .. while im in emulation station looking through the menu they are crazy and skip or double click

Re: Very glitchy controls.

Posted: Thu Oct 05, 2017 10:58 pm
by Helder
It's the code in the sketch, try changing the debounce values to something higher.

Re: Very glitchy controls.

Posted: Sun Oct 08, 2017 12:09 am
by Fixmylife
Where can we find the debounce values in the sketch

Re: Very glitchy controls.

Posted: Sun Oct 08, 2017 9:17 am
by Helder
Honestly looking at the sketch I can't find it easily or it doesn't stand out. Maybe someone with more Arduino coding experience will chime in and help.

Re: Very glitchy controls.

Posted: Mon Oct 09, 2017 5:21 am
by salami738
Hi, i don't saw any debouncing options in the Gamecontroller.ino (downloaded on 2017-10-09 13:00).
I wonder that no one else has the problem, although button bouncing is a common problem.

Long story short: If you press a button, it is no clean rising(0 to 5V) or falling signal (5V to 0), rather the state changes rapidly.
This has to be corrected by hardware or by software. Software is the easier way in this case.
You have to catch the first signal, then ignore all signals for a short amount of time (debounce values).

You need to patch the sources yourself.
Example: https://www.arduino.cc/en/Tutorial/Debounce

Re: Very glitchy controls.

Posted: Mon Oct 09, 2017 11:56 am
by salami738
Hi,

please add the following line to your code, right after
"
// Send everything to USB
Joystick.setState(&joySt);
"
but before the closing brace.

line:
delay(50);

This will add a delay of 50ms between two keypresses. Please test this, i have no arduino micro to test at the moment.
You can also try out different values between 10 and 100.