Skip to content
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

Axes don't update when gamepad reports all axes values near zero #9

Closed
chlorate opened this issue Jan 20, 2019 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@chlorate
Copy link
Owner

Axis values are only updated if the gamepad reports at least one axis with a non-zero value.

The code in question:

// Ignore if all axes read zero which means the gamepad hasn't been
// fully activated yet.
const active = gamepad.axes.some((value) => value !== 0);

I assumed all zero axes meant the gamepad was not fully connected and would never be a normal operating state. This is the case with the Wii Classic Controller Pro where it will send all zeros while it's connecting. The purpose of ignoring this state was to avoid setting axis neutral values to zero when initializing for the first time. (The neutral values are normally slightly off from zero.)

It turns out the CCP actually sends several different values outside its normal range while it's connecting. So this doesn't avoid the issue with initializing neutral values after all.

For other controllers, all zeros can be a valid neutral state and this can cause the display to not update to show analog sticks as neutral.

The code should be changed to update axes in all cases.

https://twitter.com/AceOfArrows/status/1086626032956903424

(What's puzzling about this is the check is value !== 0 and this controller isn't updating despite reporting a non-exactly-zero value.)

@chlorate chlorate added the bug label Jan 20, 2019
@chlorate chlorate added this to the v1.0.1 milestone Jan 20, 2019
@chlorate chlorate self-assigned this Jan 20, 2019
chlorate added a commit that referenced this issue Jan 20, 2019
@chlorate
Copy link
Owner Author

Confirmed working. Gamepad tester site must have a rounding error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant