Jump to content

Klipper - Filament Unload / Pause / M600 Macros


Wick

Recommended Posts

today I found the mainsail-config when searching why I can't edit the mainsail.cfg.....

as there is also a M600 i tried to modfy my unload Filament macro to work together with the PAUSE from there, they use the 'printer.extruder.can_extrude' to check if the hotend temp is high enough to extrude. as I need it the other way around to heat up if required I thought I could use this instead

{% set hotendtemp = params.HOTEND|default(230)|int %}
{% if printer.extruder.temperature < '210' %}
      M117 Heating...
      STATUS_HEATING
      M109 S{hotendtemp}                                                  
{% endif %}

so my M600 is only

[gcode_macro M600]
description: Filament change
gcode: 
    PAUSE Z_MIN=50
    UNLOAD_FILAMENT

to work during colour change while the UNLOAD_FILAMENT macro should work alone as well....

[gcode_macro UNLOAD_FILAMENT]
despription:Filament Unload
gcode:
    {% set hotendtemp = params.HOTEND|default(230)|int %}
    SAVE_GCODE_STATE NAME=unload_state 
#    M104 S{hotendtemp}                                                          ; set & continue hotend temp, default to 230 -> deactivated for test M600
    {% if printer.toolhead.homed_axes != 'xyz' %}                               ; Home if not already homed
      M117 Homing...
      STATUS_HOMING
      G28                                                                       ; Alphaville: Lassie come home, come home lalala
    {% endif %}
    {% if printer.extruder.temperature < '200' %}                               ; too cold? seems no active print so no M600 then ...
      G1 Y50 X300 Z50 F3600                                                     ; move toolhead to reachable position and ...
      M117 Heating...                                                           ; heat up
      STATUS_HEATING
      M109 S{hotendtemp}                                                        ; set & wait for hotend temp, default to 230
    {% endif %}
    G91
    G92 E0                                                                      ; reset Extruder
    M117 Unloading Filament
    STATUS_PRINTING
    G0 E10 F360                                                                 ; extract a bit
    G0 E5 F3600                                                                 ; blob a bit
    G0 E-22 F3600                                                               ; forming filament Tip for Rapido -> from ERCF V3 ercf_software.cfg 
    G0 E2 F300
    G0 E-2.1 F300
    G0 E2 F300
    G0 E-2.2 F300
    G0 E2 F300
    G0 E-2.3 F300
    G0 E2 F300
    G0 E-2.4 F300
    G0 E2 F300
    G0 E-2.5 F300
    G0 E2 F300
    G0 E-43 F300                                                                 ; Filament Tip cooldown till extruder gears for Rapido -> from ERCF V3 ercf_software.cfg 
    G0 E-100 F3600                                                               ; aaand puke it out fast
    M117 Filament unloaded!
#    STATUS_COOLING                                                               ;-> deactivated for test M600/PAUSE
#    TURN_OFF_HEATERS                                                             ;-> deactivated for test M600/PAUSE
    G90
#    G0 X300 Y360 F3600                                                           ; park nozzle over bucket -> deactivated for test M600/PAUSE
    STATUS_READY
    RESTORE_GCODE_STATE NAME=unload_state

So my question to the Macro Gurus, do you think this could work or do you have better ideas (as sometimes little Wick thinks the world is a lollipop🙈)?

Edited by Wick
Link to comment
Share on other sites

  • Wick changed the title to Klipper - Filament Unload / Pause / M600 Macros

hahaaaa, got it....

if you are crazy enough to try out my weird thoughts you need to have customisable mainsail-configs installed ( to have different park positions for Pause/Cancel/Retractions etc, very useful! )

I modified my unload/load macros to include the colour change.

So if you define a colour change in your slicer, and printing comes to the layer with colour change, toolhead goes to the defined position and unloads the filament, when inserting the new colour, simply push   load filament   button, fila will be loaded and print resumes automatically. standard load/unload works as before..

[gcode_macro UNLOAD_FILAMENT]
description:Unload Filament
gcode:
    {% set hotendtemp = params.HOTEND|default(230)|int %}
    SAVE_GCODE_STATE NAME=unload_state
    {% if printer.pause_resume.is_paused == False %}                            ; PAUSE active? if not then normal unload with position, heatup, and tip...
      M104 S{hotendtemp}                                                        ; set & continue hotend temp, default to 230
      {% if printer.toolhead.homed_axes != 'xyz' %}                             ; Home if not already homed
        M117 Homing...
        STATUS_HOMING                                                           ; LEDs show homing
        G28                                                                     ; Alphaville: Lassie come home, come home lalala
      {% endif %}
      G1 Y50 X300 Z50 F3600                                                     ; move toolhead to reachable position and ...
      M117 Heating
      STATUS_HEATING                                                            ; LEDs show heating
      M109 S{hotendtemp}                                                        ; set & wait for hotend temp, default to 230
      M117 Unloading Filament 
      STATUS_PRINTING                                                           ; LEDs show printing
      G91
      G0 E10 F360                                                               ; extract a bit
      G0 E5 F3600                                                               ; blob a bit
      G0 E-22 F3600                                                             ; forming filament Tip for Rapido -> from ERCF V3 ercf_software.cfg 
      G0 E2 F300
      G0 E-2.1 F300
      G0 E2 F300
      G0 E-2.2 F300
      G0 E2 F300
      G0 E-2.3 F300
      G0 E2 F300
      G0 E-2.4 F300
      G0 E2 F300
      G0 E-2.5 F300
      G0 E2 F300
      G0 E-43 F300                                                               ; Filament Tip cooldown till extruder gears for Rapido -> from ERCF V3 ercf_software.cfg 
      G0 E-100 F3600                                                             ; aaand puke it out fast
       M117 Fila unloaded, what now?
    {% else %}                                                                   ; UUPS!! Pause or M600 active, hurry up now, time is Filament 
      M117 Unloading Filament
      STATUS_PRINTING                                                            ; LEDs show printing
      G91
      G0 E10 F360                                                                ; extract a bit
      G0 E5 F3600                                                                ; blob a bit
      G0 E-150 F3600                                                             ; schwupdiwup, away with it
      M117 Fila unloaded, hurry up for the next!
    {% endif %}
#    STATUS_COOLING                                                               ; LEDs show cooling
#    TURN_OFF_HEATERS                                                             ; cooldown
    G90
    STATUS_READY                                                                  ; LEDs show ready
    RESTORE_GCODE_STATE NAME=unload_state

[gcode_macro LOAD_FILAMENT]
description:Load Filament
gcode:
    {% set hotendtemp = params.HOTEND|default(230)|int %}
    SAVE_GCODE_STATE NAME=load_state
    {% if printer.pause_resume.is_paused == False %}                            ; PAUSE active? if not then normal loading with position, heatup...
      M104 S{hotendtemp}                                                        ; set & continue hotend temp, default to 230
      {% if printer.toolhead.homed_axes != 'xyz' %}                             ; Home if not already homed
        M117 Homing...
        STATUS_HOMING                                                           ; LEDs show homing
        G28                                                                     ; Lynyrd Skynyrd: sweet home Alabama Lalala
      {% endif %}
      G1 Y50 X300 Z50 F3600                                                     ; move toolhead to reachable position and ...
      M117 Heating
      STATUS_HEATING                                                            ; LEDs show heating
      M109 S{hotendtemp}                                                        ; set & wait for hotend temp, default to 230
      M117 loading Filament
      STATUS_PRINTING                                                           ; LEDs show printing
      G91
      G1 E200 F360                                                              ; extract 200mm for colour change
      G1 E5 F3600                                                               ; blob for cleaning Nozzle
      G1 E-10 F1200                                                             ; retract for non oozing
      M117 Filament ready...
#      STATUS_COOLING                                                            ; LEDs show cooling
#      TURN_OFF_HEATERS
      G90
      G0 X300 Y360 F3600                                                        ; park nozzle over bucket
      STATUS_READY                                                              ; LEDs show Ready
      RESTORE_GCODE_STATE NAME=load_state
    {% else %}                                                                  ; UUPS!! Pause or M600 active, hurry up now, printfailure waits for you
      M117 loading Filament
      STATUS_PRINTING                                                           ; LEDs show printing
      G91
      G1 E200 F360                                                              ; extract 200mm for colour change
      G1 E5 F3600                                                               ; blob for cleaning Nozzle
      G1 E-1 F1200                                                              ; retract for non oozing
      M117 Filament ready, resuming...
      G90
      RESTORE_GCODE_STATE NAME=load_state
      RESUME
    {% endif %}


[gcode_macro M600]
description: Filament change
gcode: 
    PAUSE Z_MIN=50
    UNLOAD_FILAMENT

 

 

Edited by Wick
  • Like 2
Link to comment
Share on other sites

10 hours ago, Wick said:

you need to have customisable mainsail-configs installed ( to have different park positions for Pause/Cancel/Retractions etc, very useful! )

Wasn't even aware of that. Definitely will have a read of it though. Thanks.

As you put out a challenge....

10 hours ago, Wick said:

if you are crazy enough

What me crazy? What you talking about? Crazy

I might even try it.

Link to comment
Share on other sites

10 hours ago, Wick said:
   G28                                                                     ; Lynyrd Skynyrd: sweet home Alabama Lalala
      {% endif %}
      G1 Y50 X300 Z50 F3600                                                     ; move toolhead to reachable position and ...

the 2 G1  needs to be modfied for your printersize (mine is for 350)

and also the 2 unloading parts with the values for your hotend as stated ercf_software.cfg (which I wouldn't have found without your ERCF Thread 😉) for forming a tip when unloading

 

  • Thanks 1
Link to comment
Share on other sites

changed a little bit..... so now no longer neccessary to change Park positions or rectractions on Pause or Cancel in the unload and load sections, these values are now taken from the predefined Variables of the customisable mainsail-configs and some other changes, tested and works fine for me, now I just need to find out how to change to the extrude menu of klipperscreen on pausing when colour change, found no way so far, anyone with an Idea ?

 

I placed it in the Printer.cfg macros section before print_start and print_end

Unload_load_M600.cfg

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...