nickmitchko / Octoprint-Filament-Reloaded

GNU General Public License v3.0
9 stars 13 forks source link

Runtime Error: Failed to add edge detection #21

Open daviskarloh opened 2 weeks ago

daviskarloh commented 2 weeks ago

@nickmitchko There is an error when setting up the plugin changing the board or GPIO pin and i get this, GPIO.add_event_detect( RuntimeError: Failed to add edge detection

I have the ground connected to pin 39(GND) and the S connected to pin 37 (GPIO 26). I have the plugin set up to Pin 37 in board mode and doesn't work when the sensor doesn't have filament. I then change the board PIN mode to BCM mode and GPIO 26 and still nothing. I am wondering if the edge detection is preventing

nickmitchko commented 2 weeks ago

What happens if you keep the pins the same? Same error?

daviskarloh commented 2 weeks ago

@nickmitchko Not the same error, it says that GPIO.setmode(GPIO.BCM) already exists. When i switch it back.

In the readme it says the following: "The code is set to use the Raspberry Pi's internal Pull-Up resistors, so the switch should be between your detection pin and a ground pin. This plugin is using the GPIO.BOARD numbering scheme, the pin being used needs to be selected by the physical pin number. "

My detection plug (S) is in board pin 37 and my ground in 39. So when I configure it I made sure to put PIN 37 in Board mode not BCM mode. It seems like this might be why I am getting the error below when I try changing it to BCM GPIO pin 26? GPIO.add_event_detect( RuntimeError: Failed to add edge detection

Additionally PIN 37 i believe is pull down resistor not pull up, do I have to connect it to a pin set up as pull up then?

$ sudo raspi-gpio get BANK0 (GPIO 0 to 27): GPIO 26: level=0 fsel=0 func=INPUT pull=DOWN GPIO 27: level=0 fsel=0 func=INPUT pull=DOWN