From fa24602e74433b7452012a3bb6ac8b0b641e9473 Mon Sep 17 00:00:00 2001 From: ploopyco Date: Tue, 20 May 2025 14:03:25 -0400 Subject: [PATCH] working --- keyboards/ploopyco/dial/config.h | 2 ++ keyboards/ploopyco/ploopyco.c | 32 +++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/keyboards/ploopyco/dial/config.h b/keyboards/ploopyco/dial/config.h index 83905682f8d..880a985032c 100644 --- a/keyboards/ploopyco/dial/config.h +++ b/keyboards/ploopyco/dial/config.h @@ -18,6 +18,8 @@ #pragma once +#define POINTING_DEVICE_HIRES_SCROLL_ENABLE 0 + #define I2C_DRIVER I2CD1 #define I2C1_SDA_PIN GP22 #define I2C1_SCL_PIN GP23 diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c index 2b6014ee2b9..00d683c3e5c 100644 --- a/keyboards/ploopyco/ploopyco.c +++ b/keyboards/ploopyco/ploopyco.c @@ -21,7 +21,6 @@ #include "opt_encoder.h" #include "as5600.h" #include "print.h" -#include "wait.h" // for legacy support #if defined(OPT_DEBOUNCE) && !defined(PLOOPY_SCROLL_DEBOUNCE) @@ -185,13 +184,32 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { delta += 4096; } - if (delta >= SCROLL_DISTANCE) { - current_position = ra; - mouse_report.v = 1; - } else if (delta <= -SCROLL_DISTANCE) { - current_position = ra; - mouse_report.v = -1; + if (is_hires_scroll_on()) { + // Establish a deadzone to prevent spurious inputs + // 4 was found to be a good number experimentally + if (delta > 4 || delta < -4) { + current_position = ra; + mouse_report.v = delta; + } + } else { + // Certain operating systems, like MacOS, don't play well with the + // high-res scrolling implementation. For more details, see: + // https://github.com/qmk/qmk_firmware/issues/17585#issuecomment-2325248167 + // 128 gives the scroll wheels "ticks". + if (delta > 128) { + current_position = ra; + mouse_report.v = 1; + } else if (delta < 128) { + current_position = ra; + mouse_report.v = -1; + } } + + + + /* + + */ #endif return pointing_device_task_user(mouse_report);