fixed MOUSEKEY_INERTIA on AVR (#19096)

Co-authored-by: Selene ToyKeeper <git@toykeeper.net>
This commit is contained in:
Selene ToyKeeper 2022-11-16 14:46:11 -07:00 committed by GitHub
parent 63377c8c57
commit 31fb55ae7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -129,7 +129,7 @@ static int8_t move_unit(uint8_t axis) {
// x**2 acceleration (quadratic, more precise for short movements) // x**2 acceleration (quadratic, more precise for short movements)
int16_t percent = (inertia << 8) / mk_time_to_max; int16_t percent = (inertia << 8) / mk_time_to_max;
percent = (percent * percent) >> 8; percent = ((int32_t)percent * percent) >> 8;
if (inertia < 0) percent = -percent; if (inertia < 0) percent = -percent;
// unit = sign(inertia) + (percent of max speed) // unit = sign(inertia) + (percent of max speed)