diff options
author | alaviss <leorize+oss@disroot.org> | 2022-12-30 07:45:10 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-30 11:45:10 +1100 |
commit | 444760efcba3fa8391a65ed65c8a53233c0a019c (patch) | |
tree | b04fdcd7bc57ec2b8dd807e410ad59252b8ef45f /keyboards | |
parent | ab667a8b64b960937dbd0f343808cb0d92a92544 (diff) |
ploopyco/trackball_mini: always update encoder (#18561)
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/ploopyco/trackball_mini/trackball_mini.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/keyboards/ploopyco/trackball_mini/trackball_mini.c b/keyboards/ploopyco/trackball_mini/trackball_mini.c index a3d8cf99ab..8bc0ab99c2 100644 --- a/keyboards/ploopyco/trackball_mini/trackball_mini.c +++ b/keyboards/ploopyco/trackball_mini/trackball_mini.c @@ -92,6 +92,13 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { } void process_wheel(void) { + uint16_t p1 = adc_read(OPT_ENC1_MUX); + uint16_t p2 = adc_read(OPT_ENC2_MUX); + + if (debug_encoder) dprintf("OPT1: %d, OPT2: %d\n", p1, p2); + + int8_t dir = opt_encoder_handler(p1, p2); + // If the mouse wheel was just released, do not scroll. if (timer_elapsed(lastMidClick) < SCROLL_BUTT_DEBOUNCE) return; @@ -105,16 +112,10 @@ void process_wheel(void) { #endif } - lastScroll = timer_read(); - uint16_t p1 = adc_read(OPT_ENC1_MUX); - uint16_t p2 = adc_read(OPT_ENC2_MUX); - - if (debug_encoder) dprintf("OPT1: %d, OPT2: %d\n", p1, p2); - - int8_t dir = opt_encoder_handler(p1, p2); - if (dir == 0) return; encoder_update_kb(0, dir > 0); + + lastScroll = timer_read(); } void pointing_device_init_kb(void) { |