vusb joystick analog problem

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Dion
Posts: 2
Joined: Mon Mar 07, 2016 10:43 am

vusb joystick analog problem

Postby Dion » Mon Mar 07, 2016 11:00 am

Hi,

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 : http://pastebin.com/tPEUm7G9
this is my usbconfig.h code: http://pastebin.com/aBDf0zZn
my hardware is same like with-series-diode picture on vusb download package,except the xtal is 12mhz.

any help appreciated. Thanks in advance.

ulao
Rank 4
Rank 4
Posts: 454
Joined: Mon Aug 25, 2008 8:45 pm

Re: vusb joystick analog problem

Postby ulao » Tue Mar 08, 2016 3:11 am

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.

Dion
Posts: 2
Joined: Mon Mar 07, 2016 10:43 am

Re: vusb joystick analog problem

Postby Dion » Tue Mar 08, 2016 6:28 am

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?

BrainSlugs83
Posts: 6
Joined: Sun Mar 20, 2016 4:30 am

Re: vusb joystick analog problem

Postby BrainSlugs83 » Tue Oct 25, 2016 1:14 am

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.


Return to “V-USB”

Who is online

Users browsing this forum: Baidu [Spider] and 6 guests