Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions octoprint_filamentreload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def no_filament_gcode(self):
def pause_print(self):
return self._settings.get_boolean(["pause_print"])

@property
def send_gcode_only_once(self):
return self._settings.get_boolean(["send_gcode_only_once"])

def _setup_sensor(self):
if self.sensor_enabled():
self._logger.info("Setting up sensor.")
Expand All @@ -68,6 +72,7 @@ def get_settings_defaults(self):
mode = 0, # Board Mode
no_filament_gcode = '',
pause_print = True,
send_gcode_only_once = False, # Default set to False for backward compatibility
)

def on_settings_save(self, data):
Expand Down Expand Up @@ -116,6 +121,9 @@ def sensor_callback(self, _):
sleep(self.bounce/1000)
if self.no_filament():
self._logger.info("Out of filament!")
if self.send_gcode_only_once:
self._logger.info("Sending GCODE only once...removing filament sensor callback.")
GPIO.remove_event_detect(self.pin)
if self.pause_print:
self._logger.info("Pausing print.")
self._printer.pause_print()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@
</label>
</div>
</div>
<div class="control-group">
<div class="controls" data-toggle="tooltip" title="{{ _('With this option checked, the plugin will ignore subsequent reports of out of filament until the print is resumed again.') }}">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.filamentreload.send_gcode_only_once"> {{ _('Send GCODE only once when out of filament.') }}
</label>
</div>
</div>

</form>