Filament Outage and Blockage Function Configuration
Open the Marlin configuration file Configuration.h, find #define FILAMENT_RUNOUT_SENSOR, and remove the comment symbol in front of it.
Find #define FILAMENT_RUNOUT_DISTANCE_MM, remove the comment symbol in front of it, and set it to 3.5 (adjust according to the encoder used; if false triggering occurs, increase this value appropriately).
Find #define FILAMENT_MOTION_SENSOR, and remove the comment symbol in front of it.
The filament sensor function of Marlin also requires enabling #define NOZZLE_PARK_FEATURE and #define ADVANCED_PAUSE_FEATURE. Remove the comments and configure specific parameters based on your printer settings.