G-Code Reference
Introduction
Prunt g-code uses a simple syntax similar to Marlin. Most commands are also compatible with Marlin commands. The following rules describe the Prunt g-code syntax:
- Each line may contain zero or one commands.
- Commands are made up of parameters, which are a single letter from A to Z, and arguments, which may be any of the following:
- An integer from 0 to 999.
- A real number with an optional decimal part.
- A string surrounded by
"
characters.
- An argument is only allowed directly after a parameter.
- Arguments are optional.
- Duplicate parameters are not allowed.
- A command must contain a
G
orM
parameter. - Parameters may be in any order.
- Unused parameters are not allowed.
- Arguments must be of the correct type for a command.
- All spaces on a line are ignored, excluding those within strings.
- Comments starting with
;
outside of a string are ignored.
Differences from Marlin are noted in most cases. These differences can be found by searching for “Marlin” on this page. Unsupported Marlin G
and M
codes are listed at the end of the page.
G0: Rapid Linear Move
Perform a non-print linear move. Axes which are not specified will not move. Moves at the maximum feedrate if feedrate is not specified.
Prunt contains a setting under Prunt > Replace G0 with G1
which will replace all G0 commands with G1 commands if set. This emulates the behaviour seen in some other motion controllers, including Marlin. This setting is off by default.
All specified axes must be homed and the target position must be within the limits defined in the printer configuration or else an error will be raised.
The G90
, G91
, M82
, and M83
are used to switch between relative and absolute mode.
The ABCUVW
parameters are not present as Prunt does not support these axes. The S
parameter is not present as Prunt does not support lasers. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
[X] | Real | X axis target position in mm, or offset in relative move mode. |
[Y] | Real | Y axis target position in mm, or offset in relative move mode. |
[Z] | Real | Z axis target position in mm, or offset in relative move mode. |
[E] | Real | E axis target position in mm, or offset in relative move mode. |
[F] | Real | Feedrate in mm/min, maximum if not specified. |
G1: Linear Move
Perform a linear move. Axes which are not specified will not move. Moves at the same feedrate as the last G1 command if feedrate is not specified.
All specified axes must be homed and the target position must be within the limits defined in the printer configuration or else an error will be raised.
The G90
, G91
, M82
, and M83
are used to switch between relative and absolute mode.
The ABCUVW
parameters are not present as Prunt does not support these axes. The S
parameter is not present as Prunt does not support lasers. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
[X] | Real | X axis target position in mm, or offset in relative move mode. |
[Y] | Real | Y axis target position in mm, or offset in relative move mode. |
[Z] | Real | Z axis target position in mm, or offset in relative move mode. |
[E] | Real | E axis target position in mm, or offset in relative move mode. |
[F] | Real | Feedrate in mm/min, from last G1 if not specified. |
G4: Dwell
Pause the printer for a given number of seconds after the last move is completed.
Exactly one of the below parameters must be present or else an error will be raised. This differs from Marlin where S
silently takes precedence over P
.
The S
and P
parameters are allowed to have a decimal part. This differs from Marlin where only an integer is allowed.
Parameter | Type | Description |
---|---|---|
[S] | Real | Time to pause in seconds. |
[P] | Real | Time to pause in milliseconds. |
G10: Retract
Perform a retraction move with the values specified by the last M207 command. Multiple G10 commands without a G11 command between them are ignored.
No parameters. This differs from Marlin where an optional S
parameter may be used to specify a different retraction length for tool swaps.
G11: Recover
Perform a recovery move with the values specified by the last M207 and M208 commands. Multiple G11 commands without a G10 command between them are ignored.
No parameters.
G21: Millimetre Units
Does nothing. Provided for compatibility with other motion controllers where G21 sets the units to millimetres. Prunt always uses millimetres as the unit for g-code.
No parameters.
G28: Auto Home
Home the specified axes using the method and parameters specified in the configuration. If no axes are specified then all axes are homed, including the E axis.
The ABCUVW
parameters are not present as Prunt does not support these axes. The LOR
parameters are not present but are planned for a future version. These parameters are present in Marlin.
The E
parameter is not present in Marlin as Marlin does not homing of the E axis.
Parameter | Type | Description |
---|---|---|
[X] | None | If included then the X axis will be homed. |
[Y] | None | If included then the Y axis will be homed. |
[Z] | None | If included then the Z axis will be homed. |
[E] | None | If included then the E axis will be homed. |
G90: Absolute Positioning
Set the printer to absolute positioning mode. In this mode G0 and G1 specify absolute coordinates. M83 overrides this behaviour for the E axis. This command acts as-if a M82 command is run at the same time, meaning that M83 must be called again to set the extruder to relative mode if it was called previously.
No parameters.
G91: Relative Positioning
Set the printer to relative positioning mode. In this mode G0 and G1 specify relative coordinates. M82 overrides this behaviour for the E axis. This command acts as-if a M83 command is run at the same time, meaning that M82 must be called again to set the extruder to absolute mode if it was called previously.
No parameters.
G92: Set Virtual Position
Set the current position to be used by other g-code commands. This does not change how other parts of Prunt see the position, so features such as bounds still function as expected.
The ABCUVW
parameters are not present as Prunt does not support these axes. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
[X] | Real | The X position to set. If not specified then the X axis position will not be adjusted. |
[Y] | Real | The X position to set. If not specified then the Y axis position will not be adjusted. |
[Z] | Real | The X position to set. If not specified then the Z axis position will not be adjusted. |
[E] | Real | The X position to set. If not specified then the E axis position will not be adjusted. |
M0/M1: Pause
Pause the printer and wait for the user to command the printer to continue.
The SP
parameters are not present as Prunt does not support pause expiry. These parameters are present in Marlin.
No parameters.
M17: Enable Motors
Enable the motors assigned to the specified axes. If no axes are specified then all axes are enabled. On a CoreXY machine specifying X or Y will enable all XY motors.
The ABCUVW
parameters are not present as Prunt does not support these axes. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
[X] | None | If included, enable the X axis steppers. |
[Y] | None | If included, enable the Y axis steppers. |
[Z] | None | If included, enable the Z axis steppers. |
[E] | None | If included, enable the E axis steppers. |
M18/M84: Disable Motors
Enable the motors assigned to the specified axes. If no axes are specified then all axes are disabled. On a CoreXY machine specifying X or Y will disable all XY motors. Disabled axes are marked as unhomed.
The ABCUVW
parameters are not present as Prunt does not support these axes. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
[X] | None | If included, disable the X axis steppers. |
[Y] | None | If included, disable the Y axis steppers. |
[Z] | None | If included, disable the Z axis steppers. |
[E] | None | If included, disable the E axis steppers. |
M82: E Axis Absolute
Set the E axis to absolute positioning mode, overrides G90. Cleared by G90.
No parameters.
M83: E Axis Relative
Set the E axis to relative positioning mode, overrides G91. Cleared by G91.
No parameters.
M104: Set Hotend Temperature
Set the target temperature for the hotend.
The BFI
parameters are not present. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
S | Real | Target temperature in Celsius. |
[T] | Integer | Ignored. Provided for Marlin slicer compatibility. This parameter will be used to support multiple tools in a future version. |
M106: Set Fan Speed
Set the speed for a given fan. If no fan is specified then the first fan is used.
This command differs from Marlin in that the P
and S
parameters support types other than integers.
The IT
parameters are not present. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
[P] | Integer/String | Fan name or index. First fan if not specified. |
[S] | Real | Speed from 0 to 255 with 255 being maximum speed. 255 if not specified. |
M107: Fan Off
Turn off the specified fan.
If no fan is specified then the first fan is used. This differs from Marlin where the print cooling fan is the default.
Parameter | Type | Description |
---|---|---|
[P] | Integer/String | Fan name or index. First fan if not specified. |
M109: Wait for Hotend Temperature
Set the hotend target temperature and then wait until the hotend reaches or exceeds the given temperature.
The BFIR
parameters are not present. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
S | Real | Temperature to wait for in Celsius. |
[T] | Integer | Ignored. Provided for Marlin slicer compatibility. This parameter will be used to support multiple tools in a future version. |
M122: TMC Register Dump
Log all register values for all connected Trinamic stepper drivers.
No Parameters. This differs from Marlin.
M140: Set Bed Temperature
Set the target temperature for the bed.
The I
parameter is not present. This parameter is present in Marlin.
Parameter | Type | Description |
---|---|---|
S | Real | Target temperature in Celsius. |
M141: Set Chamber Temperature
Set the target temperature for the chamber.
Parameter | Type | Description |
---|---|---|
S | Real | Target temperature in Celsius. |
M190: Wait for Bed Temperature
Set the target temperature for the bed and then wait until the bed reaches or exceeds the given temperature.
The IRT
parameters are not present. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
S | Real | Temperature to wait for in Celsius. |
M191: Wait for Chamber Temperature
Set the target temperature for the chamber and then wait until the chamber reaches or exceeds the given temperature.
The R
parameter is not present. This parameter is present in Marlin.
Parameter | Type | Description |
---|---|---|
S | Real | Temperature to wait for in Celsius. |
M205: Set Dynamic Kinematic Limits
This command differs significantly from Marlin due to the different parameters in Prunt.
Parameter | Type | Description |
---|---|---|
P | None | Required to prevent accidental usage of commands meant for other motion controllers. |
[A] | Real | Acceleration in mm/s². Not modified if not specified. |
[J] | Real | Jerk in mm/s³. Not modified if not specified. |
[S] | Real | Snap in mm/s⁴. Not modified if not specified. |
[C] | Real | Crackle in mm/s⁵. Not modified if not specified. |
[D] | Real | Path deviation in mm. Not modified if not specified. |
[L] | Real | Pressure advance time in s. Not modified if not specified. |
M207: Retraction Settings
Adjust the retraction settings used by G10 and G11.
The W
parameter is not present. This parameter is present in Marlin.
Parameter | Type | Description |
---|---|---|
[F] | Real | Feedrate in mm/min. Not modified if not specified. |
[E] | Real | E axis retraction distance. Not modified if not specified. |
[Z] | Real | Z axis retraction distance. Not modified if not specified. |
M208: Recovery Settings
Adjust the recovery settings used by G11.
The RW
parameters are not present. These parameters are present in Marlin.
Parameter | Type | Description |
---|---|---|
[F] | Real | Additional feedrate in mm/min. Not modified if not specified. |
[S] | Real | Additional E axis recovery distance. Not modified if not specified. |
M303: PID Autotune
Perform PID autotuning and output the result to the log.
The DU
parameters are not present. These parameters are present in Marlin.
The E
parameter from Marlin has been replaced with the T
parameter with different semantics.
Parameter | Type | Description |
---|---|---|
T | Integer/String | Heater index or name. |
S | Real | Target temperature in Celsius. |
[C] | Integer | Maximum number of cycles. Defaults to 5. |
M73/M204/M486: Ignored
Ignored command provided for slicer compatibility when outputting Marlin G-code.
Unsupported G/M Parameters Present in Marlin
- G2-G3: Arc or Circle Move - Use built-in corner blending instead.
- G5: Bézier Cubic Spline - Use built-in corner blending instead.
- G6: Direct Stepper Move - Use built-in corner blending instead.
- G12: Clean the Nozzle - Planned for future version.
- G17-G19: CNC Workspace Planes
- G20: Inch Units
- G26: Mesh Validation Pattern - Planned for future version.
- G27: Park toolhead - Planned for future version.
- G29: Bed Leveling - Planned for future version.
- G30: Single Z-Probe - Planned for future version.
- G31: Dock Sled
- G32: Undock Sled
- G33: Delta Auto Calibration
- G34: Z Steppers Auto-Alignment
- G34: Mechanical Gantry Calibration
- G35: Tramming Assistant
- G38.2-G38.5: Probe target
- G42: Move to mesh coordinate
- G53: Move in Machine Coordinates
- G54-G59.3: Workspace Coordinate System
- G60: Stored Positions
- G61: Return to Saved Position
- G76: Probe temperature calibration
- G80: Cancel Current Motion Mode
- G425: Backlash Calibration
- M3: Spindle CW / Laser On - Not relevant to Prunt.
- M4: Spindle CCW / Laser On - Not relevant to Prunt.
- M5: Spindle / Laser Off - Not relevant to Prunt.
- M7-M9: Coolant Controls
- M10-M11: Vacuum / Blower Control
- M16: Expected Printer Check
- M20: List SD Card - Not relevant to Prunt.
- M21: Init SD card - Not relevant to Prunt.
- M22: Release SD card - Not relevant to Prunt.
- M23: Select SD file - Not relevant to Prunt.
- M24: Start or Resume SD print - Not relevant to Prunt.
- M25: Pause SD print - Not relevant to Prunt.
- M26: Set SD position - Not relevant to Prunt.
- M27: Report SD print status - Not relevant to Prunt.
- M28: Start SD write - Not relevant to Prunt.
- M29: Stop SD write - Not relevant to Prunt.
- M30: Delete SD file - Not relevant to Prunt.
- M31: Report Print Time - Not relevant to Prunt.
- M32: Select and Start - Not relevant to Prunt.
- M33: Get Long Path - Not relevant to Prunt.
- M34: SDCard Sorting - Not relevant to Prunt.
- M42: Set Pin State
- M43: Debug Pins
- M43 T: Toggle Pins
- M48: Probe Repeatability Test - Planned for future version.
- M73: Set Print Progress
- M75: Start Print Job Timer
- M76: Pause Print Job Timer
- M77: Stop Print Job Timer
- M78: Print Job Stats
- M80: Power On
- M81: Power Off
- M85: Inactivity Shutdown
- M86: Hotend Idle Timeout
- M87: Disable Hotend Idle Timeout
- M92: Set Axis Steps-per-unit
- M100: Free Memory
- M102: Configure Bed Distance Sensor
- M105: Report Temperatures
- M108: Break and Continue
- M110: Set / Get Line Number - Not relevant to Prunt.
- M111: Debug Level - Not relevant to Prunt.
- M112: Full Shutdown
- M113: Host Keepalive - Not relevant to Prunt.
- M114: Get Current Position - Not relevant to Prunt.
- M115: Firmware Info
- M117: Set LCD Message
- M118: Serial print
- M119: Endstop States
- M120: Enable Endstops
- M121: Disable Endstops
- M123: Fan Tachometers
- M125: Park Head
- M126: Baricuda 1 Open - Not relevant to Prunt.
- M127: Baricuda 1 Close - Not relevant to Prunt.
- M128: Baricuda 2 Open - Not relevant to Prunt.
- M129: Baricuda 2 Close - Not relevant to Prunt.
- M143: Set Laser Cooler Temperature - Not relevant to Prunt.
- M145: Set Material Preset
- M149: Temperature Units
- M150: Set RGB(W) Color
- M154: Position Auto-Report - Not relevant to Prunt.
- M155: Temperature Auto-Report - Not relevant to Prunt.
- M163: Set Mix Factor - Not relevant to Prunt.
- M164: Save Mix
- M165: Set Mix
- M166: Gradient Mix
- M192: Wait for Probe temperature
- M193: Wait For Laser Cooler Temperature
- M200: Volumetric Extrusion Diameter
- M201: Print / Travel Move Limits
- M203: Set Max Feedrate
- M204: Set Starting Acceleration
- M206: Set Home Offsets
- M209: Set Auto Retract
- M210: Homing Feedrate
- M211: Software Endstops
- M217: Filament swap parameters
- M218: Set Hotend Offset
- M220: Set Feedrate Percentage
- M221: Set Flow Percentage
- M226: Wait for Pin State
- M240: Trigger Camera
- M250: LCD Contrast
- M255: LCD Sleep/Backlight Timeout
- M256: LCD Brightness
- M260: I2C Send
- M261: I2C Request
- M280: Servo Position
- M281: Edit Servo Angles
- M282: Detach Servo
- M290: Babystep
- M300: Play Tone
- M301: Set Hotend PID
- M302: Cold Extrude
- M304: Set Bed PID
- M305: User Thermistor Parameters
- M306: Model Predictive Temp. Control
- M350: Set micro-stepping
- M351: Set Microstep Pins
- M355: Case Light Control
- M360: SCARA Theta A
- M361: SCARA Theta-B
- M362: SCARA Psi-A
- M363: SCARA Psi-B
- M364: SCARA Psi-C
- M380: Activate Solenoid
- M381: Deactivate Solenoids
- M400: Finish Moves
- M401: Deploy Probe
- M402: Stow Probe
- M403: MMU2 Filament Type
- M404: Filament Width Sensor Nominal Diameter
- M405: Filament Width Sensor On
- M406: Filament Width Sensor Off
- M407: Read Filament Width
- M410: Quickstop
- M412: Filament Runout
- M413: Power-loss Recovery
- M420: Bed Leveling State
- M421: Set Mesh Value
- M422: Set Z Motor XY
- M423: X Twist Compensation
- M425: Backlash compensation
- M428: Home Offsets Here
- M430: Power Monitor
- M486: Cancel Objects
- M493: Fixed-Time Motion
- M500: Save Settings
- M501: Restore Settings
- M502: Factory Reset
- M503: Report Settings
- M504: Validate EEPROM contents
- M510: Lock Machine
- M511: Unlock Machine
- M512: Set Passcode
- M524: Abort SD print
- M540: Endstops Abort SD
- M550: Machine Name
- M569: Set TMC stepping mode
- M575: Serial baud rate
- M592: Nonlinear Extrusion Control
- M593: ZV Input Shaping
- M600: Filament Change
- M603: Configure Filament Change
- M605: Multi Nozzle Mode
- M665: Delta Configuration
- M665: SCARA Configuration
- M666: Set Delta endstop adjustments
- M666: Set dual endstop offsets
- M672: Duet Smart Effector sensitivity
- M701: Load filament
- M702: Unload filament
- M710: Controller Fan settings
- M808: Repeat Marker
- M810-M819: G-code macros
- M820: Report G-code macros
- M851: XYZ Probe Offset
- M852: Bed Skew Compensation
- M860-M869: I2C Position Encoders
- M871: Probe temperature config
- M876: Handle Prompt Response
- M900: Linear Advance Factor
- M906: Stepper Motor Current
- M907: Trimpot Stepper Motor Current
- M908: Set Trimpot Pins
- M909: Report DAC Stepper Current
- M910: Commit DAC to EEPROM
- M911: TMC OT Pre-Warn Condition
- M912: Clear TMC OT Pre-Warn
- M913: Set Hybrid Threshold Speed
- M914: TMC Bump Sensitivity
- M915: TMC Z axis calibration
- M916: L6474 Thermal Warning Test
- M917: L6474 Overcurrent Warning Test
- M918: L6474 Speed Warning Test
- M919: TMC Chopper Timing
- M928: Start SD Logging
- M951: Magnetic Parking Extruder
- M993: Back up flash settings to SD
- M994: Restore flash from SD
- M995: Touch Screen Calibration
- M997: Firmware update
- M999: STOP Restart
- M7219: MAX7219 Control