Filament runout macro

Basic Information:

Printer Model:
MCU / Printerboard:
Host / SBC
klippy.log

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

Hello,
with this macro how would i get it to keep printing a SET distance? But only if it shows a run out of filament obviously not if there is a jam, as its the BTT SFS so it should be able to tell first is there filament then if so is the filament moving.

[gcode_macro FILAMENT_RUNOUT]
gcode:
    SET_IDLE_TIMEOUT TIMEOUT=10800 # Set idle_timeout to 3hrs
    #M104 S0 # turn off the hotend
    #SAVE_GCODE_STATE is not required as PAUSE does this automatically
    # See here: https://www.klipper3d.org/G-Codes.html#pause
    PAUSE
    RESPOND TYPE=error MSG='Filament Rounout. Please check Filament'
    G91 # Relative positioning
    G1 E-10 F2100 # Retract 10mm of filament
    G1 Z10 # Move Z up 10mm from current position
    G90 # Absolute positioning
    G1 X410 Y340 F6000 # Park at the coordinates you said you wanted
    M106 S0 # Disable the part cooling fan
    G4 S120
    UPDATE_DELAYED_GCODE ID=runout_wait DURATION=0

[delayed_gcode runout_wait]
gcode:
    # Honestly you probably shouldn't keep the hotend heated for 5 minutes as it's
    # definitely going to leak a bunch of filament during that time, but anyway
    M104 S0 # turn off the hotend

Thats the macro but the config is this:

###############################
### Filament Motion Sensor ####
### https://www.klipper3d.org/Config_Reference.html#filament_motion_sensor ###
###############################
[filament_motion_sensor smart_filament_sensor]
switch_pin: ^PC2
detection_length: 7.0
extruder: extruder
pause_on_runout: False #pause handled by macro
runout_gcode:
  FILAMENT_RUNOUT
insert_gcode:
  INSERT_FILAMENT

the reason i would like to know how to make it keep printing when filament runs out for a set distance. Is so the excess filament can be used up and to get it out of the way, so i can insert new filament as it pauses straight away and stops me from being able to put more in.
Preformatted text
klippy.log (95.1 KB)

Please use the Preformatted Text feature of the forum editor for your code snippets.

Otherwise spaces get lost and other characters too and the code make no sense.

Format

The klippy.log would be handy too.

cheers sorry i forgot about the preformatted text

1 Like

detection_length parameter is controlling that.
Basically that parameter is defining an filament length offset between real detection moment and triggering a runout event.
But when runout event is triggered system can’t stop immediately, it need to do it gracefully, stop processing GCodes, reading SDCard, buffers, etc … and only then it will stop and start executing your FILAMENT_RUNOUT commands - so you need some amount to be there.

Ok awesome thank you. Seems to do it pretty quick cause it seems to stop a few mm from the roller that’s in the sensor. So pretty much i have Microswiss direct drive for and ender 3 then the SFS on top but there is a gap between the end of the SFS to the top of the gears on the direct drive, which then when it stops just after the sensor wheel then makes it hard for me to put new filament in without alot of messing around.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.