3D printer G-code · Marlin

M412: Filament runout sensor (Marlin)

Filament runout sensor — Turns the filament runout sensor on or off. When the sensor triggers, Marlin runs the runout script (usually M600).

By cnccode · Updated
On this page
  1. What does M412 do?
  2. Parameters
  3. Example
  4. Related commands
  5. More print control commands
  6. Frequently asked questions
PropertyValue
CommandM412
FunctionFilament runout sensor
FirmwareMarlin
GroupPrint control
SyntaxM412 S<0|1>

What does M412 do?

Turns the filament runout sensor on or off. When the sensor triggers, Marlin runs the runout script (usually M600).

Parameters

ParameterMeaning
S1 on, 0 off
DRunout distance in mm before the change starts

Example

G-code
M412 S1
M500

Marlin. Many Marlin commands only exist when the feature is enabled in the firmware build. If the printer answers "Unknown command", the feature is missing. Klipper does not understand most of these settings codes; it uses printer.cfg instead.

More print control commands

CommandFunctionFirmware
M220Speed factorMarlin and Klipper
M600Filament changeMarlin
M413Power-loss recoveryMarlin
M84Disable motors (M84 / M18)Marlin and Klipper
M400Finish movesMarlin and Klipper
M112Emergency stopMarlin and Klipper
M25Pause SD print (M25 / M24)Marlin
EXCLUDE_OBJECTCancel one objectKlipper
PAUSEPause, resume, cancelKlipper

Test it before you print

Paste your start code or a whole file into the 3D printer simulator. It plans every move, shows the time and finds missing waits, cold extrusion and moves outside the bed.

Open the simulator

Frequently asked questions

What does M412 do on a 3D printer?
M412 is filament runout sensor. Turns the filament runout sensor on or off. When the sensor triggers, Marlin runs the runout script (usually M600).
Does M412 work in Klipper and Marlin?
M412 is a Marlin command. Klipper uses its own commands and printer.cfg settings for this task.
Was this page helpful?