Skip to content

Commit a15c7d9

Browse files
committed
Add filament check when print begins
1 parent 1949d24 commit a15c7d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

octoprint_filamentreload/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def on_event(self, event, payload):
5858
self._logger.info("Printing: Filament sensor enabled")
5959
if self.pin != -1:
6060
GPIO.remove_event_detect(self.pin)
61+
self.check_gpio(self.pin)
6162
GPIO.add_event_detect(self.pin, GPIO.BOTH, callback=self.check_gpio, bouncetime=self.bounce)
6263
# Not printing
6364
elif event in (
@@ -73,7 +74,7 @@ def on_event(self, event, payload):
7374
except Exception:
7475
pass
7576

76-
def check_gpio(self, channel):
77+
def check_gpio(self, _):
7778
sleep(self.bounce/1000)
7879
state = GPIO.input(self.pin)
7980
if state != self.switch: # If the sensor is tripped

0 commit comments

Comments
 (0)