-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: Failed to add edge detection #9
Comments
Wow... an original B+! Feels like those came out forever ago now. I haven't tested anything on one in quite some time! Could you post the config section for Mopidy-Raspberry-GPIO detailing which pins you're using? It will probably be easier to write a minimal test script to reproduce this that just uses |
I happened to run into the exact same issue today with my RP1 board. In my case I was using pin 4, and it was throwing the same error.
Sidenote for @Gadgetoid , in order for me to get the plugin to run, I had to do the following steps manually after running the pip command:
|
@willemk that's a good spot regarding the pins that are already used. My guess is that the offending use is - and I'm rummaging in the depths of my memory here - I wonder if I can trap this and produce some more useful error. I tend not to include So, TODO:
|
Hi @Gadgetoid, yes the original B+ :-). Found the in a box and thought it might be cool creating a web-music-box. The install took a while but so far it's working great. I investigated a bit more and could find the issue thanks to @willemk . This config is not working and displaying the "failed to add edge detection":
This config works:
|
Definitely a combo of Mopidy using the default configuration for any pin not explicitly defined in the config file and the somewhat weird set up I have for pin configuration. That's... a bit of a nuisance. I can certainly update the documentation to point this out, but it feels wrong to have to explicitly unbind keys. I think the only correct solution is to blank out all of the default configuration, removing any inclination this library has toward our Pirate Audio range, since our Pirate Audio installer explicitly sets up the configuration anyway. This would also guard against any unexpected pin changes and ensure nothing like #5 happens. |
This config is set by the Pirate Audio install script- https://github.com/pimoroni/pirate-audio/blob/master/mopidy/install.sh Since this library is device agnostic, these defaults don't have to be here, and shouldn't be here. Users should have to explicitly configure and enable the plugin. See #9 for an example of the default pin config being unexpectedly loaded and causing the plugin to bail.
Thanks for the help on this thread. I just noticed this error on a RPi 2B and fixed it by running |
On raspberry 4 ubuntu 22.04 I fixed it by adding : |
Issue has happened a few times for me, but it is rare and random, as if there is a race condition with something else on my system. A way to find the conflicting pin is to edit frontend.py to report it; try:
GPIO.add_event_detect(
pin,
edge,
callback=self.gpio_event,
bouncetime=settings.bouncetime,
)
except RuntimeError:
logger.error(f"add_event_detect fail: {key}") Goes here;
|
I'm try to install Pirta eaudio with Mopidy. |
@davidbenucci, your error shows the system package for Mopidy is loading the Mopidy Raspberry Pi frontend from your |
I follow your suggestion and install all packages with
|
Thanks. I suggest you try what I did in January (above) and change the plugin code to report which pin is failing, run it to have it fail, and then remove that pin from your Mopidy configuration. Repeat until it runs properly. Or remove all pins from the configuration and add them back one at a time. A pin may not function because the operating system has been configured to dedicate it to another purpose, or another application is using it. |
Thanks. I'll try this. But one thing: if I use Raspi OS Bullseye everything works fine. It's a bit strangethat a frash install of a OS use some pins by default, inn't it? I have only pirate audio hat on my Pi Zero 2 |
Yes, it is a bit strange, presumably Bullseye and Bookworm have enough differences to break this for you. I'm loath to upgrade to find out for myself that it breaks. I've had a look at another Raspberry Pi that I've upgraded to Bookworm that doesn't have a Pirate Audio Hat, and it isn't clear to me yet if there's any pins allocated to some other use, or if the numbering has changed. You could also try stopping mopidy and then using the pins in some other way, such as with Python. That might indicate a cause. |
I tried to install the plugin on my Raspberry 1 Model B+.
Mopidy is running fine with serveral exenstions.
I got the following error:
RROR 2020-07-16 22:39:36,062 [1441:MainThread] mopidy.commands Got un-handled exception from RaspberryGPIOFrontend Traceback (most recent call last): File "/usr/lib/python3/dist-packages/mopidy/commands.py", line 241, in _actor_error_handling yield File "/usr/lib/python3/dist-packages/mopidy/commands.py", line 438, in start_frontends frontend_class.start(config=config, core=core) File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 91, in start obj = cls(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/mopidy_raspberry_gpio/frontend.py", line 42, in __init__ bouncetime=settings.bouncetime, RuntimeError: Failed to add edge detection
I tried it with a Raspi 3 and it works.
Maybe, the edge detection is working in another way on the Raspi 1? Do you have more information or a hint how I can get it to work on the Raspi 1?
The text was updated successfully, but these errors were encountered: