Skip to content

Derive digital L/R status from analog trigger status#1341

Open
LandonTheCoder wants to merge 1 commit into
FIX94:masterfrom
LandonTheCoder:analog-lr-fix
Open

Derive digital L/R status from analog trigger status#1341
LandonTheCoder wants to merge 1 commit into
FIX94:masterfrom
LandonTheCoder:analog-lr-fix

Conversation

@LandonTheCoder

Copy link
Copy Markdown

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.

…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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Successfully merging this pull request may close these issues.

2 participants