Skip to content

Commit

Permalink
Fix config file consistency and clarify GCode state command usage (#136)
Browse files Browse the repository at this point in the history
The PRINT_END macro in the Octopus config file contains a pair of
SAVE_GCODE_STATE/RESTORE_GCODE_STATE command. The purpose of those
commands is to allow the macro to perfom actions at the end of the
print and then restore the printer state as it was prior to the
macro's execution (restore coordinate system and speeds).

However, there was some confusion as to the effect of those calls,
particularly the RESTORE_GCODE_STATE. What is desired is that the
printer state is restored but the toolhead position is not.

To clarify the intention and prevent any issues, the "MOVE=0"
argument to RESTORE_GCODE_STATE is added as to explicitly prevent
any toolhead position changes and a comment is added to describe
the purpose of the commands.

Since having the commands in the PRINT_END macro is something that
is needed, the same commands have also been added to any of the
other configs which were missing it.
  • Loading branch information
voidtrance authored Nov 7, 2023
1 parent 1f4795c commit f90d36c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Firmware/M8P/Trident_M8P_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ gcode:
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
gcode:
SAVE_GCODE_STATE NAME=STATE_PRINT_END

M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-10.0 F3600 ; retract filament
Expand All @@ -514,4 +516,9 @@ gcode:
G0 X125 Y250 F3600 ; park nozzle at rear
BED_MESH_CLEAR


# The purpose of the SAVE_GCODE_STATE/RESTORE_GCODE_STATE
# command pair is to restore the printer's coordinate system
# and speed settings since the commands above change them.
# However, to prevent any accidental, unintentional toolhead
# moves when restoring the state, explicitly set MOVE=0.
RESTORE_GCODE_STATE NAME=STATE_PRINT_END MOVE=0
10 changes: 8 additions & 2 deletions Firmware/Octopus/Trident_Octopus_Config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ gcode:
{% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}

SAVE_GCODE_STATE NAME=STATE_PRINT_END

M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-2.0 F3600 ; retract filament
Expand All @@ -538,4 +538,10 @@ gcode:
M107 ; turn off fan

BED_MESH_CLEAR
RESTORE_GCODE_STATE NAME=STATE_PRINT_END

# The purpose of the SAVE_GCODE_STATE/RESTORE_GCODE_STATE
# command pair is to restore the printer's coordinate system
# and speed settings since the commands above change them.
# However, to prevent any accidental, unintentional toolhead
# moves when restoring the state, explicitly set MOVE=0.
RESTORE_GCODE_STATE NAME=STATE_PRINT_END MOVE=0
10 changes: 10 additions & 0 deletions Firmware/Voron_Trident_SKR14_EXPMOT.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ gcode:
{% endif %}

# Commence PRINT_END
SAVE_GCODE_STATE NAME=STATE_PRINT_END

M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-4.0 F3600 ; retract
Expand All @@ -525,4 +527,12 @@ gcode:
M106 S0 ; turn off fan
G90 ; absolute positioning
G0 X{max_x / 2} Y{max_y} F3600 ; park nozzle at rear

# The purpose of the SAVE_GCODE_STATE/RESTORE_GCODE_STATE
# command pair is to restore the printer's coordinate system
# and speed settings since the commands above change them.
# However, to prevent any accidental, unintentional toolhead
# moves when restoring the state, explicitly set MOVE=0.
RESTORE_GCODE_STATE NAME=STATE_PRINT_END MOVE=0

M117 Finished!
10 changes: 10 additions & 0 deletions Firmware/Voron_Trident_SKR_1.3.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ gcode:
{% endif %}

# Commence PRINT_END
SAVE_GCODE_STATE NAME=STATE_PRINT_END

M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-4.0 F3600 ; retract
Expand All @@ -598,4 +600,12 @@ gcode:
M106 S0 ; turn off fan
G90 ; absolute positioning
G0 X{max_x / 2} Y{max_y} F3600 ; park nozzle at rear

# The purpose of the SAVE_GCODE_STATE/RESTORE_GCODE_STATE
# command pair is to restore the printer's coordinate system
# and speed settings since the commands above change them.
# However, to prevent any accidental, unintentional toolhead
# moves when restoring the state, explicitly set MOVE=0.
RESTORE_GCODE_STATE NAME=STATE_PRINT_END MOVE=0

M117 Finished!

0 comments on commit f90d36c

Please sign in to comment.