---
tag: m0413
title: Power-loss Recovery
brief: Enable/disable power-loss recovery
author: thinkyhead

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

codes: [ M413 ]

notes:
- Requires `POWER_LOSS_RECOVERY` and an LCD controller.
- Requires printing from the SD Card or Flash Drive.
- A future implementation may use the EEPROM instead of the attached media.

parameters:
- tag: S
  optional: true
  description: Flag to enable or disable Power-loss Recovery. If omitted, the current enabled state will be reported.
  values:
  - type: bool

examples:
- pre: Enable power-loss recovery
  code: M413 S1
- pre: Disable power-loss recovery
  code: M413 S0
- pre: Report power-loss recovery state
  code:
  - M413
  - Power-loss recovery ON

---

`M413` is used to turn the **Power-loss Recovery** feature on and off. When Power-loss Recovery is enabled and Marlin is running a print job from the SD Card or Flash Drive, it periodically saves the print job state to the SD Card / Flash Drive. If the machine crashes or a power outage occurs, Marlin presents the option to resume the interrupted print job.

This feature is able to operate without a power-loss detection circuit by writing the recovery file periodically (_e.g.,_ once per layer). However, with a `POWER_LOSS_PIN` Marlin only writes the recovery info when a power-loss is actually detected. This method is preferred because the print will be resumed exactly where it was interrupted (rather than repeating the last layer), and the SD card or Flash Drive will incur much less wear.
