commit e272f0c18e2e17568174dcea4f64bebad0e66b2f
parent cf182cbadcd939354ad38e5b61f3fdb32b56a5d9
Author: Valtteri Koskivuori <vkoskiv@gmail.com>
Date: Tue, 17 Oct 2023 00:45:08 +0300
trackpad-fw: Greatly improve cursor & scroll responsiveness
Removing the averaging makes the cursor and scrolling motion feel much
more precise and responsive. There is no longer a 'latency' to it.
Diffstat:
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/reform2-trackpad-fw/Mouse.c b/reform2-trackpad-fw/Mouse.c
@@ -130,10 +130,6 @@ void EVENT_USB_Device_StartOfFrame(void)
HID_Device_MillisecondElapsed(&Mouse_HID_Interface);
}
-float dx2 = 0, dy2 = 0;
-float dx3 = 0, dy3 = 0;
-float dx4 = 0, dy4 = 0;
-float dxx = 0, dyy = 0;
float dx = 0, dy = 0;
int16_t lastx = 0, lasty = 0;
int16_t lastx2 = 0, lasty2 = 0;
@@ -247,17 +243,14 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
dy = (float)sensor.relative_y;
}
- dxx = (dx+dx2+dx3+dx4)/4.0;
- dyy = (dy+dy2+dy3+dy4)/4.0;
-
if (wheeling) {
// horizontal and vertical scrolling
- MouseReport->Pan = dxx;
- MouseReport->Wheel = -dyy;
+ MouseReport->Pan = dx;
+ MouseReport->Wheel = -dy;
} else {
// normal movement
- MouseReport->X = dxx;
- MouseReport->Y = dyy;
+ MouseReport->X = dx;
+ MouseReport->Y = dy;
}
}
@@ -283,10 +276,6 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
dy = 0;
}
- dx4 = dx3; dy4 = dy3;
- dx3 = dx2; dy3 = dy2;
- dx2 = dx; dy2 = dy;
-
last_num_fingers = sensor.num_fingers;
*ReportSize = sizeof(USB_WheelMouseReport_Data_t);