summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorChristopher Hoage <iam@chrishoage.com>2022-11-09 09:48:46 -0800
committerGitHub <noreply@github.com>2022-11-09 09:48:46 -0800
commitaf52a9f8add3c1cef1b71c96fb3ee8f73485a26d (patch)
tree0cc5e720b6657a1a7cfdff8e97e258e3c9392167 /quantum
parentdc9162438d8b16c7534b82b6ead42d104f823ffb (diff)
Fix jump in report value when scale changes during cirque get report (#18992)
Fixes undefined
Diffstat (limited to 'quantum')
-rw-r--r--quantum/pointing_device/pointing_device_drivers.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/quantum/pointing_device/pointing_device_drivers.c b/quantum/pointing_device/pointing_device_drivers.c
index 172c9f36d7..d6f29c062e 100644
--- a/quantum/pointing_device/pointing_device_drivers.c
+++ b/quantum/pointing_device/pointing_device_drivers.c
@@ -123,9 +123,11 @@ bool auto_mouse_activation(report_mouse_t mouse_report) {
# endif
report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
+ uint16_t scale = cirque_pinnacle_get_scale();
pinnacle_data_t touchData = cirque_pinnacle_read_data();
mouse_xy_report_t report_x = 0, report_y = 0;
- static uint16_t x = 0, y = 0;
+ static uint16_t x = 0, y = 0, last_scale = 0;
+
# if defined(CIRQUE_PINNACLE_TAP_ENABLE)
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, false, POINTING_DEVICE_BUTTON1);
# endif
@@ -157,15 +159,16 @@ report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
# endif
// Scale coordinates to arbitrary X, Y resolution
- cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale());
+ cirque_pinnacle_scale_data(&touchData, scale, scale);
if (!cirque_pinnacle_gestures(&mouse_report, touchData)) {
- if (x && y && touchData.xValue && touchData.yValue) {
+ if (last_scale && scale == last_scale && x && y && touchData.xValue && touchData.yValue) {
report_x = CONSTRAIN_HID_XY((int16_t)(touchData.xValue - x));
report_y = CONSTRAIN_HID_XY((int16_t)(touchData.yValue - y));
}
- x = touchData.xValue;
- y = touchData.yValue;
+ x = touchData.xValue;
+ y = touchData.yValue;
+ last_scale = scale;
# ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
if (cursor_glide_enable) {