We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30a3084 commit 7be3683Copy full SHA for 7be3683
octoprint_filamentreload/__init__.py
@@ -65,6 +65,19 @@ def get_settings_defaults(self):
65
after_resume_gcode = '',
66
)
67
68
+ def on_settings_save(self, data):
69
+ octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
70
+
71
+ if self.mode == 0:
72
+ GPIO.setmode(GPIO.BOARD)
73
+ else:
74
+ GPIO.setmode(GPIO.BCM)
75
76
+ if self._settings.get(["pin"]) != "-1": # If a pin is defined
77
+ self._logger.info("Filament Sensor active on GPIO Pin [%s]"%self.pin)
78
+ GPIO.setup(self.pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Initialize GPIO as INPUT
79
80
81
def sensor_enabled(self):
82
return self.pin != -1
83
0 commit comments