From 86a64648c5e8e2d81c958be3695733cb88f8b399 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 23 Aug 2024 15:24:00 +1000 Subject: [PATCH] Adjust L2/R2 button thresholds --- src/input/controller.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/input/controller.cpp b/src/input/controller.cpp index afc92176..6104e4c5 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -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);