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
…) (#452)

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 committed Nov 22, 2023
1 parent eed9310 commit de7e89d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
9 changes: 9 additions & 0 deletions firmware/klipper_configurations/M8P/Voron2_M8P_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,12 @@ 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

G91 ; relative positioning
G0 Z1.00 X20.0 Y20.0 F20000 ; move nozzle to remove stringing
TURN_OFF_HEATERS
Expand All @@ -550,4 +553,10 @@ 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

Original file line number Diff line number Diff line change
Expand Up @@ -571,17 +571,23 @@ 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-5.0 F1800 ; retract filament

TURN_OFF_HEATERS

G90 ; absolute positioning
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear
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: 8 additions & 2 deletions firmware/klipper_configurations/SKR_1.3/Voron2_SKR_13_Config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,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-5.0 F1800 ; retract filament
Expand All @@ -576,4 +576,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: 8 additions & 2 deletions firmware/klipper_configurations/SKR_1.4/Voron2_SKR_14_Config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,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-5.0 F1800 ; retract filament
Expand All @@ -576,4 +576,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: 8 additions & 2 deletions firmware/klipper_configurations/Spider/Voron2_Spider_Config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,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-5.0 F1800 ; retract filament
Expand All @@ -519,4 +519,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

0 comments on commit de7e89d

Please sign in to comment.