From 013a09dbe632fad0b6342a43fdc1dec59e53b2c2 Mon Sep 17 00:00:00 2001
From: paclema <paclema@gmail.com>
Date: Wed, 29 Apr 2015 21:38:40 +0200
Subject: [PATCH] Added configurable script for filrunout form configuration.h

---
 Marlin/Configuration.h | 7 +++++--
 Marlin/Marlin_main.cpp | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 455e46a195..ce5933319b 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -417,8 +417,11 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
                                  // 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
-//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.
+#ifdef 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 
 
 //===========================================================================
 //============================ Mesh Bed Leveling ============================
diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 996bd60b91..4f12d6498c 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -6140,10 +6140,10 @@ void kill()
   void filrunout() {
     if (!filrunoutEnqueued) {
       filrunoutEnqueued = true;
-      enqueuecommand("M600");
+      enqueuecommands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
+      st_synchronize();
     }
   }
-
 #endif
 
 void Stop() {
-- 
GitLab