Allen-Synthesis / EuroPi

EuroPi: A reprogrammable Eurorack module based on the Raspberry Pi Pico
Creative Commons Zero v1.0 Universal
431 stars 84 forks source link

Minor improvements to the DigitalReader class #207

Closed redoxcode closed 1 year ago

redoxcode commented 1 year ago

I made some improvements to the DigitalReader class. Before it was reading the hardware pin twice in a row on a falling edge signal and could in theory (very unlikely, but still) miss falling edge signals (if the pin would change between these reads). Also I found it some times unintuitive or failed to trigger the 'both buttons' action. I propose to reduce the time needed to hold both buttons and in turn add a check how long the 'other' button has been down to avoid accidental triggering (I am open to adjusting the timing values). I am still not happy with the DigitalReader class or more precisely the _bounce_wrapper. De-bouncing is not optimal yet, as it will prevent double triggers of the same event (a bounce after a rising wont trigger an other rising) but not of the counter event (a bounce after a rising can trigger a early falling event). But for now I have no elegant way to to fix that without the risk of dropping legit events. So this PR only fixes the other things for now.