I had the same issue when trying to use the trim wheel in other sims. Really wish they didn't select an encoder that has 4 pulses per scroll detent as its still hard to filter out with software. I used autohotkey v2 to debounce the wheel and remap it to a normal mouse scroll that you can bind instead of the trim wheel on the controller. I also found that you could move the trim wheel slightly without hitting a detent and get it to output 2 times, this makes it kind of hard to filter in a responsive way. I'm sure a better person could figure it out but I just added a lock out time that prevents you from accidentally scrolling the opposite direction after scrolling for a split second.
Its not perfect and you might have to play with the configuration a bit for your use case but here's the script if anyone is interested.
#Requires AutoHotkey v2.0
Persistent
; =========================
; CONFIGURATION SECTION
; =========================
ControllerNumber := 1 ; which controller to use
ButtonDown := 24 ; button for scroll down
ButtonUp := 23 ; button for scroll up
ScrollLockTime := 200 ; ms between opposite directions
DebounceTime := 90 ; ms between same-button triggers
ScrollAmount := 3 ; scroll steps per press
PollRate := 15 ; timer speed (lower = faster)
; =========================
; SCRIPT START
; =========================
SetTimer(CheckButtons, PollRate)
lastStateDown := false
lastStateUp := false
lastTriggerDown := 0
lastTriggerUp := 0
lastScrollTime := 0
lastScrollDirection := "" ; "up" or "down"
CheckButtons() {
global ControllerNumber, ButtonDown, ButtonUp
global lastStateDown, lastStateUp
global lastTriggerDown, lastTriggerUp
global lastScrollTime, lastScrollDirection
global ScrollLockTime, DebounceTime, ScrollAmount
now := A_TickCount
; Build key names dynamically
keyDown := ControllerNumber "Joy" ButtonDown
keyUp := ControllerNumber "Joy" ButtonUp
; Scroll Down
currentDown := GetKeyState(keyDown)
if (currentDown && !lastStateDown) {
canScroll := (now - lastTriggerDown > DebounceTime)
if (lastScrollDirection = "up")
canScroll := canScroll && (now - lastScrollTime > ScrollLockTime)
if (canScroll) {
lastTriggerDown := now
lastScrollTime := now
lastScrollDirection := "down"
Loop ScrollAmount
Click("WheelDown")
}
}
lastStateDown := currentDown
; Scroll Up
currentUp := GetKeyState(keyUp)
if (currentUp && !lastStateUp) {
canScroll := (now - lastTriggerUp > DebounceTime)
if (lastScrollDirection = "down")
canScroll := canScroll && (now - lastScrollTime > ScrollLockTime)
if (canScroll) {
lastTriggerUp := now
lastScrollTime := now
lastScrollDirection := "up"
Loop ScrollAmount
Click("WheelUp")
}
}
lastStateUp := currentUp
}
By
spooklorky ·