[PATCH 2/2] Input: adafruit-seesaw: fix "flat" value to avoid drifting
From: michael . opdenacker
Date: Wed Jul 16 2025 - 14:25:27 EST
From: Michael Opdenacker <michael.opdenacker@xxxxxxxxxxxxxx>
Tests on 9 Adafruit Mini I2C Gamepad devices have shown that
the center X and Y values (when the joystick is left at its center position)
deviate from 511, which is the center of the [0, 1023] value range:
Device Center X Vs. Expected (511) Center Y Vs. Expected (511)
1 519 8 493 -18
2 524 13 518 7 Not very stable data!
3 508 -3 531 20
4 531 20 508 -3
5 505 -6 521 10
6 519 8 477 -34 Big outlier, ignored!
7 519 8 524 13
8 524 13 510 -1
9 517 6 511 0
This change causes any X and Y value that is withing a [-20, +20]
interval around 511, to be reported as centered. This avoids
unwanted drifting (towards left, right, top or bottom)
and makes playing with this device easier.
Signed-off-by: Michael Opdenacker <michael.opdenacker@xxxxxxxxxxxxxx>
---
drivers/input/joystick/adafruit-seesaw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/joystick/adafruit-seesaw.c b/drivers/input/joystick/adafruit-seesaw.c
index 2b18451a0953..03eb181d5aef 100644
--- a/drivers/input/joystick/adafruit-seesaw.c
+++ b/drivers/input/joystick/adafruit-seesaw.c
@@ -50,7 +50,7 @@
#define SEESAW_JOYSTICK_MAX_AXIS 1023
#define SEESAW_JOYSTICK_FUZZ 2
-#define SEESAW_JOYSTICK_FLAT 4
+#define SEESAW_JOYSTICK_FLAT 20
#define SEESAW_GAMEPAD_POLL_INTERVAL_MS 16
#define SEESAW_GAMEPAD_POLL_MIN 8