From 7619b9473b4ecf96dcfdd6fe5dc44a683687b273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Izzo?= Date: Sun, 10 Sep 2023 20:05:52 +0200 Subject: [PATCH] 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 --- platform/drivers/keyboard/keyboard_ttwrplus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/drivers/keyboard/keyboard_ttwrplus.c b/platform/drivers/keyboard/keyboard_ttwrplus.c index 7636380e..462d1329 100644 --- a/platform/drivers/keyboard/keyboard_ttwrplus.c +++ b/platform/drivers/keyboard/keyboard_ttwrplus.c @@ -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.