---
tag: m0412
title: Filament Runout
brief: Set/report filament runout detection parameters
author: thinkyhead

group: control
since: 2.0.0
requires: FILAMENT_RUNOUT_SENSOR
eeprom: true

codes: [ M412 ]

parameters:

- tag: D
  requires: FILAMENT_RUNOUT_DISTANCE_MM
  optional: true
  description: For a filament sensor located in front of the extruder gears, set the distance from the runout sensor to the extruder gears. This length of filament will continue to extrude after a runout has been detected.
  values:
  - type: float
    tag: linear

- tag: H
  requires: HOST_ACTION_COMMANDS
  optional: true
  description: Flag to enable or disable host handling of a filament runout.
  values:
  - type: bool

- tag: L
  requires: FILAMENT_SWITCH_AND_MOTION
  since: 2.1.3
  optional: true
  description: Set the motion sensor runout length. If the sensor accumulates this amount of missing motion it triggers a runout right away and does not continue to extrude `FILAMENT_RUNOUT_DISTANCE_MM`.
  values:
  - type: float
    tag: linear

- tag: S
  optional: true
  description: Flag to enable or disable Filament Runout Detection. If omitted, the current enabled state will be reported.
  values:
  - type: bool

- tag: R
  optional: true
  description: Flag to reset the filament runout sensor. Not needed with `S`.
  values:
  - type: bool

examples:

- pre: Enable (and reset) filament runout detection
  code: M412 S1

- pre: Disable filament runout detection
  code: M412 S0

- pre: Report filament runout state
  code: |
    > M412
    Filament runout ON

- pre: Set filament runout distance
  post: Requires `FILAMENT_RUNOUT_DISTANCE_MM`
  code: |
    > M412 D35
    > M412
    Filament runout ON ; Distance 35mm

---

Set/report filament runout status and distance. Omit all parameters to get a report of the current stats. Enable or disable filament runout detection with `S` and set post-runout extrusion length with `D`. When filament sensors are enabled, Marlin will respond to a filament runout by running the configured G-code (usually [`M600` Filament Change](/docs/gcode/M600.html)). When filament runout detection is disabled, Marlin will take no action for filament runout.
