Hi !
This has been a while since my last update.
I tweaked a bit the settings, and I am now back to getting this issue about once per day, which is definitely annoying, but it means that it’s quite likely related to timings.
I have now found a slightly better work-around than unplug-replug with the “soft reset” solution here to just reboot the keyboard when it happens: Sequence to reboot keyboard - #4 by polsonst.
The updated version of my sketch.
I also tried to do some simple serial-debugging, but it’s definitely tedious and if you have already a working (or almost working) plugin for that I’d be happy to take a look at it and give it a try.
I also tried to write a very minimal plugin (not in the current sketch) that logs to serial the timings between events in microseconds. When hitting a single key I get a rather large value about 100 000us, but sometimes get very short ones slightly less than 1000us. Given most plugins rely on the current millisecond, it could also possibly trigger a corner case.
Last but not least, when trying the hardware test mode to check for key chatter, the weird thing is that with some effort and very short keystrokes I am able to make ANY key marked as red, even the ones that are almost never used like num-lock.