Quote Originally Posted by revwarguy View Post
Hi Roxy,
Hi! I got your posts approved!

Quote Originally Posted by revwarguy View Post
I was thinking of doing something along these lines, but using Y_MIN on a switch to detect filament being out, i.e., TRIGGERED if filament present, if OPEN filament is out. Then, when you run out of filament, it executes an M600.

To do this, would you place a check for Y_MIN at the top of the marlin_main.cpp loop, and if OPEN try to jump to the M600 code somehow? Would it be best to remove the M600 code to a routine that could be called by both the trigger and the main case code?
I believe the main line Marlin code at GitHub has the logic to handle a filament check now. But it might be tied to having an LCD Panel. I don't know. I haven't looked at that. But to your question, Yes, the check would have to be in the main loop somewhere. That is the only higher level piece of code that is always running.

This is a bit of hack... But it is how the LCD Panels do their work. When you see the filament run out, you could use the function:

bool enquecommand(const char *cmd)

in Marlin_main.cpp to put a M600 into the buffer and then just return back to the main loop. The main loop would think the M600 command was part of the .GCODE file that it was processing. It would blindly do as told and do a filament change.