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

Use proper calibration multipliers and not magic multipliers #7

Open
tomayac opened this issue Sep 21, 2022 · 0 comments
Open

Use proper calibration multipliers and not magic multipliers #7

tomayac opened this issue Sep 21, 2022 · 0 comments

Comments

@tomayac
Copy link
Owner

tomayac commented Sep 21, 2022

joy-con-webhid/src/parse.js

Lines 309 to 315 in 29435e0

// ToDo: This should use proper calibration data and not a magic number
// (1995).
horizontal = ((horizontal / 1995 - 1) * 2).toFixed(1);
let vertical = ((rawData[7] >> 4) | (rawData[8] << 4)) * -1;
// ToDo: This should use proper calibration data and not a magic number
// (2220).
vertical = ((vertical / 2220 + 1) * 2).toFixed(1);

joy-con-webhid/src/parse.js

Lines 328 to 334 in 29435e0

// ToDo: This should use proper calibration data and not a magic number
// (1995).
horizontal = ((horizontal / 1995 - 1) * 2).toFixed(1);
let vertical = ((rawData[10] >> 4) | (rawData[11] << 4)) * -1;
// ToDo: This should use proper calibration data and not a magic number
// (2220).
vertical = ((vertical / 2220 + 1) * 2).toFixed(1);

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

1 participant