vash3d / pigpio_encoder

Python module for the KY040 rotary encoder.
GNU General Public License v3.0
14 stars 4 forks source link

No provision for exiting the watch() loop #13

Open TheBum opened 3 years ago

TheBum commented 3 years ago

The watch() loop should examine the value of a variable that tells it when to exit. The variable would be set in one of the callbacks.

volkerjaenisch commented 3 years ago

Can you please elaborate a bit more.

TheBum commented 3 years ago

The watch() method is nothing but an infinite sleep loop. I'm proposing making the loop conditional on a Boolean variable that can be set with a separate method, e.g. stop_watch().

volkerjaenisch commented 3 years ago

The watch() method was only left in the code for backward compatibility. Since the rotary now relies completely on pigpio triggered callback no watch at all is needed to operate the rotary. Watch will be gone in the next version.

phr0gger commented 1 year ago

I think what is missing is a method to reset the interrupt bindings, probably by calling pigpio's cancel() function.