diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index f4e989b2db..bdfb99446c 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h
index f4e989b2db..bdfb99446c 100644
--- a/Marlin/src/config/default/Configuration.h
+++ b/Marlin/src/config/default/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h
index ee7fbc4dd9..d8433f57f0 100644
--- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h
+++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h
@@ -1006,6 +1006,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h
index b4a49a3481..28b048ee7b 100644
--- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h
+++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Anet/A2/Configuration.h b/Marlin/src/config/examples/Anet/A2/Configuration.h
index 1977b27a34..b938765c30 100644
--- a/Marlin/src/config/examples/Anet/A2/Configuration.h
+++ b/Marlin/src/config/examples/Anet/A2/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration.h b/Marlin/src/config/examples/Anet/A2plus/Configuration.h
index 1a37daff21..aebaff1d9d 100644
--- a/Marlin/src/config/examples/Anet/A2plus/Configuration.h
+++ b/Marlin/src/config/examples/Anet/A2plus/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h
index eb75e70bb9..8848523ec8 100644
--- a/Marlin/src/config/examples/Anet/A6/Configuration.h
+++ b/Marlin/src/config/examples/Anet/A6/Configuration.h
@@ -1101,6 +1101,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h
index d01e51e7aa..ad5b725ccc 100644
--- a/Marlin/src/config/examples/Anet/A8/Configuration.h
+++ b/Marlin/src/config/examples/Anet/A8/Configuration.h
@@ -993,6 +993,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h
index 8eb76a5004..628b35460b 100644
--- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h
+++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h
index 6a2942ce6f..7510b7500d 100644
--- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h
+++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h
index 7a5401c4e8..00d1c34ea9 100644
--- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h
+++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h
index 4b823656ff..cbcea8178b 100644
--- a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h
+++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h
@@ -974,6 +974,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h
index 48969fc4a1..972afadfe9 100644
--- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h
+++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor.
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h
index 46b7d86d38..0eec5cdb31 100644
--- a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h
+++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h
@@ -974,6 +974,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Cartesio/Configuration.h b/Marlin/src/config/examples/Cartesio/Configuration.h
index abeb29606f..96259335d9 100644
--- a/Marlin/src/config/examples/Cartesio/Configuration.h
+++ b/Marlin/src/config/examples/Cartesio/Configuration.h
@@ -985,6 +985,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration.h b/Marlin/src/config/examples/Creality/CR-10/Configuration.h
index 4f695d52b8..69fa9dfc7c 100755
--- a/Marlin/src/config/examples/Creality/CR-10/Configuration.h
+++ b/Marlin/src/config/examples/Creality/CR-10/Configuration.h
@@ -996,6 +996,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h
index 40c12a4de9..d176b2c7fe 100644
--- a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h
+++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h
@@ -991,6 +991,18 @@
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
#define FIL_RUNOUT_PIN 2 // Creality CR10-S stock sensor
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h b/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h
index ecb3afd0a9..916ecad9a7 100644
--- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h
+++ b/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h
@@ -1005,6 +1005,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration.h b/Marlin/src/config/examples/Creality/CR-8/Configuration.h
index 8af5305688..522637a814 100644
--- a/Marlin/src/config/examples/Creality/CR-8/Configuration.h
+++ b/Marlin/src/config/examples/Creality/CR-8/Configuration.h
@@ -996,6 +996,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h b/Marlin/src/config/examples/Creality/Ender-2/Configuration.h
index a34fd95179..8d97099f4b 100644
--- a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h
+++ b/Marlin/src/config/examples/Creality/Ender-2/Configuration.h
@@ -990,6 +990,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h b/Marlin/src/config/examples/Creality/Ender-3/Configuration.h
index f884779021..6be61fad7c 100644
--- a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h
+++ b/Marlin/src/config/examples/Creality/Ender-3/Configuration.h
@@ -990,6 +990,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h b/Marlin/src/config/examples/Creality/Ender-4/Configuration.h
index e893b16ccd..1f02233c6a 100644
--- a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h
+++ b/Marlin/src/config/examples/Creality/Ender-4/Configuration.h
@@ -996,6 +996,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Einstart-S/Configuration.h b/Marlin/src/config/examples/Einstart-S/Configuration.h
index 322194a83f..c0c66e8c19 100644
--- a/Marlin/src/config/examples/Einstart-S/Configuration.h
+++ b/Marlin/src/config/examples/Einstart-S/Configuration.h
@@ -996,6 +996,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Felix/Configuration.h b/Marlin/src/config/examples/Felix/Configuration.h
index 6be1a79d4e..89505e1a92 100644
--- a/Marlin/src/config/examples/Felix/Configuration.h
+++ b/Marlin/src/config/examples/Felix/Configuration.h
@@ -968,6 +968,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Felix/DUAL/Configuration.h b/Marlin/src/config/examples/Felix/DUAL/Configuration.h
index 2812b4296e..8e1d2c4418 100644
--- a/Marlin/src/config/examples/Felix/DUAL/Configuration.h
+++ b/Marlin/src/config/examples/Felix/DUAL/Configuration.h
@@ -968,6 +968,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h
index 78ad6d5fd1..71def1900b 100644
--- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h
+++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h
@@ -992,6 +992,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration.h b/Marlin/src/config/examples/Formbot/Raptor/Configuration.h
index e2d4bec71d..9d8d665f7b 100644
--- a/Marlin/src/config/examples/Formbot/Raptor/Configuration.h
+++ b/Marlin/src/config/examples/Formbot/Raptor/Configuration.h
@@ -1085,6 +1085,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h
index 462d606f10..d987247f17 100644
--- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h
+++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h
@@ -1028,6 +1028,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h
index 0b02fe9ad0..ff4c3eb2da 100644
--- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h
+++ b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h
@@ -1016,6 +1016,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h
index a9f48f15b1..e7e3def6ac 100644
--- a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h
+++ b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h
@@ -1001,6 +1001,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h
index 40c6f8c740..f280f59fad 100644
--- a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h
+++ b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h
index ea0d0dbfcd..d88b12af44 100644
--- a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h
+++ b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h
@@ -993,6 +993,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h
index 7a9318174e..d389db651d 100644
--- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h
+++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h
@@ -1002,6 +1002,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h
index d6b66544cb..9886496b01 100644
--- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h
+++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h
@@ -1001,6 +1001,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h
index 10fae0bd32..e1b00990b1 100644
--- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h
+++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h
index 9be0b33fde..b47cfd3f08 100644
--- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h
+++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h
index 52469b4ac7..8225888494 100644
--- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h
+++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h
@@ -990,6 +990,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration.h b/Marlin/src/config/examples/JGAurora/A5/Configuration.h
index 2ecae51617..daf8e307ef 100644
--- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h
+++ b/Marlin/src/config/examples/JGAurora/A5/Configuration.h
@@ -998,6 +998,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/MakerParts/Configuration.h b/Marlin/src/config/examples/MakerParts/Configuration.h
index 8ca0b1eb0e..845edbf43b 100644
--- a/Marlin/src/config/examples/MakerParts/Configuration.h
+++ b/Marlin/src/config/examples/MakerParts/Configuration.h
@@ -1006,6 +1006,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration.h b/Marlin/src/config/examples/Malyan/M150/Configuration.h
index 40e5c63229..2eed7cb804 100644
--- a/Marlin/src/config/examples/Malyan/M150/Configuration.h
+++ b/Marlin/src/config/examples/Malyan/M150/Configuration.h
@@ -1010,6 +1010,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration.h b/Marlin/src/config/examples/Malyan/M200/Configuration.h
index 701f4c6181..0f382f6bd9 100644
--- a/Marlin/src/config/examples/Malyan/M200/Configuration.h
+++ b/Marlin/src/config/examples/Malyan/M200/Configuration.h
@@ -985,6 +985,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h
index d5339693b9..6d8264315a 100644
--- a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h
+++ b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h
@@ -990,6 +990,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h
index 3ae5a76703..0de2b02554 100644
--- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h
+++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h
@@ -990,6 +990,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration.h b/Marlin/src/config/examples/Mks/Sbase/Configuration.h
index a862786d5a..f72b8d86f1 100644
--- a/Marlin/src/config/examples/Mks/Sbase/Configuration.h
+++ b/Marlin/src/config/examples/Mks/Sbase/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h b/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h
index b9feed52a0..39d5647f61 100644
--- a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h
+++ b/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h
@@ -1035,6 +1035,18 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h
index d83f97338a..3285893547 100644
--- a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h
+++ b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h
index e7fa3ecf32..79e13ecc5b 100644
--- a/Marlin/src/config/examples/RigidBot/Configuration.h
+++ b/Marlin/src/config/examples/RigidBot/Configuration.h
@@ -984,6 +984,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/SCARA/Configuration.h b/Marlin/src/config/examples/SCARA/Configuration.h
index acc277c1c0..26e815ee3c 100644
--- a/Marlin/src/config/examples/SCARA/Configuration.h
+++ b/Marlin/src/config/examples/SCARA/Configuration.h
@@ -999,6 +999,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/STM32F10/Configuration.h b/Marlin/src/config/examples/STM32F10/Configuration.h
index 43ba32f6d7..31cebd2c68 100644
--- a/Marlin/src/config/examples/STM32F10/Configuration.h
+++ b/Marlin/src/config/examples/STM32F10/Configuration.h
@@ -988,6 +988,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/STM32F4/Configuration.h b/Marlin/src/config/examples/STM32F4/Configuration.h
index ca57f25634..bf06093ce9 100644
--- a/Marlin/src/config/examples/STM32F4/Configuration.h
+++ b/Marlin/src/config/examples/STM32F4/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration.h b/Marlin/src/config/examples/Sanguinololu/Configuration.h
index e256fb524b..51757e2519 100644
--- a/Marlin/src/config/examples/Sanguinololu/Configuration.h
+++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h
@@ -1017,6 +1017,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/TheBorg/Configuration.h b/Marlin/src/config/examples/TheBorg/Configuration.h
index 1fa6fe8a30..d9ff574a77 100644
--- a/Marlin/src/config/examples/TheBorg/Configuration.h
+++ b/Marlin/src/config/examples/TheBorg/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration.h b/Marlin/src/config/examples/TinyBoy2/Configuration.h
index 7a60dee6a9..b5fccd4758 100644
--- a/Marlin/src/config/examples/TinyBoy2/Configuration.h
+++ b/Marlin/src/config/examples/TinyBoy2/Configuration.h
@@ -1042,6 +1042,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Tronxy/X1/Configuration.h b/Marlin/src/config/examples/Tronxy/X1/Configuration.h
index e4520e4f6a..79ce6dce87 100644
--- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h
+++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration.h b/Marlin/src/config/examples/Tronxy/X3A/Configuration.h
index a53fcf7f23..9eccfe4c9b 100644
--- a/Marlin/src/config/examples/Tronxy/X3A/Configuration.h
+++ b/Marlin/src/config/examples/Tronxy/X3A/Configuration.h
@@ -990,6 +990,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h
index 1a665ff843..78e0618f06 100644
--- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h
+++ b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h b/Marlin/src/config/examples/Tronxy/XY100/Configuration.h
index aed251c1cd..8661c2dfb4 100644
--- a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h
+++ b/Marlin/src/config/examples/Tronxy/XY100/Configuration.h
@@ -997,6 +997,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h
index 242f5ebf70..7c1c142635 100644
--- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h
+++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h
index f13b731504..83b7838c92 100644
--- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h
+++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h
@@ -1016,6 +1016,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Configuration.h
index f3765aaeb8..62e57049f9 100644
--- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h
+++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h
index e2c1534e8c..e5c66c559a 100644
--- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h
+++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h
index 592897d2f9..2c88ef942d 100644
--- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h
+++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h
@@ -996,6 +996,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h
index 57a5f71b4c..453a86055c 100644
--- a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h
+++ b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h
@@ -986,6 +986,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h
index ddeda85edf..626ce0b858 100644
--- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h
+++ b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h
@@ -1177,6 +1177,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h
index b35c19265f..e914d78462 100644
--- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h
+++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h
@@ -1114,6 +1114,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h
index 5234148249..e0e1237257 100644
--- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h
+++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h
@@ -1113,6 +1113,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h
index 3d69cd0211..74e560665a 100644
--- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h
+++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h
@@ -1113,6 +1113,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h b/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h
index bb60fafb50..869a0be995 100644
--- a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h
+++ b/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h
@@ -1116,6 +1116,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/generic/Configuration.h b/Marlin/src/config/examples/delta/generic/Configuration.h
index eac171f1ef..0b64ae6a68 100644
--- a/Marlin/src/config/examples/delta/generic/Configuration.h
+++ b/Marlin/src/config/examples/delta/generic/Configuration.h
@@ -1101,6 +1101,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h
index 0405b0952a..02a881f4f0 100644
--- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h
+++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h
@@ -1103,6 +1103,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h
index cf697634ea..1bb660bc22 100644
--- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h
+++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h
@@ -1104,6 +1104,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h
index 41ecae5b4a..918d9569cb 100644
--- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h
+++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h
@@ -1104,6 +1104,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h
index 0caab0540b..fa448ca9f4 100644
--- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h
+++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h
@@ -1000,6 +1000,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/Marlin/src/config/examples/makibox/Configuration.h
index 3215dc8da9..74beffcb47 100644
--- a/Marlin/src/config/examples/makibox/Configuration.h
+++ b/Marlin/src/config/examples/makibox/Configuration.h
@@ -989,6 +989,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/stm32f103ret6/Configuration.h b/Marlin/src/config/examples/stm32f103ret6/Configuration.h
index 7530b33093..174d59e422 100644
--- a/Marlin/src/config/examples/stm32f103ret6/Configuration.h
+++ b/Marlin/src/config/examples/stm32f103ret6/Configuration.h
@@ -988,6 +988,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h
index 9ac2a12423..74c3f338dd 100644
--- a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h
+++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h
@@ -981,6 +981,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/config/examples/wt150/Configuration.h b/Marlin/src/config/examples/wt150/Configuration.h
index 1972f02f79..2101b8fd5f 100644
--- a/Marlin/src/config/examples/wt150/Configuration.h
+++ b/Marlin/src/config/examples/wt150/Configuration.h
@@ -991,6 +991,18 @@
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
#define FILAMENT_RUNOUT_SCRIPT "M600"
+
+ // After a runout is detected, continue printing this length of filament
+ // before executing the runout script. Useful for a sensor at the end of
+ // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
+ //#define FILAMENT_RUNOUT_DISTANCE_MM 25
+
+ #ifdef FILAMENT_RUNOUT_DISTANCE_MM
+ // Enable this option to use an encoder disc that toggles the runout pin
+ // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
+ // large enough to avoid false positives.)
+ //#define FILAMENT_MOTION_SENSOR
+ #endif
#endif
//===========================================================================
diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp
index 7e3301e5bd..a51cf5b9e8 100644
--- a/Marlin/src/feature/runout.cpp
+++ b/Marlin/src/feature/runout.cpp
@@ -32,36 +32,21 @@
FilamentRunoutSensor runout;
-bool FilamentRunoutSensor::enabled = true,
- FilamentRunoutSensor::filament_ran_out; // = false
-uint8_t FilamentRunoutSensor::runout_count; // = 0
+bool FilamentSensorBase::enabled = true,
+ FilamentSensorBase::filament_ran_out; // = false
-void FilamentRunoutSensor::setup() {
-
- #if ENABLED(FIL_RUNOUT_PULLUP)
- #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P)
- #elif ENABLED(FIL_RUNOUT_PULLDOWN)
- #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P)
- #else
- #define INIT_RUNOUT_PIN(P) SET_INPUT(P)
- #endif
-
- INIT_RUNOUT_PIN(FIL_RUNOUT_PIN);
- #if NUM_RUNOUT_SENSORS > 1
- INIT_RUNOUT_PIN(FIL_RUNOUT2_PIN);
- #if NUM_RUNOUT_SENSORS > 2
- INIT_RUNOUT_PIN(FIL_RUNOUT3_PIN);
- #if NUM_RUNOUT_SENSORS > 3
- INIT_RUNOUT_PIN(FIL_RUNOUT4_PIN);
- #if NUM_RUNOUT_SENSORS > 4
- INIT_RUNOUT_PIN(FIL_RUNOUT5_PIN);
- #if NUM_RUNOUT_SENSORS > 5
- INIT_RUNOUT_PIN(FIL_RUNOUT6_PIN);
- #endif
- #endif
- #endif
- #endif
- #endif
+void FilamentSensorTypeBase::filament_present(const uint8_t extruder) {
+ runout.filament_present(extruder);
}
+uint8_t FilamentSensorTypeEncoder::motion_detected,
+ FilamentSensorTypeEncoder::old_state; // = 0
+
+#if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
+ int32_t RunoutResponseDelayed::steps_since_detection[EXTRUDERS];
+#else
+ uint8_t RunoutResponseDebounced::runout_count; // = 0
+#endif
+
#endif // FILAMENT_RUNOUT_SENSOR
diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h
index 500013c9c7..415dd4badc 100644
--- a/Marlin/src/feature/runout.h
+++ b/Marlin/src/feature/runout.h
@@ -19,14 +19,12 @@
* along with this program. If not, see .
*
*/
+#pragma once
/**
* feature/runout.h - Runout sensor support
*/
-#ifndef _RUNOUT_H_
-#define _RUNOUT_H_
-
#include "../sd/cardreader.h"
#include "../module/printcounter.h"
#include "../module/stepper.h"
@@ -38,70 +36,268 @@
#include "../lcd/extensible_ui/ui_api.h"
#endif
-#define FIL_RUNOUT_THRESHOLD 5
+//#define FILAMENT_RUNOUT_SENSOR_DEBUG
-class FilamentRunoutSensor {
+class FilamentSensorBase {
public:
static bool enabled;
- FilamentRunoutSensor() {}
-
- static void setup();
-
- FORCE_INLINE static void reset() { runout_count = 0; filament_ran_out = false; }
-
- FORCE_INLINE static void run() {
- if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
- filament_ran_out = true;
- #if ENABLED(EXTENSIBLE_UI)
- UI::onFilamentRunout();
- #endif
- enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
- planner.synchronize();
- }
- }
- private:
+ protected:
static bool filament_ran_out;
- static uint8_t runout_count;
+};
- FORCE_INLINE static bool check() {
- if (!enabled) return false;
- #if NUM_RUNOUT_SENSORS < 2
- // A single sensor applying to all extruders
- const bool is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;
- #else
- // Read the sensor for the active extruder
- bool is_out;
- #if ENABLED(DUAL_X_CARRIAGE)
- const bool out1 = READ(FIL_RUNOUT_PIN ) == FIL_RUNOUT_INVERTING,
- out2 = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING;
- if (extruder_duplication_enabled)
- is_out = out1 || out2;
- else
- is_out = active_extruder ? out2 : out1;
- #else
- switch (active_extruder) {
- case 0: is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; break;
- case 1: is_out = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; break;
- #if NUM_RUNOUT_SENSORS > 2
- case 2: is_out = READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING; break;
- #if NUM_RUNOUT_SENSORS > 3
- case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break;
- #if NUM_RUNOUT_SENSORS > 4
- case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
- #if NUM_RUNOUT_SENSORS > 5
- case 5: is_out = READ(FIL_RUNOUT6_PIN) == FIL_RUNOUT_INVERTING; break;
- #endif // > 5
- #endif // > 4
- #endif // > 3
- #endif // > 2
+template
+class TFilamentSensor : public FilamentSensorBase {
+ private:
+ typedef RESPONSE_T response_t;
+ typedef SENSOR_T sensor_t;
+ static response_t response;
+ static sensor_t sensor;
+
+ public:
+ static void setup() {
+ sensor.setup();
+ }
+
+ inline static void reset() {
+ filament_ran_out = false;
+ response.reset();
+ }
+
+ // The sensor calls this method when filament is present
+ inline static void filament_present(const uint8_t extruder) {
+ response.filament_present(extruder);
+ }
+
+ inline static void block_complete(const block_t *b) {
+ response.block_complete(b);
+ sensor.block_complete(b);
+ }
+
+ static void run() {
+ if (enabled && !filament_ran_out && (IS_SD_PRINTING || print_job_timer.isRunning())) {
+ response.run();
+ sensor.run();
+ if (response.has_runout()) {
+ filament_ran_out = true;
+ #if ENABLED(EXTENSIBLE_UI)
+ UI::onFilamentRunout();
+ #endif
+ enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
+ planner.synchronize();
}
- #endif
- #endif
- return (is_out ? ++runout_count : (runout_count = 0)) > FIL_RUNOUT_THRESHOLD;
+ }
}
};
-extern FilamentRunoutSensor runout;
+/*************************** FILAMENT PRESENCE SENSORS ***************************/
-#endif // _RUNOUT_H_
+class FilamentSensorTypeBase {
+ protected:
+ static void filament_present(const uint8_t extruder);
+
+ public:
+ static void setup() {
+ #if ENABLED(FIL_RUNOUT_PULLUP)
+ #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P)
+ #elif ENABLED(FIL_RUNOUT_PULLDOWN)
+ #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P)
+ #else
+ #define INIT_RUNOUT_PIN(P) SET_INPUT(P)
+ #endif
+
+ INIT_RUNOUT_PIN(FIL_RUNOUT_PIN);
+ #if NUM_RUNOUT_SENSORS > 1
+ INIT_RUNOUT_PIN(FIL_RUNOUT2_PIN);
+ #if NUM_RUNOUT_SENSORS > 2
+ INIT_RUNOUT_PIN(FIL_RUNOUT3_PIN);
+ #if NUM_RUNOUT_SENSORS > 3
+ INIT_RUNOUT_PIN(FIL_RUNOUT4_PIN);
+ #if NUM_RUNOUT_SENSORS > 4
+ INIT_RUNOUT_PIN(FIL_RUNOUT5_PIN);
+ #if NUM_RUNOUT_SENSORS > 5
+ INIT_RUNOUT_PIN(FIL_RUNOUT6_PIN);
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ }
+
+ #if FIL_RUNOUT_INVERTING
+ #define FIL_RUNOUT_INVERT_MASK (_BV(NUM_RUNOUT_SENSORS) - 1)
+ #else
+ #define FIL_RUNOUT_INVERT_MASK 0
+ #endif
+
+ // Return a bitmask of all runout sensor states
+ static uint8_t poll_runout_pins() {
+ return (
+ (READ(FIL_RUNOUT_PIN ) ? _BV(0) : 0)
+ #if NUM_RUNOUT_SENSORS > 1
+ | (READ(FIL_RUNOUT2_PIN) ? _BV(1) : 0)
+ #if NUM_RUNOUT_SENSORS > 2
+ | (READ(FIL_RUNOUT3_PIN) ? _BV(2) : 0)
+ #if NUM_RUNOUT_SENSORS > 3
+ | (READ(FIL_RUNOUT4_PIN) ? _BV(3) : 0)
+ #if NUM_RUNOUT_SENSORS > 4
+ | (READ(FIL_RUNOUT5_PIN) ? _BV(4) : 0)
+ #if NUM_RUNOUT_SENSORS > 5
+ | (READ(FIL_RUNOUT6_PIN) ? _BV(5) : 0)
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ ) ^ FIL_RUNOUT_INVERT_MASK;
+ }
+};
+
+/**
+ * This sensor is a simple endstop
+ * switch in the path of the filament. It detects
+ * filament runout, but not stripouts or jams.
+ */
+
+class FilamentSensorTypeSwitch : public FilamentSensorTypeBase {
+ private:
+ static bool poll_runout_pin(const uint8_t extruder) {
+ const uint8_t runout_bits = poll_runout_pins();
+ #if NUM_RUNOUT_SENSORS == 1
+ return runout_bits; // A single sensor applying to all extruders
+ #else
+ #if ENABLED(DUAL_X_CARRIAGE)
+ if (extruder_duplication_enabled)
+ return runout_bits; // Any extruder
+ else
+ #endif
+ return TEST(runout_bits, extruder); // Specific extruder
+ #endif
+ }
+
+ public:
+ FORCE_INLINE static void block_complete(const block_t *b) {}
+
+ FORCE_INLINE static void run() {
+ if (!poll_runout_pin(active_extruder))
+ filament_present(active_extruder);
+ }
+};
+
+// This filament sensor uses a magnetic encoder disc and a hall
+// effect sensor (or a slitted disc and an optical sensor). The state
+// will toggle between 0 and 1 with filament movement. It can detect
+// filament runout and stripouts or jams.
+
+class FilamentSensorTypeEncoder : public FilamentSensorTypeBase {
+ private:
+ static uint8_t motion_detected, old_state;
+
+ static void poll_motion_sensor() {
+ const uint8_t new_state = poll_runout_pins(),
+ change = old_state ^ new_state;
+ old_state = new_state;
+
+ #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
+ if (change) SERIAL_PROTOCOLLNPAIR("motion detected: ", change);
+ #endif
+
+ motion_detected |= change;
+ }
+
+ public:
+ static void block_complete(const block_t *b) {
+ // If the just-executed block caused the sensor wheel
+ // to turn, reset the runout counter for that extruder.
+ if (TEST(motion_detected, b->extruder))
+ filament_present(b->extruder);
+
+ // Clear motion triggers for next block
+ motion_detected = 0;
+ }
+
+ FORCE_INLINE static void run() { poll_motion_sensor(); }
+};
+
+/********************************* RESPONSE TYPE *********************************/
+
+#if FILAMENT_RUNOUT_DISTANCE_MM > 0
+
+ // The RunoutResponseDelayed will trigger an runout event only after
+ // RUNOUT_DISTANCE_MM of filament have been fed after a runout condition.
+ class RunoutResponseDelayed {
+ private:
+ static int32_t steps_since_detection[EXTRUDERS];
+
+ static float get_mm_since_runout(const uint8_t extruder) {
+ return (steps_since_detection[extruder] / planner.settings.axis_steps_per_mm[E_AXIS_N(extruder)]);
+ }
+
+ public:
+ static float runout_distance_mm;
+
+ FORCE_INLINE static bool has_runout() {
+ return get_mm_since_runout(active_extruder) > runout_distance_mm;
+ }
+
+ static inline void filament_present(const uint8_t extruder) {
+ steps_since_detection[extruder] = 0;
+ }
+
+ static inline void run() {
+ #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
+ static uint16_t r = 0;
+ if ((r++ % 24000) == 0) {
+ SERIAL_PROTOCOLPGM("mm since filament detection: ");
+ LOOP_L_N(i, NUM_RUNOUT_SENSORS) {
+ if (i > 0) SERIAL_PROTOCOLPGM(", ");
+ SERIAL_PROTOCOL(get_mm_since_runout(i));
+ }
+ SERIAL_EOL();
+ }
+ #endif
+ }
+
+ static void reset() {
+ LOOP_L_N(i, NUM_RUNOUT_SENSORS) steps_since_detection[i] = 0;
+ }
+
+ static inline void block_complete(const block_t *b) {
+ steps_since_detection[b->extruder] += TEST(b->direction_bits, E_AXIS) ? -b->steps[E_AXIS] : b->steps[E_AXIS];
+ }
+ };
+
+#else // !FILAMENT_RUNOUT_DISTANCE_MM
+
+ // The RunoutResponseDebounced will trigger an runout event after
+ // a runout condition is detected FIL_RUNOUT_THRESHOLD times in a row.
+
+ class RunoutResponseDebounced {
+ private:
+ static constexpr uint8_t FIL_RUNOUT_THRESHOLD = 5;
+ static uint8_t runout_count;
+ public:
+ FORCE_INLINE static bool has_runout() { return runout_count > FIL_RUNOUT_THRESHOLD; }
+ FORCE_INLINE static void block_complete(const block_t *b) {}
+ FORCE_INLINE static void filament_present(const uint8_t extruder) { runout_count = 0; UNUSED(extruder); }
+ FORCE_INLINE static void run() { runout_count++; }
+ FORCE_INLINE static void reset() { runout_count = 0; }
+ };
+
+#endif // !FILAMENT_RUNOUT_DISTANCE_MM
+
+/********************************* TEMPLATE SPECIALIZATION *********************************/
+
+typedef TFilamentSensor<
+ #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #if ENABLED(FILAMENT_MOTION_SENSOR)
+ RunoutResponseDelayed, FilamentSensorTypeEncoder
+ #else
+ RunoutResponseDelayed, FilamentSensorTypeSwitch
+ #endif
+ #else
+ RunoutResponseDebounced, FilamentSensorTypeSwitch
+ #endif
+> FilamentRunoutSensor;
+
+extern FilamentRunoutSensor runout;
diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp
index 61eff88480..cb39c6b0a3 100644
--- a/Marlin/src/lcd/extensible_ui/ui_api.cpp
+++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp
@@ -53,6 +53,10 @@
#endif
#endif
+#if ENABLED(FILAMENT_RUNOUT_SENSOR)
+ #include "../../feature/runout.h"
+#endif
+
inline float clamp(const float value, const float minimum, const float maximum) {
return MAX(MIN(value, maximum), minimum);
}
@@ -209,6 +213,21 @@ namespace UI {
}
}
+ #if ENABLED(FILAMENT_RUNOUT_SENSOR)
+ bool isFilamentRunoutEnabled() { return runout.enabled; }
+ void toggleFilamentRunout(const bool state) { runout.enabled = state; }
+
+ #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ float getFilamentRunoutDistance_mm() {
+ return RunoutResponseDelayed::runout_distance_mm;
+ }
+
+ void setFilamentRunoutDistance_mm(const float distance) {
+ RunoutResponseDelayed::runout_distance_mm = clamp(distance, 0, 999);
+ }
+ #endif
+ #endif
+
#if ENABLED(LIN_ADVANCE)
float getLinearAdvance_mm_mm_s(const uint8_t extruder) {
return (extruder < EXTRUDERS) ? planner.extruder_advance_K[extruder] : 0;
diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h
index 482c6df1e0..34e2ea75bd 100644
--- a/Marlin/src/lcd/extensible_ui/ui_api.h
+++ b/Marlin/src/lcd/extensible_ui/ui_api.h
@@ -109,6 +109,16 @@ namespace UI {
#endif
#endif
+ #if ENABLED(FILAMENT_RUNOUT_SENSOR)
+ bool isFilamentRunoutEnabled();
+ void toggleFilamentRunout(const bool state);
+
+ #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ float getFilamentRunoutDistance_mm();
+ void setFilamentRunoutDistance_mm(const float distance);
+ #endif
+ #endif
+
void delay_ms(unsigned long ms);
void yield(); // Within lengthy loop, call this periodically
diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h
index 791ebe31f3..8cf37f0758 100644
--- a/Marlin/src/module/planner.h
+++ b/Marlin/src/module/planner.h
@@ -83,7 +83,7 @@ enum BlockFlag : char {
* The "nominal" values are as-specified by gcode, and
* may never actually be reached due to acceleration limits.
*/
-typedef struct {
+typedef struct block_t {
volatile uint8_t flag; // Block flags (See BlockFlag enum above) - Modified by ISR and main thread!
@@ -109,6 +109,8 @@ typedef struct {
#if EXTRUDERS > 1
uint8_t extruder; // The extruder to move (if E move)
+ #else
+ static constexpr uint8_t extruder = 0;
#endif
#if ENABLED(MIXING_EXTRUDER)
diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp
index a49b6173fc..9ec5d6804a 100644
--- a/Marlin/src/module/stepper.cpp
+++ b/Marlin/src/module/stepper.cpp
@@ -109,6 +109,10 @@
Stepper stepper; // Singleton
+#if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ #include "../feature/runout.h"
+#endif
+
// public:
#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
@@ -1473,6 +1477,9 @@ uint32_t Stepper::stepper_block_phase_isr() {
// If current block is finished, reset pointer
if (step_events_completed >= step_event_count) {
+ #if FILAMENT_RUNOUT_DISTANCE_MM > 0
+ runout.block_complete(current_block);
+ #endif
axis_did_move = 0;
current_block = NULL;
planner.discard_current_block();
diff --git a/buildroot/share/tests/megaatmega2560_tests b/buildroot/share/tests/megaatmega2560_tests
index f028e6c269..601c37ce58 100755
--- a/buildroot/share/tests/megaatmega2560_tests
+++ b/buildroot/share/tests/megaatmega2560_tests
@@ -32,7 +32,7 @@ opt_set GRID_MAX_POINTS_X 16
opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING \
REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS PINS_DEBUGGING \
BLINKM PCA9632 RGB_LED NEOPIXEL_LED AUTO_POWER_CONTROL \
- NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR \
+ NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \
AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE
opt_enable_adv FWRETRACT ARC_P_CIRCLES ADVANCED_PAUSE_FEATURE CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \