Denying repetitive encoder turn

Hi, I need to set some encoders act once instead of repetitive during a fraction of a second. This is because I want DAW shortcuts to be activated, but just once.
The logic I use is to set a global variable to 1 whenever my encoder moves, and activate a timer once. Inside the timer I perform the keystroke I want and at the same time set my global variable back to 0, so further inputs will be evaluated. At the same time, if encoder still moves, it can’t pass through a rule in my first preset, because I check if my global variable is still 1. This way I think that in the mean time (300ms) encoder will not pass my first condition and everything will be ok.
So I came up with the test project which I attach (no matter if I set a keystroke as IN, it’s just for demo puproses).
I wonder if this is the way to go, or there is another more efficient one.
Thank you.test_timer.bmtp (618 Bytes)

Yes, the timer method is called a “watchdog” timer. A Watchdog timer does something if a follow-up event doesn’t occur within the specified time.

This should work with an encoder, however in your example since for keystrokes, incoming keystrokes are never suppressed, you always see the “a” as well as the “b”. Good job!

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Thank you very much for the quick reply and explanation!