---
tag: m0540
title: Endstops Abort SD
brief: Abort SD printing when an endstop is triggered.
author: thinkyhead

requires: SDSUPPORT,SD_ABORT_ON_ENDSTOP_HIT
group: sdcard

codes: [ M540 ]

notes:
  - Requires `SDSUPPORT` and `SD_ABORT_ON_ENDSTOP_HIT`.
  - Use `ENDSTOPS_ALWAYS_ON_DEFAULT` or [`M120`](/docs/gcode/M120.html) to ensure that endstops are enabled.

parameters:
  -
    tag: S
    optional: false
    description: Whether (1) or not (0) to abort SD printing on endstop hit.
    values:
      -
        tag: flag
        type: bool

examples:

---

Set whether SD printing should abort in the event of any endstop being triggered. This provides a fast way to abort a print in the event of mechanical failure such as loose couplings, lost steps, diverted axes, binding, etc., which lead to axes being very far out of position.
