-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add rescaled deadzones in the SPI bin file for the full 12 bit range #376
Conversation
uint8_t sixaxis_horizontal_offsets [6]; //These are here temporarely just to allow the correct read of the deadzones | ||
SwitchAnalogStickParameters lstick_deadzones; | ||
SwitchAnalogStickParameters rstick_deadzones; | ||
} data3 = { { 0x5e, 0x01, 0x00, 0x00, 0xf1, 0x0f } /*dumped from a Switch Pro Controller*/, stick_default_12bitdeadzone, stick_default_12bitdeadzone }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define a type for the sixaxis offsets too and put this in the anonymous namespace above with the rest for now.
Also, don't do inline comments like that. Not only are they unaesthetic, they break the ability to block-comment sections of code.
@@ -28,26 +28,29 @@ namespace ams::controller { | |||
SwitchAnalogStickFactoryCalibration lstick_factory_calib = {0xff, 0xf7, 0x7f, 0x00, 0x08, 0x80, 0x00, 0x08, 0x80}; | |||
SwitchAnalogStickFactoryCalibration rstick_factory_calib = {0x00, 0x08, 0x80, 0x00, 0x08, 0x80, 0xff, 0xf7, 0x7f}; | |||
|
|||
//Stick deadzone data that produce a 12.5% inner deadzone and a 5% outer deadzone (in relation to the above full 12 bit range) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space between after the //
in comments
@@ -28,26 +28,29 @@ namespace ams::controller { | |||
SwitchAnalogStickFactoryCalibration lstick_factory_calib = {0xff, 0xf7, 0x7f, 0x00, 0x08, 0x80, 0x00, 0x08, 0x80}; | |||
SwitchAnalogStickFactoryCalibration rstick_factory_calib = {0x00, 0x08, 0x80, 0x00, 0x08, 0x80, 0xff, 0xf7, 0x7f}; | |||
|
|||
//Stick deadzone data that produce a 12.5% inner deadzone and a 5% outer deadzone (in relation to the above full 12 bit range) | |||
SwitchAnalogStickParameters stick_default_12bitdeadzone = {0x0f, 0x30, 0x61, 0x00, 0x31, 0xf3, 0xd4, 0x14, 0x54, 0x41, 0x15, 0x54, 0xc7, 0x79, 0x9c, 0x33, 0x36, 0x63}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to be so verbose on the naming here. Just call it default_stick_params
or something. The comment describes what it actually represents
uint8_t m_xy[3]; | ||
}; | ||
|
||
struct SwitchAnalogStickFactoryCalibration { | ||
uint8_t calib[9]; | ||
}; | ||
|
||
struct SwitchAnalogStickParameters { | ||
uint8_t stickvalues[0x12]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe we should settle on whether to use hex or decimal numbers for array sizes...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use defines so the offsets become symbolic, like #define AXIS(a) (0x12+a)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or use a struct instead (possibly union structs if the same buffer can have different meanings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kakra these structs represent 16-bit data that has been packed into a 12-bit format such that 16-bit pairs 0x0AAA, 0x0BBB
become AA BA BB
. I think the array as-is is acceptable for this purpose for the time being. The comment was just regarding consistency between this struct and the ones above regarding hex vs decimal numbers used to specify the array size
e97b914
to
0c23062
Compare
This should alleviate some of the problems that appeared when introducing a full 12 bit range for the reported stick values. Here is a compiled version in case people need to test it.
stick_calibration_fixes_PR.zip