From ae967130704c85c3027677fbcfb86c34c999c026 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 30 Aug 2024 22:30:49 -0700 Subject: [PATCH] joystick: perform deadzone first old-commit-hash: fc425042ab7d13939bf7aa053ddb7477d7ab8bd5 --- tools/joystick/joystickd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/joystick/joystickd.py b/tools/joystick/joystickd.py index 231e964781..17f220001a 100755 --- a/tools/joystick/joystickd.py +++ b/tools/joystick/joystickd.py @@ -69,8 +69,8 @@ class Joystick: self.min_axis_value[event[0]] = min(event[1], self.min_axis_value[event[0]]) norm = -interp(event[1], [self.min_axis_value[event[0]], self.max_axis_value[event[0]]], [-1., 1.]) - norm = JS_EXPO * norm ** 3 + (1 - JS_EXPO) * norm - self.axes_values[event[0]] = norm if abs(norm) > 0.02 else 0. # center can be noisy, deadzone of 2% + norm = norm if abs(norm) > 0.02 else 0. # center can be noisy, deadzone of 2% + self.axes_values[event[0]] = JS_EXPO * norm ** 3 + (1 - JS_EXPO) * norm # less action near center for fine control else: return False return True