caiden20000 / NetRadioBox

Raspberry Pi project that plays internet radio channels, with radio alarm clock mode.
0 stars 0 forks source link

BUG: Encoder events will queue #7

Open caiden20000 opened 2 months ago

caiden20000 commented 2 months ago

This is a big issue. As it is currently structured, each event from the encoder (esp. rotations) takes X ms to process. This X ms is longer than the Y ms it takes to create them when rotating the encoder quickly. This causes the encoder events to queue up. When the events are queued up, none are skipped. If the user spins the encoder quickly, the system is essentially locked up until it processes every event, causing additional user input to be further delayed.

A few questions to answer: Who does the queuing? The evdev library, or how Linux handles device inputs? What is the bottleneck? Is it how fast we are dealing with each event in the for loop? Or is it evdev's read loop? Or, worst case, is it the device overlay for the Raspberry PI? If our code speed is the bottleneck, how do we lower resource consumption with all these infinite loops? If evdev is the bottleneck, can we batch read? Can we throw away some events to get back to real time? If the device overlay is the bottleneck, what library can adequately substitute the functionality?

caiden20000 commented 2 months ago

We should first try the async read loops in their own threads to see if that will help.