Skip to content

Joystick center position variance #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
keebie81 opened this issue Jul 3, 2019 · 4 comments
Closed

Joystick center position variance #4

keebie81 opened this issue Jul 3, 2019 · 4 comments

Comments

@keebie81
Copy link

keebie81 commented Jul 3, 2019

I have two pygamers. Each one has different values given for X and Y on joystick when centered. The code here is assuming that the value is 32767.5 for both X and Y. When the value changes by +-700 then the cursor moves in that direction.

On one of my pygamer devices the X value is ~33344 and Y is ~33632. That puts it out of +-700 range for Y axis and the cursor then moves with no input.

The other pygamer device X value is ~32576 and Y is ~32384. These are within +-700 of the range and works well.

It would be nice if the library checked X and Y center values of device or had a way to put in a line to over-ride default values. I also tested the out of range device with a makecode game and the X and Y axis worked fine and had no drift.

@siddacious
Copy link

Thanks for the feedback! @brentru you should be able to read the joystick X and Y on init, and assume that those values are the center. If the user turns on their PyGamer with the joystick held out of center, that will of course muck with the real center but this is a common enough approach that it shouldn't be an issue.

@ladyada
Copy link
Member

ladyada commented Jul 22, 2019

@keebie81 please try the PR that was just created

@keebie81
Copy link
Author

This resolved my issue. I just tried it and the cursor works well now and is not auto-drifting.

@brentru
Copy link
Member

brentru commented Jul 22, 2019

@keebie81 Thanks for your feedback! Merged into master and released.

@brentru brentru closed this as completed Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants