From 0b017a4cbcf7a355120c41741fa77b3c345ee30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20D=C3=A9tr=C3=A9?= <21152691+paranoidduck@users.noreply.github.com> Date: Sat, 10 Aug 2024 00:40:00 +0200 Subject: [PATCH] Fix stick calibration --- hid-nx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hid-nx.c b/hid-nx.c index 122e331..63e9c88 100644 --- a/hid-nx.c +++ b/hid-nx.c @@ -1029,6 +1029,12 @@ static int nx_con_read_stick_calibration(struct nx_con *con, y_max_above = hid_field_extract(con->hdev, (raw + 7), 4, 12); } + /* SPI min/max calibration is relative to center */ + cal_x->max = cal_x->center + x_max_above; + cal_x->min = cal_x->center - x_min_below; + cal_y->max = cal_y->center + y_max_above; + cal_y->min = cal_y->center - y_min_below; + /* check if calibration values are plausible */ if (cal_x->min >= cal_x->center || cal_x->center >= cal_x->max ||