MitkoDyakov / Roendi

This is the repo containing the demo code for the rotary encoder with display. Enjoy.
MIT License
68 stars 10 forks source link

Used as input as single key presses (avoid spamming) #8

Open Utopiah opened 3 months ago

Utopiah commented 3 months ago

Currently while plugging to my desktop I get repetitive keypresses, i.e

fabien@fabien-CORSAIR-ONE-i160:~$ xinput 
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ STMicroelectronics STM32 Custom Human interface   id=15   [slave  keyboard (3)]

fabien@fabien-CORSAIR-ONE-i160:~$ xev 

KeyRelease event, serial 50, synthetic NO, window 0x7c00001,
    root 0x1e7, subw 0x0, time 59085715, (1159,1162), root:(2990,2138),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 50, synthetic NO, window 0x7c00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 50, synthetic NO, window 0x7c00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 50, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   4   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyRelease event, serial 41, synthetic NO, window 0x7c00001,
    root 0x1e7, subw 0x0, time 59240705, (146,128), root:(1977,1104),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 41, synthetic NO, window 0x7c00001,
    mode NotifyGrab, detail NotifyAncestor

FocusOut event, serial 41, synthetic NO, window 0x7c00001,
    mode NotifyUngrab, detail NotifyPointer

FocusIn event, serial 41, synthetic NO, window 0x7c00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 41, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

which is nice except it get repeated, namely spamming XF86AudioLowerVolume or XF86AudioRaiseVolume even without turning the encoder.

Is this the expected behavior? If not how do I fix it? If it is expected, how can I change it so that when released there is no more keypress?

MitkoDyakov commented 3 months ago

Can you share the project which runs on the RoEnDi? Is it some of the examples ?

Utopiah commented 3 months ago

Yes, I didn't change anything, it's the central R with yellow on top/blue on the right/red on the bottom/purple on the left

MitkoDyakov commented 3 months ago

Note that the demos were tested only on windows machine. The knob should operate as volume control. At one point there was a bug when turning in either direction would make the volume go to max or zero. This was due to the report of the pressed keys not being cleared when the know stopped turning. I will make sure to find the volume control demo and uploaded to the repo for reference

Utopiah commented 3 months ago

there was a bug when turning in either direction would make the volume go to max or zero

that's what I'm encountering

MitkoDyakov commented 3 months ago

Please take a look at RotaryEncoderWithDispla example. This should fix the issue.