flexi-bot/docs/marlin/_gcode/M032.md
2023-09-05 20:38:49 +02:00

49 lines
1.3 KiB
Markdown

---
tag: m0032
title: Select and Start
brief: Begin an SD print from a file.
author: thinkyhead
experimental: true
requires: SDSUPPORT
group: sdcard
codes: [ M32 ]
notes:
- Requires [`SDSUPPORT`](/docs/configuration/configuration.html#sd-card)
- This is a seldom-used beta feature that needs more testing and use-cases.
parameters:
-
tag: P
optional: true
description: Sub-Program flag
values:
-
tag: flag
type: bool
-
tag: S
optional: true
description: Starting file offset
values:
-
tag: filepos
type: int
examples:
-
pre: Select and start a file at offset 5022.
code: M32 S5022 !/boats/sailboat.gco
-
pre: Select and start a file from within G-code.
code: M32 P !/models/lgbust.gco#
post: The `#` suffix is needed when using `P` to "stop buffer pre-reading" so no commands after [`M32`](/docs/gcode/M032.html) will go into the buffer until after it returns.
---
The [`M32`](/docs/gcode/M032.html) command exists to allow G-code to load other G-code files and run them as sub-programs. This can be useful to change the start / end G-code for a batch of files without having to edit them all.
For legacy reasons [`M32`](/docs/gcode/M032.html) uses '`!`' (and '`#`') to delimit the filepath parameter. The filepath must be the last parameter.