Skip to content

Commit

Permalink
Adjust L2/R2 button thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
j committed Aug 23, 2024
1 parent a7503d7 commit 86a6464
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/input/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ void GameController::Axis(int id, Input::Axis axis, int value) {

state.axes[axis_id] = value;

// Derive digital buttons from the analog trigger
// Scaled value is 0 .. 255
// Rest point for L2/R2 is usually ~127 but may drift
// It may also differ across controllers
// Use some hysteresis to avoid glitches. 0->255 will also work just slightly later
// Rest point for L2/R2 is ideally 0 but may drift
// Use some hysteresis to avoid glitches

const int ON_THRESHOLD = 150;
const int OFF_THRESHOLD = 135;
const int ON_THRESHOLD = 31; // 255 / 8
const int OFF_THRESHOLD = 16; // 255 / 16 + 1

if (axis == Input::Axis::TriggerLeft) {
LOG_TRACE(Input, "TriggerLeft {}", value);
Expand Down

0 comments on commit 86a6464

Please sign in to comment.