Skip to content

Commit

Permalink
Bugfix in FORCERESUME function
Browse files Browse the repository at this point in the history
  • Loading branch information
technik-gegg committed May 6, 2023
1 parent 2610e45 commit b056494
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion octoprint_SMuFF/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import octoprint.plugin
import logging
import re

LOGGER = "octoprint.plugins.SMuFF"
DEFAULT_BAUD = 115200
Expand Down Expand Up @@ -485,7 +486,7 @@ def extend_tool_sending(self, comm_instance, phase, cmd, cmd_type, gcode, subcod
# @SMuFF FORCERESUME
if action and action == FORCERESUME:
if self._printer.is_pausing():
self._log.debug("SMuFF load-state: {0}").format(instance.loadState)
self._log.debug("SMuFF load-state: {0}".format(instance.loadState))
instance.stop_tc_timer()
# send the default OctoPrint "After Tool Change" script to the printer
self._printer.script("afterToolChange")
Expand Down Expand Up @@ -580,6 +581,10 @@ def extend_tool_sending(self, comm_instance, phase, cmd, cmd_type, gcode, subcod
autoload = self._settings.get_boolean(["autoload"])
# send a tool change command to SMuFF
res = instance.send_SMuFF_and_wait(str(instance.pendingTool) + (smuff_core.AUTOLOAD if autoload else ""))
# make sure there's no garbage in the received string - filter for 'Tx' only, ignore the rest
match = re.search(r'^T\d+', res)
if match != None:
res = match[0]
# do we have the tool requested now?
if str(res) == str(instance.pendingTool):
instance.set_tool()
Expand Down
12 changes: 11 additions & 1 deletion octoprint_SMuFF/smuff_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,17 @@ def _parse_serial_data(self, data):
# don't process any general debug messages
index = len(R_ECHO)+1
if data[index:].startswith(R_DEBUG):
self._log.debug("SMuFF has sent a debug response: [{0}]".format(data.rstrip()))
err = "SMuFF has sent a debug response: [{0}]".format(data.rstrip())
self._log.debug(err)
# filter out ESC sequences
match = re.sub(r'\033\[\d+m', '', err)
if match != None:
err = match
if self._isKlipper:
self.gcode.respond_info(err)
else:
if not self._responseCB == None:
self._responseCB(err)
# but do process the tool/endstop states
elif data[index:].startswith(R_STATES):
self._parse_states(data.rstrip())
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "SMuFF Plugin"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.2.3"
plugin_version = "1.2.4"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit b056494

Please sign in to comment.