Adjust L2/R2 button thresholds
This commit is contained in:
parent
a7503d79a9
commit
86a64648c5
|
@ -100,13 +100,13 @@ void GameController::Axis(int id, Input::Axis axis, int value) {
|
||||||
|
|
||||||
state.axes[axis_id] = value;
|
state.axes[axis_id] = value;
|
||||||
|
|
||||||
|
// Derive digital buttons from the analog trigger
|
||||||
// Scaled value is 0 .. 255
|
// Scaled value is 0 .. 255
|
||||||
// Rest point for L2/R2 is usually ~127 but may drift
|
// Rest point for L2/R2 is ideally 0 but may drift
|
||||||
// It may also differ across controllers
|
// Use some hysteresis to avoid glitches
|
||||||
// Use some hysteresis to avoid glitches. 0->255 will also work just slightly later
|
|
||||||
|
|
||||||
const int ON_THRESHOLD = 150;
|
const int ON_THRESHOLD = 31; // 255 / 8
|
||||||
const int OFF_THRESHOLD = 135;
|
const int OFF_THRESHOLD = 16; // 255 / 16 + 1
|
||||||
|
|
||||||
if (axis == Input::Axis::TriggerLeft) {
|
if (axis == Input::Axis::TriggerLeft) {
|
||||||
LOG_TRACE(Input, "TriggerLeft {}", value);
|
LOG_TRACE(Input, "TriggerLeft {}", value);
|
||||||
|
|
Loading…
Reference in New Issue