pimoroni / mopidy-raspberry-gpio

Mopidy GPIO Control Plugin for the Raspberry Pi (Using RPi.GPIO)
Apache License 2.0
21 stars 25 forks source link

bugfix: Random occurence of Failed to add edge detection #13

Open bigjim80 opened 3 years ago

bigjim80 commented 3 years ago

Sometimes a GPIO pin will fail to setup (RuntimeError: Failed to add edge detection). It was hard to know which pin gave the error. With this improvement the problematic pin number is logged and the plugin will continue to work for all other pins instead of stopping. Also try multiple times to set the event, as the error can occur randomly due to an error in PRi.GPIO, even if the pin is not in use. Tested on a Rpi Zero W with latest Raspbian-lite.