From: michael.opdenacker@rootcommit.com
To: anshulusr@gmail.com, dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Opdenacker <michael.opdenacker@rootcommit.com>
Subject: [PATCH 2/2] Input: adafruit-seesaw: fix "flat" value to avoid drifting
Date: Wed, 16 Jul 2025 17:44:43 +0000 (UTC) [thread overview]
Message-ID: <20250716174422.860500-2-michael.opdenacker@rootcommit.com> (raw)
In-Reply-To: <20250716174422.860500-1-michael.opdenacker@rootcommit.com>
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
parent reply other threads:[~2025-07-16 18:24 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20250716174422.860500-1-michael.opdenacker@rootcommit.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250716174422.860500-2-michael.opdenacker@rootcommit.com \
--to=michael.opdenacker@rootcommit.com \
--cc=anshulusr@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).