3D printer filament runout issue

Hi, guys! I am new in this forum. In recent days, I am playing around with 3D printer (ramps 1.4+mega 2560). Until now, functions like print, auto-home, etc. have realized. But when there`s no filament, the printer still works until all the codes are finished. Yes, it is the Filament Runout issue.

For solving it, I changed some codes.


Configuration.h //========================= Filament Runout Sensor ========================== //===========================================================================

define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament

// In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made. // It is assumed that when logic high = filament available // when logic low = filament ran out

if ENABLED(FILAMENT_RUNOUT_SENSOR)

const bool FIL_RUNOUT_INVERTING = true; // Should be uncommented and true or false should assigned

define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.

define FILAMENT_RUNOUT_SCRIPT "M600"

endif

Configuration_adv.h Line 445

ifdef ULTIPANEL

define FILAMENTCHANGEENABLE

ifdef FILAMENTCHANGEENABLE

define FILAMENTCHANGE_XPOS 0 // Tries to move to this position - Sometimes it will be at a different position to clear print position.

define FILAMENTCHANGE_YPOS 0 // Tries to move to this position - Sometimes it will be at a different position to clear print position.

define FILAMENTCHANGE_ZADD 10 // Increases distance between printhead and Z print platform by this amount

define FILAMENTCHANGE_FIRSTRETRACT -4.5

//#define FILAMENTCHANGE_FINALRETRACT -100

endif

endif

Marlin_main.cpp void manage_inactivity(bool ignore_stepper_queue/=false/) function.

if HAS_FILRUNOUT

if (!(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING)) filrunout();

endif


Is there anyone faced this problem before? Welcom any kind of suggestion. Thank you!

I don't know if you are presenting a solution (if so, thank you) or asking for help. If you are asking for help what exactly is the problem.

In either case this is probably a subject that would be more at home on the RepRap Forum. Marlin is a very complex program and you need to find someone that understands it, or someone who needs your solution.

...R