Skip to content

Commit

Permalink
ploopyco/trackball_mini: always update encoder (qmk#18561)
Browse files Browse the repository at this point in the history
  • Loading branch information
alaviss authored and jasonisgraham committed Jan 2, 2023
1 parent a3c75a4 commit a69f17b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions keyboards/ploopyco/trackball_mini/trackball_mini.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down

0 comments on commit a69f17b

Please sign in to comment.