Arksine / moonraker

Web API Server for Klipper
https://moonraker.readthedocs.io
GNU General Public License v3.0
1.02k stars 392 forks source link

Failed to load button #828

Closed Zilli341 closed 3 months ago

Zilli341 commented 4 months ago

What happened

I'm trying to add a button to toggle a solid-state relay but it's not working. I get the following error: "_Failed to load button button PowerButton

Using the same GPIO pin as an output works, and I can read it fine with gpiod. Changing pin doesn't do anything. I'm on an OrangePI Prime running Armbian Bookworm and everything should be up to date.

Client

Mainsail, Fluidd, KlipperScreen

Browser

Firefox, Other or N/A

How to reproduce

Add a [button] section and set a pin.

Additional information

I was messing around with other stuff, the error should be at the end of the file. moonraker(3).log

Arksine commented 4 months ago

Typically these kind of errors are system related, ie: an issue with permissions, the kernel build, etc.

When you state that you can read it using gpiod, do you mean using gpiomon? What version of gpiod is on the system? You can get it by running:

gpiodetect --version
Zilli341 commented 4 months ago

I always used gpioget as a quick check to see if it was working, but trying to use gpiomon returns the following error: "gpiomon: error waiting for events: No such device". I guess you were right and there is a problem somewhere deeper in the system and not in the application.

gpiodetect (libgpiod) v1.6.3 Copyright (C) 2017-2018 Bartosz Golaszewski License: LGPLv2.1 This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Arksine commented 4 months ago

Thanks for the response, I thought that might be the case. The gpioget program just returns the current state of the line, it doesn't actually request it as an input.

It may be possible to verify that it isn't a permission issue by running gpiomon as sudo. Otherwise I suspect its an issue with the Kernel build.

Zilli341 commented 3 months ago

I figured it out. In the end, it was something I probably should have noticed sooner. The Allwinner H5 doesn't support interrupts on the PC1-16 GPIOs, which are mostly located on the right side of the connector. I always chose random pins from that side when testing, so it never worked. After a few Google searches and a closer look at the datasheet, I figured out that was probably the reason. I switched to PAxx GPIOs, and now it's working.

Thank you for the help.

Arksine commented 3 months ago

Thanks for the feedback. Glad you were able to fix it.