Filament change with Klipper in Octoprint

I have asked this on the Klipper forum but didn't get a response so thought I'd try asking here...

I am trying to work out how to implement a filament change.
After watching Youtube tutorials and searching various forums I see I need to implement an M600 macro, so I have added this to my printer.cfg file:

[gcode_macro M600]
gcode:
    {% set X = params.X|default(175)|float %}
    {% set Y = params.Y|default(0)|float %}
    {% set Z = params.Z|default(10)|float %}
    SAVE_GCODE_STATE NAME=M600_state
    PAUSE
    G91
    G1 E-.8 F2700
    G1 Z{Z}
    G90
    G1 X{X} F3000
    G1 Y{Y} F3000
    G91
    G1 E-50 F1000
    RESTORE_GCODE_STATE NAME=M600_state

But there are a number of things I don't understand here.

I appreciate the SAVE_GCODE_STATE command is recording the current state of the print but I don't understand why "PAUSE" is being called directly after.

It then looks like we are retracting 0.8mm of filament, raising the nozzle 10mm and moving to the front centre of the bed (my print volume is 350x350x400), then retracting a further 50mm of filament. My thought would be that this would then be the time to pause rather than before.

It then reloads the state saved before and presumably goes back to printing. My thought would be that "MOVE=1" should be on that restore command but perhaps that isn't necessary and the next command in the GCODE will just bring it back (hopefully not extruding filament along the way).

The issues I have are:

  • Why does the PAUSE happen right after the SAVE rather than when the printhead reaches it's resting location
  • What state the Extruder stepper is in at the end of the sequence
  • How to set the print going after the filament has been change.

I have tried running this code with less than satisfactory results.

  • I was unsure of how exactly I should resume the print after changing the filament and just clicked the "resume" button on the Octoprint interface. It kind of seemed to work but I'm not sure if this is the correct way to do it.
  • While the print head moved to the correct X/Y coordinates it still remained well above the print itself.
  • Although I was sure to run a good amount of the new filament threw the nozzle during the change none of this new filament ever came out of the nozzle once printing was resumed.

I suspect the reason none of the new filament ever came out may have been because I pressed the Extrude filament button (with the amount set to 100mm) several times to purge the nozzle of the old filament. Is it possible the stepper has been advanced several hundred mm beyond where the print job thought it was so basically just backed the new filament all the way out when resuming?

I may have manually raised the nozzle (or rather lowered the bed) during the filament change. If I did would this explain the nozzle not returning to the print, and if so how do I get the nozzle to go back to it's proper starting location?

You won't get an answer here.

OctoPrint is a 3D print server. Klipper is a firmware solution.

You asked on the Klipper forum just one day ago. You must have some more patience. There are no solutions out of the box.

Thank you @Ewald_Ikemann.

Really I'm just wanting to understand the G-Code, and asking how to resume after a pause is specific to Octoprint, or at least I though it was

If it's an inappropriate thing to ask than I'll remove the post but after not receiving a response on the Klipper board I thought I ask here too. My apologies if I've broken etiquette.