linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] Input: adafruit-seesaw: fix "flat" value to avoid drifting
       [not found] <20250716174422.860500-1-michael.opdenacker@rootcommit.com>
@ 2025-07-16 17:44 ` michael.opdenacker
  0 siblings, 0 replies; only message in thread
From: michael.opdenacker @ 2025-07-16 17:44 UTC (permalink / raw)
  To: anshulusr, dmitry.torokhov; +Cc: linux-input, linux-kernel, Michael Opdenacker

From: Michael Opdenacker <michael.opdenacker@rootcommit.com>

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@rootcommit.com>
---
 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-16 18:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250716174422.860500-1-michael.opdenacker@rootcommit.com>
2025-07-16 17:44 ` [PATCH 2/2] Input: adafruit-seesaw: fix "flat" value to avoid drifting michael.opdenacker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).