From d4c527197edbf6c83b4eb2a2ca6ea3fec2fdb631 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 16 Nov 2022 14:46:11 -0700 Subject: [PATCH] fixed MOUSEKEY_INERTIA on AVR (#19096) Co-authored-by: Selene ToyKeeper --- quantum/mousekey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/mousekey.c b/quantum/mousekey.c index b91db80de6ba..703fb39fa6ef 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -129,7 +129,7 @@ static int8_t move_unit(uint8_t axis) { // x**2 acceleration (quadratic, more precise for short movements) int16_t percent = (inertia << 8) / mk_time_to_max; - percent = (percent * percent) >> 8; + percent = ((int32_t)percent * percent) >> 8; if (inertia < 0) percent = -percent; // unit = sign(inertia) + (percent of max speed)