ttwrplus: Slow down encoder input

Two ticks are needed to emit one KNOB_LEFT or KNOB_RIGHT event, thus
slowing down the rotary encoder input and making it more comfortable.

TG-553
pull/193/head
Niccolò Izzo 2023-09-10 20:05:52 +02:00 zatwierdzone przez Silvano Seva
rodzic fe027c440c
commit 7619b9473b
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -85,9 +85,9 @@ keyboard_t kbd_getKeys()
int8_t delta = new_pos - old_pos;
// Normal case: handle up/down by looking at the pulse difference
if(delta > 0)
if(delta > 0 && new_pos % 2 == 0)
keys |= KNOB_LEFT;
else if (delta < 0)
else if (delta < 0 && new_pos % 2 != 0)
keys |= KNOB_RIGHT;
// Corner case 1: rollover from negative (old) to positive (new) value.