Derive digital L/R status from analog trigger status#1341
Derive digital L/R status from analog trigger status#1341LandonTheCoder wants to merge 1 commit into
Conversation
…tons when using DigitalLR=2 The DigitalLR=2 configuration option is meant to derive the status of the digital L/R buttons from the analog positions, but was instead checking the digital reported status with a >= comparison. This would cause it to be treated as fully pressed prematurely on some controllers. Set a default, hardcoded threshold (ANALOG_LR_FULL_PRESS) to test against, and set the digital button status by checking if the analog press exceeds that threshold.
|
|
||
| const s8 DEADZONE = 0x1A; | ||
| // This is the threshold for where an analog trigger is considered fully pressed. | ||
| const u8 ANALOG_LR_FULL_PRESS = 0xDF; |
There was a problem hiding this comment.
Would it make sense to load this value as a configuration setting at runtime, rather than setting it at compile time for all controllers regardless of their type?
There was a problem hiding this comment.
I think that it makes a reasonable amount of sense to have this be a configuration file option, but I didn't want to touch the configuration file to avoid breaking anything. Plus, there needs to be a default threshold value anyways, for when there isn't an explicitly configured value.
Also, this only applies to controllers which are of the DigitalLR=2 type (described as being for when there are no digital triggers, and digital trigger value should be calculated from analog trigger position). An example of such a controller is a PS4/PS5 controller. Controllers of other DigitalLR types will continue to function the same.
When using DigitalLR=2 in the configuration file, which is meant to use analog trigger status to derive digital status. it will currently test against the digital status of the trigger instead of the analog status to determine whether it is fully pressed. On some controllers, this can cause it to be treated as fully pressed prematurely.
This pull request changes that code to use a hardcoded threshold (
ANALOG_LR_FULL_PRESS) and will mark L/R as fully pressed if the Analog L/R exceeds that threshold.