Add rescaled deadzones in the SPI bin file for the full 12 bit range#376
Add rescaled deadzones in the SPI bin file for the full 12 bit range#376ndeadly merged 1 commit intondeadly:developfrom
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.
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.
| 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.
Add a space between after the // in comments
| 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.
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
| }; | ||
|
|
||
| struct SwitchAnalogStickParameters { | ||
| uint8_t stickvalues[0x12]; |
There was a problem hiding this comment.
Hmm, maybe we should settle on whether to use hex or decimal numbers for array sizes...
There was a problem hiding this comment.
Maybe use defines so the offsets become symbolic, like #define AXIS(a) (0x12+a)
There was a problem hiding this comment.
Or use a struct instead (possibly union structs if the same buffer can have different meanings)
There was a problem hiding this comment.
@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