maocypher / Octoprint-Smart-Filament-Sensor

OctoPrint plugin that lets integrate Smart Filament Sensors like BigTreeTechs SmartFilamentSensor directly to RaspberryPi GPIO pins.
GNU General Public License v3.0
13 stars 20 forks source link

GPIO not working in BCM mode for other plugins #30

Open fspralja opened 3 years ago

fspralja commented 3 years ago

Hi, after updating the plugin to 1.1.5.3 other plugins using bcm mode like enclosure plugin stop working, disabling the smart filament sensor resolves the issue for now. Any suggestions? ty

arathas3d commented 3 years ago

I have the very same issue, me it with this plugin and PSU Control

maocypher commented 3 years ago

Hi, could you please try to uncomment the line with GPIO.cleanup in init.py? Maybe this causes it. If yes, I can fix that A restart is needed after this

fspralja commented 3 years ago

Yes, commenting out cleanup helped.

        def _setup_sensor(self):
        # Clean up before intializing again, because ports could already be in use
        #GPIO.cleanup()

other plugins have the cleanup as a web action (but probably a reboot cleans up as well): enclosure plugin warning on that button:

"This will clear any GPIO configuration that might exist on your system, use with caution, it might break other plugins that use GPIO"

PD5DJ commented 3 years ago

This really should be an option in the plugin UI configuration.

Thegs68 commented 3 years ago

Hi I was wondering where the init.py file is located. So that I can try and resolve the same problem. Also running 1.1.5.3.

fspralja commented 3 years ago

Hi, for me the path was /home/pi/oprint/lib/python2.7/site-packages/octoprint_smart_filament_sensor/__init__.py

Thegs68 commented 3 years ago

Thanks, that’s great, I’ll work from there as I’m on python 3.9.3 so the library structure changed. Thanks once again.

Greg Stay Safe, Stay Healthy

On Mar 22, 2021, at 2:14 PM, fspralja @.***> wrote:

 Hi, for me the path was /home/pi/oprint/lib/python2.7/site-packages/octoprint_smart_filament_sensor/init.py

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

griehsler commented 3 years ago

Heads up on this one: I had exactly the same issue, Smart Filament Sensor breaking PSU Control. Commenting out GPIO.cleanup() fixed it.

@maocypher +1 for removing it officially. GPIO is shared across all plugins. Cleanup needs to be used with care as it might (and obviously does) undo setup done by other plugins.

allenrowand commented 3 years ago

Commenting the line resolved the issues regarding interference with other GPIO configurations but stopped the sensor from working for me.

I realized the the side bar always showed the filament was moving (even when it wasn't) and I had a runout which wasn't stopped. Afterward I ran the sensor test and the sensor behaved as expected, but when I started the next print it didn't register filament movement and paused printing even though there was filament loaded.