Filament Runout Event
-
I have a very unusual FIlamentline.
An extruder helps for loading next to the Spool with an Filament Runout Sensor.
After this follows a 3.6m long bowden.
then a small 5cm gap and the 2nd extruder on the printhead.now my question, how can i tell the printer when the event is used to use the 3.6m filament and pause right after this, i would like to reduce the amount of wasted filament as much as possible.
M950 to define the pin and M581 for the event is clear, but how i define the left distance to print ?
-
I use this method
I create a global variable in config.gif !exists(global.filamentDistance) global filamentDistance = 0 ; global for use to allow filament to feed for set distance after sensor trips else set global.filamentDistance = 0
In my filament error file
;0:/sys/filament-error.g ;run when a filament sensor error is detected. Print will be paused bt Daemon.g after runout distance. var runoutDistance = 350 ; this is just so you can change easily ; first check that we are not currently in an error state and the switch has been toggled again. if (global.filamentDistance !=0) || (state.status != "processing") echo "Filament sensor triggered, but no print in progress. No action taken" M99 ; exit macro ;echo "filament-error.g run" G4 P10 ; delay 10ms to debounce if sensors.filamentMonitors[0].status="ok" echo "switch bounce detected - error cancelled" M99 ; break out if sensor value is zero again (bouncing) echo {"Filament error type " ^ param.P ^ " detected on extruder " ^ param.D} ;M291 R"Filament Error" P{"Filament error type " ^ param.P ^ " detected on extruder " ^ param.D} S1 T3 var thisExtruderValue = move.extruders[tools[state.currentTool].filamentExtruder].position set global.filamentDistance = var.thisExtruderValue + var.runoutDistance echo "filament error detected - print will be paused after " ^ var.runoutDistance ^ "mm"
In daemon.g I have something like this extract
while true if (state.currentTool != -1) && (state.currentTool < #tools) if (move.extruders[tools[state.currentTool].filamentExtruder].position > global.filamentDistance) && (global.filamentDistance !=0) && (state.status = "processing") echo "paused called from daemon - filament runout" M25 ; pause print if filament has run out G4 S1
You will also need to reset the global to zero at the start and finish of prints, when a job is cancelled etc.
-
@OwenD said in Filament Runout Event:
You will also need to reset the global to zero at the start and finish of prints, when a job is cancelled etc.
so you mean set global.filamentDistance = 0 in the start gcode ?
it works also without a pi, correct ?
cuz first time i see the deamon.g -
@Lexan
I run in standalone, so no pi neededYou have to create daemon.g
-
@OwenD did you ever had this kind of error ?
Error: in file macro line 3 column 11: meta command: array index out of boundsi put the runoutDistance = 3500 in the filament-error.g
-
if !exists(global.filamentDistance)
global filamentDistance = <- is here missing a point after global ? -
@OwenD did you ever had this kind of error ?
Error: in file macro line 3 column 11: meta command: array index out of boundsThat error is likely line 3 of the daemon.g file.
I tried to set that up so it would cover almost any configuration but it's somehow pointing to a tool or sensor that doesn't exist.
If you only have one sensor and tool you can address them directly
Otherwise post your config.g so we can see how your printer is set up -
@Lexan said in Filament Runout Event:
if !exists(global.filamentDistance)
global filamentDistance = <- is here missing a point after global ?No
That line is saying if the global does NOT exist then create it
The next ELSE line will say
set global.filamentDistance =So if it DOES exist we reset it. If it DOESN'T. exist we create it.
This avoids error messages if you run M98 P"config.g" and ensures the global is created at startup -
@Lexan said in Filament Runout Event:
if !exists(global.filamentDistance)
global filamentDistance = <- is here missing a point after global ?Another possibility is that daemon.g is starting before the tools & monitors are defined
In your config.g put in a global to stop the daemon code executing
This will also help when you need to edit daemon.g
So at the start of config.gif !exists(global.runDaemon) global runDaemon = false else set global.runDaemon = false
Then at the start of daemon.g put
while true if global.runDaemon = false M99 ;rest of code
Edit
Forgot to say, at the end of config.g putset global.runDaemon=true
You will have to rename daemon.g before you can edit and save it, then rename it back again