Delayed activation of the - filament switch sensor

Hello together,

I have a filament switch sensor to detect a filament runout.
That works fine with the following standard code:

[filament_switch_sensor my_sensor]
pause_on_runout: True
#runout_gcode:
#insert_gcode:
#event_delay: 3.0
#pause_delay: 0.5
switch_pin: PG11

But between the filament switch sensor and the printer head is abot 300mm the PTFE tube-> that means I would cut those 300 mm filament off → throw away → new filament spool in-> start print again.

For not throwing away the filament I would like:
Filament switch sensor gives signal ->a delay for about 8 min (printer is printing 8 min.) → printer gets paused.

How do I have to write the g code for it?
Thanks, Timo

What printer do you have, or in other words: How large is the distance between sensor and extruder motor (bowden system?)?

Printer: RatRig Vcore
Bigtreetech Octopus V1.1
direct drive extruder: Orbiter
Distance between Extruder - Filament sensor about 400mm

From your description, it appears that you want to achieve the goal of delaying printing for 8 minutes after detecting a filament depletion signal, here’s an example

; Filament runout custom G-code
G91 ; Relative positioning
G1 E400 F3000 ; Extrude 400mm of filament at 3000mm/min
G90 ; Absolute positioning
G4 P4800 ; Wait for 4800000 milliseconds (8 minutes)
M600 ; Pause the printer and wait for manual intervention

In this example, G1 E400 F3000 is used to extrude filament at a rate of 3000mm/min for 400mm. You’ll need to adjust the E value and F value to match your printer’s extrusion rate and the length of the PTFE tube (400mm in your case). The G4 P4800 command pauses the printer for 8 minutes (4800 seconds).
Next, you’ll need to update your printer’s configuration file to include this custom G-code. In the [filament_switch_sensor my_sensor] section, you would add the following line:

runout_gcode = G91 ; Relative positioning\nG1 E400 F3000 ; Extrude 400mm of filament at 3000mm/min\nG90 ; Absolute positioning\nG4 P4800 ; Wait for 4800000 milliseconds (8 minutes)\nM600 ; Pause the printer and wait for manual intervention

After updating the configuration file, you should test it, and remember to always make a backup of your configuration files before making any changes.

I think he wants to keep printing, not throw those 400 mm away.