Feature Request - Filament Runout Trigger 'PAUSE' After 700mm extruded (distance_delay?)

Would like the ability to set the filament runout trigger to be a set extruded distance (distance_delay?)

ie
when filament sensor triggers. Wait 700mm before triggering PAUSE

2 Likes

I second this request, I’ve wanted this feature for a while now. I have a direct drive extruder on my hotend, but bowden tube to route the filament to it. The filament sensor lives on the upstream side of the bowden tube because that makes mounting and wiring so much easier, but now I have this long length of filament in queue that just gets thrown out when the sensor trips.

1 Like

I was looking for the same thing to no avail so I had a crack at making it work with the existing macro functionality.

Usage: PAUSE_AFTER_D D={distance_in_mm}

PAUSE_AFTER_D gets the current extruded distance, adds the D parameter to it, then triggers a delayed_gcode that checks every second if the extruded distance has reached the endpoint yet.

I’ve only tested this so far as it pauses after D more mm have been extruded, resumes correctly and then will pause in the same manner after resuming.

Let me know how you go!

[gcode_macro PAUSE_AFTER_D]
description: Trigger to pause the print after a further 'd' mm has been extruded
variable_end_d: 0 #create variable "END_D" which is associated with the PAUSE_AFTER_D gcode macro
gcode:
  {% set d_start = printer.print_stats.filament_used|float %} #starting point is whatever the filament used is when PAUSE_AFTER_D is called
  {% set d_end = (d_start + params.D|float)|float %} #end point is start + D parameter
  SET_GCODE_VARIABLE MACRO=PAUSE_AFTER_D VARIABLE=end_d VALUE={d_end} #write the end value to the END_D gcode variable to access later
  M117 Pause at {printer["gcode_macro PAUSE_AFTER_D"].end_d|round(2)}
  UPDATE_DELAYED_GCODE ID=PAUSE_AT_D DURATION=1 #trigger the delayed gcode below after 1 second

[delayed_gcode PAUSE_AT_D]
initial_duration: 0 #if initial_duration is zero, the delayed gcode won't start by default
gcode:
  {% set d_current = printer.print_stats.filament_used|float %} #get the current filament used
  {% if d_current < printer["gcode_macro PAUSE_AFTER_D"].end_d %} #if we aren't at the stopping point
    M117 Stopping {d_current|round(2)} {printer["gcode_macro PAUSE_AFTER_D"].end_d|round(2)}
    UPDATE_DELAYED_GCODE ID=PAUSE_AT_D DURATION=1 #restart the timer on the delayed gcode
  {% else %}
    PAUSE
    UPDATE_DELAYED_GCODE ID=PAUSE_AT_D DURATION=0 #set the delayed gcode duration back to zero so it doesn't keep triggering
  {% endif %}