peterhinch / micropython-async

Application of uasyncio to hardware interfaces. Tutorial and code.
MIT License
742 stars 168 forks source link

Feedback related to Quadrature Encoder #112

Closed rkompass closed 1 year ago

rkompass commented 1 year ago

Hi Peter,

just to give a feedback now: I checked your Encoder code and it looks fine. After introducing the if (x := pin_x()) != self._x: the flawed behaviour that I once mentioned (a year ago) should be gone. I tried to point you to the flaw then, without success. Later I saw that you had corrected the code without giving credit to my discussion and was disappointed. Later again I saw you got the point by another issue mentioned later. :-)

peterhinch commented 1 year ago

Apologies. I think it took me a while to grasp that the problem arises if further edges occur during the latency period between the first edge and the ISR actually running. Encoders are much more tricky than people realise...

I have added a credit for your contribution to encoder.py.