Skip to content

Commit 1949d24

Browse files
committed
Add better logging
1 parent 087bb52 commit 1949d24

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

octoprint_filamentreload/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def on_after_startup(self):
3636
if self._settings.get(["pin"]) != "-1": # If a pin is defined
3737
self._logger.info("Filament Sensor active on GPIO Pin [%s]"%self.pin)
3838
GPIO.setup(self.pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Initialize GPIO as INPUT
39+
else:
40+
self._logger.info("Pin not configured, won't work unless configured!")
3941

4042
def get_settings_defaults(self):
4143
return dict(
@@ -74,11 +76,14 @@ def on_event(self, event, payload):
7476
def check_gpio(self, channel):
7577
sleep(self.bounce/1000)
7678
state = GPIO.input(self.pin)
77-
self._logger.debug("Detected sensor [%s] state [%s]"%(channel, state))
7879
if state != self.switch: # If the sensor is tripped
79-
self._logger.debug("Sensor [%s]"%state)
80+
self._logger.info("Out of filament!")
8081
if self._printer.is_printing():
82+
self._logger.info("Pausing print.")
8183
self._printer.toggle_pause_print()
84+
else:
85+
self._logger.info("Filament detected!")
86+
8287

8388
def get_update_information(self):
8489
return dict(

0 commit comments

Comments
 (0)