tablet: fix the pressure offset range being off by one

Kernel ranges are inclusiv min/max, so let's make sure we calculate that
correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2023-08-28 09:05:38 +10:00 committed by José Expósito
parent d75a0fa42d
commit a5b6f4009b

View file

@ -365,7 +365,7 @@ normalize_pressure(const struct input_absinfo *absinfo,
* threshold is 0 pressure.
*/
int base = tool->pressure.threshold.lower;
double range = absinfo->maximum - base;
double range = absinfo->maximum - base + 1;
double value = (absinfo->value - base) / range;
return max(0.0, value);