Übersicht der G-Codes (Marlin Firmware)


Ergänzend zum Lexikoneintrag zu G-Code soll hier etwas näher auf diese Programmiersprache eingegangen werden. Die Erläuterungen der G-Codes beziehen sich auf die Marlin Firmware, und speziell den 3D-Drucker Ender 3 von Creality. Es ist wahrscheinlich, dass die G-Codes bei anderen Firmwares genau so oder ähnlich funktionieren.

Da ich bislang keine vollständige deutsche Übersetzung der G-Codes gefunden habe, möchte ich dies hier nachholen. Die Übersetzung erfolgt nach und nach, wie es meine Freizeit erlaubt.


G0-G1 - Linear Move

Add a straight line movement to the planner

G2-G3 - Arc or Circle Move

Add an arc or circle movement to the planner

G4 - Dwell

Pause the planner

G5 - Bézier cubic spline

Cubic B-spline with XYZE destination and IJPQ offsets

G6 - Direct Stepper Move

Perform a direct, uninterpolated, and non-kinematic synchronized move

G10 - Retract

Retract the filament

G11 - Recover

Recover the filament with firmware-based retract

G12 - Clean the Nozzle

Perform the nozzle cleaning procedure

G17-G19 - CNC Workspace Planes

Select CNC workspace plane

G20 - Inch Units

Set Units to Inches

G21 - Millimeter Units

Set Units to Millimeters

G26 - Mesh Validation Pattern

Test the mesh and adjust

G27 - Park toolhead

Park the current toolhead

G28 - Auto Home

Auto home one or more axes

G29 - Bed Leveling (3-Point)

Probe the bed and enable leveling compensation

G29 - Bed Leveling (Bilinear)

Probe the bed and enable leveling compensation

G29 - Bed Leveling (Linear)

Probe the bed and enable leveling compensation.

G29 - Bed Leveling (Manual)

Measure Z heights in a grid, enable leveling compensation

G29 - Bed Leveling (Unified)

Probe the bed and enable leveling compensation

G29 - Bed Leveling

Probe the bed and enable leveling compensation

G30 - Single Z-Probe

Probe bed at current XY location

G31 - Dock Sled

Dock the Z probe sled

G32 - Undock Sled

Undock the Z probe sled

G33 - Delta Auto Calibration

Calibrate various Delta parameters

G34 - Z Steppers Auto-Alignment

Align multiple Z steppers using a bed probe

G35 - Tramming Assistant

Run a procedure to tram the bed

G38.2-G38.5 - Probe target

Probe towards (or away from) a workpiece

G42 - Move to mesh coordinate

Move to a specific point in the leveling mesh

G53 - Move in Machine Coordinates

Apply native workspace to the current move

G54-G59.3 - Workspace Coordinate System

Select a workspace coordinate system

G60 - Save Current Position

Save current position to specified slot

G61 - Return to Saved Position

Return to saved position of specified slot

G76 - Probe temperature calibration

Calibrate probe temperature compensation

G80 - Cancel Current Motion Mode

Cancel the current motion mode

G90 - Absolute Positioning

Set the interpreter to absolute positions

G91 - Relative Positioning

Set the interpreter to relative positions

G92 - Set Position

Set the current position of one or more axes

G425 - Backlash Calibration

Use a conductive object to calibrate XYZ backlash

G800-M800 - Debug Gcode Parser

Returns Gcode data

M0-M1 - Unconditional stop

Stop and wait for user

M3 - Spindle CW / Laser On

Set the spindle CW speed or laser power

M4 - Spindle CCW / Laser On

Set the spindle CCW speed or laser power

M5 - Spindle / Laser Off

Turn off spindle or laser

M7-M9 - Coolant Controls

Turn mist or flood coolant on / off

M16 - Expected Printer Check

Prevent G-code usage on the wrong machine

M17 - Enable Steppers

Enable steppers

M18, M84 - Disable steppers

Disable steppers (same as M84)

M20 - List SD Card

List the contents of the SD Card

M21 - Init SD card

Attempt to detect an SD card in the slot

M22 - Release SD card

Simulate ejection of the SD card

M23 - Select SD file

Select an SD file to be executed

M24 - Start or Resume SD print

Start or resume a file selected with ['M23'](/docs/gcode/M023.html)

M25 - Pause SD print

Pause printing from the SD card

M26 - Set SD position

Set the SD read position

M27 - Report SD print status

Print SD progress to serial

M28 - Start SD write

Start writing to a file on the SD card

M29 - Stop SD write

Stop writing the file, end logging

M30 - Delete SD file

Delete a specified file from SD

M31 - Print time

Report the current print time

M32 - Select and Start

Begin an SD print from a file

M33 - Get Long Path

Convert a short pathname to a long pathname

M34 - SDCard Sorting

Set SDCard file sorting options

M42 - Set Pin State

Set an analog or digital pin to a specified state

M43 T - Toggle Pins

Get information about pins

M43 - Debug Pins

Get information about pins

M48 - Probe Accuracy Test

Measure Z Probe repeatability

M73 - Set Print Progress

Set current print progress percentage for LCD

M75 - Start Print Job Timer

Start the print job timer

M76 - Pause Print Job

Pause the print job timer

M77 - Stop Print Job Timer

Stop the print job timer

M78 - Print Job Stats

Print statistics about print jobs

M80 - Power On

Turn on the power supply

M81 - Power Off

Turn off the power supply

M82 - E Absolute

Set E to absolute positioning

M83 - E Relative

Set E to relative positioning

M85 - Inactivity Shutdown

Set the inactivity timeout

M92 - Set Axis Steps-per-unit

Set the number of steps-per-mm or steps-per-inch

M100 - Free Memory

Observe memory used by code

M1000 - Internal Use Only

Resume from Power Loss

M1001 - Internal Use Only

Run SD Print Finishing Actions

M104 - Set Hotend Temperature

Set a new target hot end temperature

M105 - Report Temperatures

Send a temperature report to the host

M106 - Set Fan Speed

Turn on the fan and set its speed

M107 - Fan Off

Turn off a fan

M108 - Break and Continue

Break out of the current waiting loop

M109 - Wait for Hotend Temperature

Wait for the hot end to reach its target

M110 - Set Line Number

Set the current line number

M111 - Debug Level

Report and optionally set the debug flags

M112 - Emergency Stop

Shut everything down and halt the machine

M113 - Host Keepalive

Get or set the host keepalive interval

M114 - Get Current Position

Report the current tool position to the host

M115 - Firmware Info

Print the firmware info and capabilities

M117 - Set LCD Message

Set the message line on the LCD

M118 - Serial print

Send text to serial

M119 - Endstop States

Report endstop and probe states to the host

M120 - Enable Endstops

Enable endstops and keep them enabled when not homing

M121 - Disable Endstops

Disable endstops and keep them enabled when not homing

M122 - TMC Debugging

Get TMC Debug Info

M125 - Park Head

Save current position and move to filament change position

M126 - Baricuda 1 Open

Open the valve for Baricuda 1

M127 - Baricuda 1 Close

Close the valve for Baricuda 1

M128 - Baricuda 2 Open

Open the valve for Baricuda 2

M129 - Baricuda 2 Close

Close the valve for Baricuda 2

M140 - Set Bed Temperature

Set a new target bed temperature

M141 - Set Chamber Temperature

Set a new target chamber temperature

M145 - Set Material Preset

Set material presets in the LCD menu

M149 - Set Temperature Units

Set temperature units to Celsius, Fahrenheit, or Kelvin

M150 - Set RGB(W) Color

Set the color of the RGB(W) LED, backlight, or LED strip

M155 - Temperature Auto-Report

Auto-report temperatures to host periodically

M163 - Set Mix Factor

Set a single mix factor for a mixing extruder

M164 - Save Mix

Save the current mix as a virtual tool

M165 - Set Mix

Set all mix factors for the mixing extruder

M166 - Gradient Mix

Set a Gradient Mix

M190 - Wait for Bed Temperature

Wait for the bed to reach target temperature

M191 - Wait for Chamber Temperature

Wait for the chamber to reach target temperature

M192 - Wait for Probe temperature

Wait for the probe temperature sensor to reach a target

M200 - Set Filament Diameter

Set the diameter for volumetric extrusion

M201 - Set Print Max Acceleration

Set maximum acceleration for print moves one or more axes

M203 - Set Max Feedrate

Set maximum feedrate for one or more axes

M204 - Set Starting Acceleration

Set the starting acceleration for moves by type

M205 - Set Advanced Settings

Set some advanced settings related to movement

M206 - Set Home Offsets

Apply a persistent offset

M207 - Set Firmware Retraction

Set options for firmware-based retraction

M208 - Firmware Recover

Firmware-retraction recover settings

M209 - Set Auto Retract

Enable / disable auto-retraction

M211 - Software Endstops

Set and/or get the software endstops state

M217 - Filament swap parameters

Set length and speed for filament swapping

M218 - Set Hotend Offset

Set the offset of a hotend (from hotend 0)

M220 - Set Feedrate Percentage

Set the global feedrate percentage

M221 - Set Flow Percentage

set the flow percentage, which applies to all E moves

M226 - Wait for Pin State

Wait for a pin to have a given state

M240 - Trigger Camera

Trigger a camera shutter

M250 - LCD Contrast

Set and/or get the LCD contrast

M260 - I2C Send

Send data to the I2C bus

M261 - I2C Request

Request and echo bytes from the I2C bus

M280 - Servo Position

Set or get a servo position

M281 - Edit Servo Angles

Set servo deploy and/or stow angles

M290 - Babystep

Babystep one or more axes

M300 - Play Tone

Play a single tone, buzz, or beep

M301 - Set Hotend PID

Set PID values for a hotend

M302 - Cold Extrude

Set minimum extrusion temperature, allow cold extrusion

M303 - PID autotune

Auto-tune the PID system to find stable values

M304 - Set Bed PID

Set PID values for the heated bed

M305 - User Thermistor Parameters

Set (or report) custom thermistor parameters

M350 - Set micro-stepping

Set micro-stepping for drivers that support it

M351 - Set Microstep Pins

Directly set the micro-stepping pins

M355 - Case Light Control

Turn the case light on or off, set brightness

M360 - SCARA Theta A

Move to Theta A

M361 - SCARA Theta-B

Move to Theta-B

M362 - SCARA Psi-A

Move to Psi-A

M363 - SCARA Psi-B

Move to Psi-B

M364 - SCARA Psi-C

Move to Psi-C

M380 - Activate Solenoid


M381 - Deactivate Solenoids

Deactivate all extruder solenoids

M400 - Finish Moves

Wait for all moves to finish

M401 - Deploy Probe

Deploy the bed probe

M402 - Stow Probe

Stow the bed probe

M403 - MMU2 Filament Type

Set filament type for Multi-Material Unit 2.0

M404 - Set Filament Diameter

Set the nominal diameter for filament width sensor auto-flow

M405 - Filament Width Sensor On

Enable filament width sensor flow control

M406 - Filament Width Sensor Off

Disable filament width sensor flow control

M407 - Filament Width

Report the measured filament width

M410 - Quickstop

Stop all steppers instantly

M412 - Filament Runout

Enable / disable filament runout detection

M413 - Power-loss Recovery

Enable / disable power-loss recovery

M420 - Bed Leveling State

Get and/or set bed leveling state and parameters

M421 - Set Mesh Value

Set a single mesh Z height

M422 - Set Z Motor XY

Set a Z motor position for G34 Auto-Alignment

M425 - Backlash compensation

Enable and tune backlash compensation

M428 - Home Offsets Here

Set home offsets based on current position

M430 - Power Monitor

Read and display current (A), voltage (V), and power (W)

M486 - Cancel Objects

Identify and cancel objects

M500 - Save Settings

Save settings to EEPROM

M501 - Restore Settings

Restore settings from EEPROM

M502 - Factory Reset

Restore all settings to factory defaults

M503 - Report Settings

Report all settings that may be saved to EEPROM

M504 - Validate EEPROM contents

Validate the contents of the EEPROM

M510 - Lock Machine

Lock the machine if it has a passcode

M511 - Unlock Machine

Unlock the machine if it has a passcode

M512 - Set Passcode

Set a numeric passcode for locking the machine

M524 - Abort SD print

Abort an SD print started with ['M24'](/docs/gcode/M024.html)

M540 - Endstops Abort SD

Abort SD printing when an endstop is triggered

M569 - Set TMC stepping mode

Toggle stealthChop

M575 - Serial baud rate

Change the serial baud rate

M600 - Filament Change

Automatically change filament

M603 - Configure Filament Change

Configure automatic filament change parameters

M605 - Dual Nozzle Mode

Set the behavior mode for dual nozzles

M665 - SCARA Configuration

Set SCARA geometry values

M665 - Delta Configuration

Set delta geometry values

M666 - Set dual endstop offsets

Set dual endstop offsets

M666 - Set Delta endstop adjustments

Set Delta endstop adjustments

M672 - Test Speed Warning

Set/clear Duet Smart Effector sensitivity

M701 - Load filament

Load filament

M702 - Unload filament

Unload filament

M710 - Controller Fan settings

Set or report controller fan settings

M7219 - MAX7219 Control

Control Max7219 Segmented LEDs

M810-M819 - G-code macros

Set/execute one of ten G-code macros

M851 - XYZ Probe Offset

Set the Z probe XYZ offset from nozzle

M852 - Bed Skew Compensation

Misalignment in the XYZ axes

M860-M869 - I2C Position Encoders

I2C position encoders for closed loop control

M871 - Probe temperature config

Configure probe temperature compensation

M876 - Handle Prompt Response

Handle Host prompt responses

M900 - Linear Advance Factor

Get and set Linear Advance K value

M906 - TMC Motor Current

Set the motor current (in milliamps)

M907 - Set Motor Current

Set motor current via digital trimpot

M908 - Set Trimpot Pins

Set a digital trimpot directly

M909 - DAC Print Values

Report DAC current values to host

M910 - Commit DAC to EEPROM

Commit digipot/DAC value to external EEPROM

M911 - TMC OT Pre-Warn Condition

Driver overtemperature pre-warn condition

M912 - Clear TMC OT Pre-Warn

Clear overtemperature pre-warn condition flag

M913 - Set Hybrid Threshold Speed

TMC driver switching to spreadCycle

M914 - TMC Bump Sensitivity

Set sensorless homing sensitivity

M915 - TMC Z axis calibration

Align ends of the Z axis and test torque

M916 - L6474 Thermal Warning Test

Find L6474 drive level (KVAL_HOLD) threshold

M917 - L6474 Overcurrent Warning Test

Find L6474 minimum current thresholds

M918 - L6474 Speed Warning Test

Find L6474 speed threshold

M928 - Start SD Logging

Log serial input to an SD file

M951 - Magnetic Parking Extruder

Set / report Magnetic Parking Extruder settings

M993-M994 - SD / SPI Flash

load or back up SPI Flash and SD

M995 - Touch Screen Calibration

Touch screen calibration for TFT display

M997 - Firmware update

Perform in-application firmware update

M999 - STOP Restart

Return the machine to Running state

T0-T6 - Select Tool

Switch to the specified tool