Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added save/restore state macro calls #60

Closed
wants to merge 3 commits into from
Closed
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
11 changes: 8 additions & 3 deletions AFC.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ def cmd_CHANGE_TOOL(self, gcmd):
store_pos = self.toolhead.get_position()
if self.is_printing() and not self.is_paused():
self.change_tool_pos = store_pos
# Create save state
self.gcode.run_script_from_command("SAVE_GCODE_STATE NAME=_AFC_CHANGE_TOOL")

if self.current != None:
self.gcode.run_script_from_command('TOOL_UNLOAD LANE=' + self.current)
self.gcode.run_script_from_command('TOOL_LOAD LANE=' + lane)
Expand All @@ -650,13 +653,15 @@ def cmd_CHANGE_TOOL(self, gcmd):
self.toolhead.wait_moves()
if self.is_printing() and not self.is_paused():
self.change_tool_pos = None
# Restore state
self.gcode.run_script_from_command("RESTORE_GCODE_STATE NAME=_AFC_CHANGE_TOOL MOVE=1 MOVE_SPEED={}".format(self.tool_unload_speed))

cmd_RESTORE_CHANGE_TOOL_POS_help = "change filaments in tool head"
def cmd_RESTORE_CHANGE_TOOL_POS(self, gcmd):
if self.change_tool_pos:
restore_pos = self.change_tool_pos[:3]
self.toolhead.manual_move(restore_pos, self.tool_unload_speed)
self.toolhead.wait_moves()
# Restore previous state
self.change_tool_pos = None
self.gcode.run_script_from_command("RESTORE_GCODE_STATE NAME=_AFC_CHANGE_TOOL MOVE=1 MOVE_SPEED={}".format(self.tool_unload_speed))
jimmyjon711 marked this conversation as resolved.
Show resolved Hide resolved

def hub_cut(self, lane):
CUR_LANE=self.printer.lookup_object('AFC_stepper '+lane)
Expand Down