Page 1 of 1

vusb joystick analog problem

Posted: Mon Mar 07, 2016 11:00 am
by Dion

i've build a working vusb with hid mouse example from vusb download package. Now i modified them a bit to become gamepad. After googling a bit and read a bit from some places, i got the buttons working, and later adc working. but there is a bit problem with the adc return value. it's a bit jumpy, not jumpy like go up and down, but jumpy like not smooth transition. so every little potentiometer change it doesn't showed up in properties, until some turn it changed but it jumped a bit far. later i tried to exclude the adc process, and using normal incremental local variable as report value. It turned out it has same jumpy symptom. now i am confused. where is the problem actually?

this is my main.c code :
this is my usbconfig.h code:
my hardware is same like with-series-diode picture on vusb download package,except the xtal is 12mhz.

any help appreciated. Thanks in advance.

Re: vusb joystick analog problem

Posted: Tue Mar 08, 2016 3:11 am
by ulao
The problem should be due to timing or math. You didn't post the a2dRead function, or I failed to find it. If you see a pattern like this


instead of a circle, the pots x,y may be sharing ground or like. When one pot reaches full right it may be pulling the other back.

Re: vusb joystick analog problem

Posted: Tue Mar 08, 2016 6:28 am
by Dion
i don't use the adc function yet. just simulate the return value with dummy incremental variable. you can see i commented them in main.c

update: i managed to get another usb example mjoyv1.1 working, and modify one of analog input with incremental variable (the dial). strangely, the symptom is same. i can't understand, why it can't move smoothly?

Re: vusb joystick analog problem

Posted: Tue Oct 25, 2016 1:14 am
by BrainSlugs83
Could it be a problem with the host PC?

I was testing a joystick I'd built on a friend's laptop recently, and the Joystick control panel was very ... jumpy(?) -- it would occasionally lock up and stop getting updates on some button presses or the Joystick axis... -- Sometimes the crosshairs would disappear from the Joystick axis too, and certain buttons just would just kind of crap out, or get stuck... it was the weirdest thing ever....

I didn't actually try to play games on that computer, but I think it may have been that he was using Windows 7 -- and the joystick control panel just wasn't very responsive on his PC?

I didn't have any of those troubles on my home PC, and in playing MAME, etc. on my Raspberry PI it all seemed to work really well with no issues.