From de0d70d808a192b691e355b6067e9a94ac8356e2 Mon Sep 17 00:00:00 2001 From: icex2 Date: Thu, 31 Dec 2020 16:03:57 +0100 Subject: [PATCH] vigem-iidxio: Improve responsiveness on fast direction change TT --- src/main/vigem-iidxio/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/vigem-iidxio/main.c b/src/main/vigem-iidxio/main.c index 8ab527a..2247602 100644 --- a/src/main/vigem-iidxio/main.c +++ b/src/main/vigem-iidxio/main.c @@ -131,6 +131,14 @@ static int16_t _handle_turntable_as_button( printf("delta_button %d, ", delta); } + // TT direction changed suddendly -> fast scratchin' action like a real DJ + // Reset state to avoid lag with state having to decrease from high values + if (delta > 0 && delta >= config->tt.button.threshold && state < 0) { + state = 0; + } else if (delta < 0 && abs(delta) >= config->tt.button.threshold && state > 0) { + state = 0; + } + // Update state according to delta, debounce and max values if (delta > 0 && state < btn_max) { state += btn_inc;