Filament change with Klipper in Octoprint

Okay, finally got this to work.

The trick was to basically just remove everything from that M600 macro and simply call “pause” and rely upon the PAUSE and RESUME macros to do all the work:

[gcode_macro M600]
gcode:
    PAUSE

I found it was good to also call G92 E0.0 in both the PAUSE and RESUME macros to make sure and manual extrudes do not interfere with the print itself:

[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
    SAVE_GCODE_STATE NAME=PAUSE_state
    BASE_PAUSE
   
    # Suck up the filament for the journey
    G91
    G1 E-10 Z100 F1500

    # Head to the parking location
    G90
    G1 X150 Y0 F6000

    M83                   # Put the extruder into relative mode
    G92 E0.0           # Reset the extruder so that it thinks it is at position zero

   
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
    # Suck filament up for the journey back to the print
    G91
    G0 E-10

    G92 E0.0           # Reset the extruder again so that it thinks it is at position zero again (still in relative mode)
    M82                   # Put the extruder back into absolute mode.

    # Back to work again.
    G90   
    RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1

    # re-prime the filament.
    G91
    G1 E10
    G90

    # As you were
    BASE_RESUME

And finally it’s important to resume the print by typing RESUME into the terminal rather than pressing the resume button on the control tab of Octoprint.

Note the macro retracts the filament for the journey back to the print then re-primes it just before resuming, so you should have the extruder ready to extrude when you send the RESUME command.

1 Like