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

ERROR - Could not save settings #19

Closed pheuts closed 3 years ago

pheuts commented 3 years ago

Im not getting the plugin to work. In Octoprint's log I find the following after changing a setting for the plugin:

2020-12-20 16:00:02,858 - octoprint.plugins.smartfilamentsensor - INFO - Using BCM Mode 2020-12-20 16:00:02,859 - octoprint.server.api.settings - ERROR - Could not save settings for plugin Smart Filament Sensor (1.1.3) Traceback (most recent call last): File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/api/settings.py", line 1034, in _saveSettings plugin.on_settings_save(data["plugins"][plugin_id]) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/init.py", line 1890, in wrapper return f(*args, **kwargs) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_smart_filament_sensor/init.py", line 116, in on_settings_save self._setup_sensor() File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_smart_filament_sensor/init.py", line 77, in _setup_sensor GPIO.setmode(GPIO.BCM) ValueError: A different mode has already been set!

Not being able to save settings obviously would prevent the plugin from working correctly. Am I doing something wrong? Forgetting a setting somewhere? Or is this a bug?

maocypher commented 3 years ago

Maybe Python 2 is behaving different from Python 3. I can take a closer look on this in a few days.

Is a print running while you tried to change the setting?

pheuts commented 3 years ago

There was no print running while changing the setting.

I wil see if i can update Python, and if this solves the problem. I did not consider the Phyton version as a cause in this. Thanks for the suggestion.

pheuts commented 3 years ago

@maocypher You were absolutely wright about the Phyton version being the cause of this problem. I updated to Phyton 3, and immediately everything started working as it should. Thank you for your help!

maocypher commented 3 years ago

Thanks for the feedback. Anyway I should fix it for Python 2 ;)