G-code
English • العربية • български • català • čeština • Deutsch • Ελληνικά • español • فارسی • français • hrvatski • magyar • italiano • română • 日本語 • 한국어 • lietuvių • Nederlands • norsk • polski • português • русский • Türkçe • українська • 中文(中国大陆) • 中文(台灣) • עברית • azərbaycanca • |
This page tries to describe the flavour of G-codes that the RepRap firmwares use and how they work. The main target is additive fabrication using FFF processes. Codes for print head movements follow the NIST RS274NGC G-code standard, so RepRap firmwares are quite usable for CNC milling and similar applications as well. See also on Wikipedia's G-code article.
There are a few different ways to prepare G-code for a printer. One method would be to use a slicing program such as Slic3r, Skeinforge or Cura. These programs import a CAD model, slice it into layers, and output the G-code required to print each layer. Slicers are the easiest way to go from a 3D model to a printed part, however the user sacrifices some flexibility when using them. Another option for G-code generation is to use a lower level library like mecode. Libraries like mecode give you precise control over the tool path, and thus are useful if you have a complex print that is not suitable for naive slicing. The final option is to just write the G-code yourself. This may be the best choice if you just need to run a few test lines while calibrating your printer.
As many different firmwares exist and their developers tend to implement new features without discussing strategies or looking what others did before them, a lot of different sub-flavours for the 3D-Printer specific codes developed over the years. This particular page is the master page for RepRap. Nowhere in here should the same code be used for two different things; there are always more numbers to use... The rule is: add your new code here, then implement it.
Unfortunately human nature being what it is, the best procedures aren't always followed, so some multiple uses of the same code exist. The rule which should be followed is that later appearances of a code on this page (later than the original use of a code), are deprecated and should be changed, unless there is a good technical reason (like the general G-Code standard) why a later instance should be preferred. Note that the key date is appearance here, not date of implementation.
Contents
- 1 Introduction
- 2 Fields
- 3 Case sensitivity
- 4 Quoted strings
- 5 Using expressions in parameters
- 6 Comments
- 7 Special fields
- 8 Checking
- 9 Conditional Execution and Loops
- 10 Buffering
- 11 G-commands
- 11.1 G0 & G1: Move
- 11.2 G2 & G3: Controlled Arc Move
- 11.3 G4: Dwell
- 11.4 G6: External Motion Control (Marlin)
- 11.5 G6: Direct Stepper Move (Druid)
- 11.6 G10: Set tool Offset and/or workplace coordinates and/or tool temperatures
- 11.7 G10: Retract
- 11.8 G11: Unretract
- 11.9 G12: Clean Tool
- 11.10 G17..19: Plane Selection (CNC specific)
- 11.11 G20: Set Units to Inches
- 11.12 G21: Set Units to Millimeters
- 11.13 G22: Firmware Retract
- 11.14 G23: Firmware Recover
- 11.15 G26: Mesh Validation Pattern
- 11.16 G27: Park toolhead
- 11.17 G28: Move to Origin (Home)
- 11.18 G29: Detailed Z-Probe
- 11.19 G29.1: Set Z probe head offset
- 11.20 G29.2: Set Z probe head offset calculated from toolhead position
- 11.21 G30: Single Z-Probe
- 11.22 G31: Set or Report Current Probe status
- 11.23 G31: Dock Z Probe sled
- 11.24 G32: Probe Z and calculate Z plane
- 11.25 G32: Undock Z Probe sled
- 11.26 G33: Firmware dependent
- 11.27 G34: Z Stepper Auto-Align
- 11.28 G34: Calculate Delta Height from toolhead position (DELTA)
- 11.29 G38.x Straight Probe (CNC specific)
- 11.30 G40: Compensation Off (CNC specific)
- 11.31 G42: Move to Grid Point
- 11.32 G53..59: Coordinate System Select (CNC specific)
- 11.33 G60: Save / Restore position
- 11.34 G61: Restore saved position
- 11.35 G68: Coordinate rotation
- 11.36 G69: Cancel coordinate rotation
- 11.37 G75: Print temperature interpolation
- 11.38 G76: PINDA probe temperature calibration
- 11.39 G80: Cancel Canned Cycle (CNC specific)
- 11.40 G80: Mesh-based Z probe
- 11.41 G81: Mesh bed leveling status
- 11.42 G82: Single Z probe at current location
- 11.43 G83: Babystep in Z and store to EEPROM
- 11.44 G84: UNDO Babystep Z (move Z axis back)
- 11.45 G85: Pick best babystep
- 11.46 G86: Disable babystep correction after home
- 11.47 G87: Enable babystep correction after home
- 11.48 G88: Reserved
- 11.49 G90: Set to Absolute Positioning
- 11.50 G91: Set to Relative Positioning
- 11.51 G92: Set Position
- 11.52 G93: Feed Rate Mode (Inverse Time Mode) (CNC specific)
- 11.53 G94: Feed Rate Mode (Units per Minute) (CNC specific)
- 11.54 G98: Activate farm mode
- 11.55 G99: Deactivate farm mode
- 11.56 G100: Calibrate floor or rod radius
- 11.57 G130: Set digital potentiometer value
- 11.58 G131: Remove offset
- 11.59 G132: Calibrate endstop offsets
- 11.60 G133: Measure steps to top
- 11.61 G161: Home axes to minimum
- 11.62 G162: Home axes to maximum
- 11.63 G425: Perform auto-calibration with calibration cube
- 12 M-commands
- 12.1 M0: Stop or Unconditional stop
- 12.2 M1: Sleep or Conditional stop
- 12.3 M2: Program End
- 12.4 M3: Spindle On, Clockwise (CNC specific)
- 12.5 M4: Spindle On, Counter-Clockwise (CNC specific)
- 12.6 M5: Spindle Off (CNC specific)
- 12.7 M6: Tool change
- 12.8 M7: Mist Coolant On (CNC specific)
- 12.9 M8: Flood Coolant On (CNC specific)
- 12.10 M9: Coolant Off (CNC specific)
- 12.11 M10: Vacuum On (CNC specific)
- 12.12 M11: Vacuum Off (CNC specific)
- 12.13 M13: Spindle on (clockwise rotation) and coolant on (flood)
- 12.14 M16: Expected Printer Check
- 12.15 M17: Enable/Power all stepper motors
- 12.16 M18: Disable all stepper motors
- 12.17 M20: List SD card
- 12.18 M21: Initialize SD card
- 12.19 M22: Release SD card
- 12.20 M23: Select SD file
- 12.21 M24: Start/resume SD print
- 12.22 M25: Pause SD print
- 12.23 M26: Set SD position
- 12.24 M27: Report SD print status
- 12.25 M28: Begin write to SD card
- 12.26 M29: Stop writing to SD card
- 12.27 M30: Delete a file on the SD card
- 12.28 M31: Output time since last M109 or SD card start to serial
- 12.29 M32: Select file and start SD print
- 12.30 M33: Get the long name for an SD card file or folder
- 12.31 M33: Stop and Close File and save restart.gcode
- 12.32 M34: Set SD file sorting options
- 12.33 M35: Upload firmware NEXTION from SD
- 12.34 M36: Return file information
- 12.35 M36.1: Return embedded thumbnail data
- 12.36 M37: Simulation mode
- 12.37 M38 Compute SHA1 hash of target file
- 12.38 M39 Report SD card information
- 12.39 M40: Eject
- 12.40 M41: Loop
- 12.41 M42: Switch I/O pin
- 12.42 M43: Stand by on material exhausted
- 12.43 M43: Pin report and debug
- 12.44 M44: Codes debug - report codes available
- 12.45 M44: Reset the bed skew and offset calibration
- 12.46 M45: Bed skew and offset with manual Z up
- 12.47 M46: Show the assigned IP address
- 12.48 M47: Show end stops dialog on the display
- 12.49 M48: Measure Z-Probe repeatability
- 12.50 M49: Set G26 debug flag
- 12.51 M70: Display message
- 12.52 M72: Firmware dependent
- 12.53 M73: Set/Get build percentage
- 12.54 M74: Set weight on print bed
- 12.55 M75: Start the print job timer
- 12.56 M76: Pause the print job timer
- 12.57 M77: Stop the print job timer
- 12.58 M78: Show statistical information about the print jobs
- 12.59 M79: Start host timer
- 12.60 M80: ATX Power On
- 12.61 M81: ATX Power Off
- 12.62 M82: Set extruder to absolute mode
- 12.63 M83: Set extruder to relative mode
- 12.64 M84: Stop idle hold
- 12.65 M85: Set Inactivity Shutdown Timer
- 12.66 M86: Set Safety Timeout
- 12.67 M87: Cancel Safety Timer
- 12.68 M92: Set axis_steps_per_unit
- 12.69 M93: Send axis_steps_per_unit
- 12.70 M98: Call Macro/Subprogram
- 12.71 M99: Return from Macro/Subprogram
- 12.72 M101: Turn extruder 1 on (Forward), Undo Retraction
- 12.73 M102: Turn extruder 1 on (Reverse)
- 12.74 M102: Configure Distance Sensor
- 12.75 M103: Turn all extruders off, Extruder Retraction
- 12.76 M104: Set Extruder Temperature
- 12.77 M105: Get Extruder Temperature
- 12.78 M106: Fan On
- 12.79 M107: Fan Off
- 12.80 M108: Cancel Heating
- 12.81 M108: Set Extruder Speed (BFB)
- 12.82 M109: Set Extruder Temperature and Wait
- 12.83 M110: Set Current Line Number
- 12.84 M111: Set Debug Level
- 12.85 M112: Full (Emergency) Stop
- 12.86 M113: Set Extruder PWM
- 12.87 M113: Host Keepalive
- 12.88 M114: Get Current Position
- 12.89 M115: Get Firmware Version and Capabilities
- 12.90 M116: Wait
- 12.91 M117: Get Zero Position
- 12.92 M117: Display Message
- 12.93 M118: Echo message on host
- 12.94 M118: Negotiate Features
- 12.95 M119: Get Endstop Status
- 12.96 M120: Push
- 12.97 M121: Pop
- 12.98 M120: Enable endstop detection
- 12.99 M121: Disable endstop detection
- 12.100 M122: Firmware dependent
- 12.101 M123: Firmware dependent
- 12.102 M124: Firmware dependent
- 12.103 M125: Firmware dependent
- 12.104 M126: Open Valve
- 12.105 M127: Close Valve
- 12.106 M128: Extruder Pressure PWM
- 12.107 M129: Extruder pressure off
- 12.108 M130: Set PID P value
- 12.109 M131: Set PID I value
- 12.110 M132: Set PID D value
- 12.111 M133: Set PID I limit value
- 12.112 M134: Write PID values to EEPROM
- 12.113 M135: Set PID sample interval
- 12.114 M136: Print PID settings to host
- 12.115 M140: Set Bed Temperature (Fast)
- 12.116 M141: Set Chamber Temperature (Fast)
- 12.117 M142: Firmware dependent
- 12.118 M143: Firmware dependent
- 12.119 M144: Bed Standby
- 12.120 M146: Set Chamber Humidity
- 12.121 M149: Set temperature units
- 12.122 M150: Set LED color
- 12.123 M154: Auto Report Position
- 12.124 M155: Automatically send temperatures
- 12.125 M160: Number of mixed materials
- 12.126 M163: Set weight of mixed material
- 12.127 M164: Store weights
- 12.128 M165: Set multiple mix weights
- 12.129 M190: Wait for bed temperature to reach target temp
- 12.130 M191: Wait for chamber temperature to reach target temp
- 12.131 M192: Wait for Probe Temperature
- 12.132 M193: Set Laser Cooler Temperature
- 12.133 M200: Set filament diameter
- 12.134 M201: Set max acceleration
- 12.135 M201.1: Set reduced acceleration for special move types
- 12.136 M202: Set max travel acceleration
- 12.137 M203: Firmware dependent
- 12.138 M204: Firmware dependent
- 12.139 M205: Firmware dependent
- 12.140 M206: Firmware dependent
- 12.141 M207: Firmware dependent
- 12.142 M208: Firmware dependent
- 12.143 M209: Enable automatic retract
- 12.144 M210: Set homing feedrates
- 12.145 M211: Disable/Enable software endstops
- 12.146 M212: Set Bed Level Sensor Offset
- 12.147 M214: Set Arc configuration values
- 12.148 M217: Toolchange Parameters
- 12.149 M218: Set Hotend Offset
- 12.150 M220: Set speed factor override percentage
- 12.151 M221: Set extrude factor override percentage
- 12.152 M220: Turn off AUX V1.0.5
- 12.153 M221: Turn on AUX V1.0.5
- 12.154 M222: Set speed of fast XY moves
- 12.155 M223: Set speed of fast Z moves
- 12.156 M224: Enable extruder during fast moves
- 12.157 M225: Disable on extruder during fast moves
- 12.158 M226: G-code Initiated Pause
- 12.159 M226: Wait for pin state
- 12.160 M227: Enable Automatic Reverse and Prime
- 12.161 M228: Disable Automatic Reverse and Prime
- 12.162 M229: Enable Automatic Reverse and Prime
- 12.163 M230: Disable / Enable Wait for Temperature Change
- 12.164 M231: Set OPS parameter
- 12.165 M232: Read and reset max. advance values
- 12.166 M240: Trigger camera
- 12.167 M240: Start conveyor belt motor / Echo off
- 12.168 M241: Stop conveyor belt motor / echo on
- 12.169 M245: Start cooler
- 12.170 M246: Stop cooler
- 12.171 M250: Set LCD contrast
- 12.172 M256: Set LCD brightness
- 12.173 M251: Measure Z steps from homing stop (Delta printers)
- 12.174 M260: i2c Send Data
- 12.175 M260.1: Modbus Write register(s)
- 12.176 M261: i2c Request Data
- 12.177 M261.1: Modbus Read Input Registers
- 12.178 M280: Set servo position
- 12.179 M281: Set Servo Angles
- 12.180 M282: Detach Servo
- 12.181 M290: Babystepping
- 12.182 M291: Display message and optionally wait for response
- 12.183 M292: Acknowledge message
- 12.184 M293: Babystep Z+
- 12.185 M294: Babystep Z-
- 12.186 M300: Play beep sound
- 12.187 M301: Set PID parameters
- 12.188 M302: Allow cold extrudes
- 12.189 M303: Run PID tuning
- 12.190 M304: Set PID parameters - Bed
- 12.191 M305: Set thermistor and ADC parameters
- 12.192 M306: Set home offset calculated from toolhead position
- 12.193 M307: Set or report heating process parameters
- 12.194 M308: Set or report sensor parameters
- 12.195 M309: Set or report heater feedforward
- 12.196 M310: Temperature model settings
- 12.197 M320: Activate autolevel (Repetier)
- 12.198 M321: Deactivate autolevel (Repetier)
- 12.199 M322: Reset autolevel matrix (Repetier)
- 12.200 M323: Distortion correction on/off (Repetier)
- 12.201 M340: Control the servos
- 12.202 M350: Set microstepping mode
- 12.203 M351: Toggle MS1 MS2 pins directly
- 12.204 M355: Turn case lights on/off
- 12.205 M360: Report firmware configuration
- 12.206 SCARA calibration codes (Morgan)
- 12.207 M360: Move to Theta 0 degree position
- 12.208 M361: Move to Theta 90 degree position
- 12.209 M362: Move to Psi 0 degree position
- 12.210 M363: Move to Psi 90 degree position
- 12.211 M364: Move to Psi + Theta 90 degree position
- 12.212 M365: SCARA scaling factor
- 12.213 M366: SCARA convert trim
- 12.214 M370: Morgan manual bed level - clear map
- 12.215 M371: Move to next calibration position
- 12.216 M372: Record calibration value, and move to next position
- 12.217 M373: End bed level calibration mode
- 12.218 M374: Save calibration grid
- 12.219 M375: Display matrix / Load Matrix
- 12.220 M376: Set bed compensation taper
- 12.221 M380: Activate solenoid
- 12.222 M381: Disable all solenoids
- 12.223 M400: Wait for current moves to finish
- 12.224 M401: Deploy Z Probe
- 12.225 M402: Stow Z Probe
- 12.226 M403: Set filament type (material) for particular extruder and notify the MMU
- 12.227 M404: Filament diameter
- 12.228 M405: Filament Sensor on
- 12.229 M406: Filament Sensor off
- 12.230 M407: Display filament diameter
- 12.231 M408: Report JSON-style response
- 12.232 M409: Query object model
- 12.233 M410: Quick-Stop
- 12.234 M412: Disable Filament Runout Detection
- 12.235 M413: Power-Loss Recovery
- 12.236 M415: Host Rescue
- 12.237 M416: Power loss
- 12.238 M420: Firmware dependent
- 12.239 M421: Set a Mesh Bed Leveling Z coordinate
- 12.240 M422: Set a G34 Point
- 12.241 M423: X-Axis Twist Compensation
- 12.242 M424: Global Z Offset
- 12.243 M425: Backlash Correction
- 12.244 M450: Report Printer Mode
- 12.245 M451: Select FFF Printer Mode
- 12.246 M452: Select Laser Printer Mode
- 12.247 M453: Select CNC Printer Mode
- 12.248 M460: Define temperature range for thermistor-controlled fan
- 12.249 M470: Create Directory on SD-Card
- 12.250 M471: Rename File/Directory on SD-Card
- 12.251 M472: Delete File/Directory on SD-Card
- 12.252 M486: Cancel Object
- 12.253 M493: Fixed-Time Motion Control
- 12.254 M500: Store parameters in non-volatile storage
- 12.255 M501: Read parameters from EEPROM
- 12.256 M502: Restore Default Settings
- 12.257 M503: Report Current Settings
- 12.258 M504: Validate EEPROM
- 12.259 M505: Firmware dependent
- 12.260 M509: Force language selection
- 12.261 M510: Lock Machine
- 12.262 M511: Unlock Machine with Passcode
- 12.263 M512: Set Passcode
- 12.264 M513: Remove Password
- 12.265 M524: Abort SD Printing
- 12.266 M530: Enable printing mode
- 12.267 M531: Set print name
- 12.268 M532: Set print progress
- 12.269 M540: Set MAC address
- 12.270 M540 in Marlin/Druid/MK4duo: Enable/Disable "Stop SD Print on Endstop Hit"
- 12.271 M544: Gcode Parser Options
- 12.272 M550: Set Name
- 12.273 M551: Set Password
- 12.274 M552: Set IP address, enable/disable network interface
- 12.275 M553: Set Netmask
- 12.276 M554: Set Gateway and/or DNS server
- 12.277 M555: Set compatibility
- 12.278 M555: Set Bounding Box
- 12.279 M556: Axis compensation
- 12.280 M557: Set Z probe point or define probing grid
- 12.281 M558: Set Z probe type
- 12.282 M558.1: Calibrate height vs. reading for analog Z probe
- 12.283 M558.2: Set, report or calibrate drive current for analog Z probe
- 12.284 M559: Upload configuration file
- 12.285 M560: Upload web page file
- 12.286 M561: Set Identity Transform
- 12.287 M562: Reset temperature fault
- 12.288 M563: Define or remove a tool
- 12.289 M564: Limit axes
- 12.290 M565: Set Z probe offset
- 12.291 M566: Set allowable instantaneous speed change
- 12.292 M567: Set tool mix ratios
- 12.293 M568: Tool settings
- 12.294 M568: Turn off/on tool mix ratios (obsolete meaning in old RepRapFirmware versions)
- 12.295 M569: Stepper driver control
- 12.296 M569.1: Stepper driver closed loop configuration
- 12.297 M569.2: Read or write any stepper driver register
- 12.298 M569.3: Read Motor Driver Encoder
- 12.299 M569.4: Set Motor Driver Torque Mode
- 12.300 M569.5: Collect Data from Closed-loop Driver
- 12.301 M569.6: Execute Closed-loop Driver Tuning Move
- 12.302 M569.7: Configure motor brake port
- 12.303 M569.8: Read Axis Force
- 12.304 M569.9: Sets the driver sense resistor and maximum current
- 12.305 M570: Configure heater fault detection
- 12.306 M571: Set output on extrude
- 12.307 M572: Set or report extruder pressure advance
- 12.308 M573: Report heater PWM
- 12.309 M574: Set endstop configuration
- 12.310 M575: Set serial comms parameters
- 12.311 M576: Set SPI comms parameters
- 12.312 M577: Wait until endstop is triggered
- 12.313 M578: Fire inkjet bits
- 12.314 M579: Scale Cartesian axes
- 12.315 M580: Select Roland
- 12.316 M581: Configure external trigger
- 12.317 M582: Check external trigger
- 12.318 M584: Set drive mapping
- 12.319 M585: Probe Tool
- 12.320 M586: Configure network protocols
- 12.321 M586.4: Configure MQTT server
- 12.322 M587: Store WiFi host network in list, or list stored networks
- 12.323 M588: Forget WiFi host network
- 12.324 M589: Configure access point parameters
- 12.325 M590: Report current tool type and index
- 12.326 M591: Configure filament monitoring
- 12.327 M592: Configure nonlinear extrusion
- 12.328 M593: Configure Input Shaping
- 12.329 M594: Enter/Leave Height Following mode
- 12.330 M595: Set movement queue length
- 12.331 M596: Select movement queue number
- 12.332 M597: Collision avoidance
- 12.333 M598: Sync motion systems
- 12.334 M599: Define keepout zone
- 12.335 M600: Set line cross section
- 12.336 M600: Filament change pause
- 12.337 M601: Pause print
- 12.338 M602: Resume print
- 12.339 M603: Stop print (Prusa i3)
- 12.340 M603: Configure Filament Change
- 12.341 M605: Set dual x-carriage movement mode
- 12.342 M606: Fork input file reader
- 12.343 M650: Set peel move parameters
- 12.344 M651: Execute peel move
- 12.345 M665: Set delta configuration
- 12.346 M666: Set delta endstop adjustment
- 12.347 M667: Select CoreXY mode
- 12.348 M668: Set Z-offset compensations polynomial
- 12.349 M669: Set kinematics type and kinematics parameters
- 12.350 M670: Set IO port bit mapping
- 12.351 M671: Define positions of Z leadscrews or bed leveling screws
- 12.352 M672: Program Z probe
- 12.353 M673: Align plane on rotary axis
- 12.354 M674: Set Z to center point
- 12.355 M675: Find center of cavity
- 12.356 M700: Level plate
- 12.357 M701: Load filament
- 12.358 M702: Unload filament
- 12.359 M703: Configure Filament
- 12.360 M704: Preload_to_MMU
- 12.361 M705: Eject filament
- 12.362 M706: Cut filament
- 12.363 M707: Read from MMU register
- 12.364 M708: Write to MMU register
- 12.365 M709: MMU power & reset
- 12.366 M710: Firmware dependent
- 12.367 M711: Calibrate pressure advance
- 12.368 M750: Enable 3D scanner extension
- 12.369 M751: Register 3D scanner extension over USB
- 12.370 M752: Start 3D scan
- 12.371 M753: Cancel current 3D scanner action
- 12.372 M754: Calibrate 3D scanner
- 12.373 M755: Set alignment mode for 3D scanner
- 12.374 M756: Shutdown 3D scanner
- 12.375 M800: Fire start print procedure
- 12.376 M801: Fire end print procedure
- 12.377 M808: Set or Goto Repeat Marker
- 12.378 M810-M819: G-code macros stored in memory or flash not filename
- 12.379 M850: Sheet parameters
- 12.380 M851: Set Z-Probe Offset
- 12.381 M860 Wait for Probe Temperature
- 12.382 M861 Set Probe Thermal Compensation
- 12.383 M862: Print checking
- 12.384 M871: PTC Configuration
- 12.385 M876: Dialog handling
- 12.386 M890 Run User Gcode
- 12.387 M900: Set Linear Advance Scaling Factors
- 12.388 M905: Set local date and time
- 12.389 M906: Set motor currents
- 12.390 M907: Set digital trimpot motor current
- 12.391 M908: Control digital trimpot directly
- 12.392 M909: Set microstepping
- 12.393 M910: Set decay mode
- 12.394 M910: TMC2130 init
- 12.395 M911: Configure auto save on loss of power ("power panic")
- 12.396 M911: Set TMC2130 holding currents
- 12.397 M912: Set electronics temperature monitor adjustment
- 12.398 M912: Set TMC2130 running currents
- 12.399 M913: Set motor percentage of normal current
- 12.400 M913: Print TMC2130 currents
- 12.401 M914: Set/Get Expansion Voltage Level Translator
- 12.402 M914: Set TMC2130 normal mode
- 12.403 M915: Configure motor stall detection
- 12.404 M915: Set TMC2130 silent mode
- 12.405 M916: Resume print after power failure
- 12.406 M916: Set TMC2130 Stallguard sensitivity threshold
- 12.407 M917: Set motor standstill current reduction
- 12.408 M917: Set TMC2130 PWM amplitude offset (pwm_ampl)
- 12.409 M918: Configure direct-connect display
- 12.410 M918: Set TMC2130 PWM amplitude gradient (pwm_grad)
- 12.411 M928: Start SD logging
- 12.412 M929: Start/stop event logging to SD card
- 12.413 M950: Create heater, fan or GPIO/servo device
- 12.414 M951: Set height following mode parameters
- 12.415 M952: Set CAN expansion board address and/or normal data rate
- 12.416 M953: Set CAN-FD bus fast data rate
- 12.417 M954: Configure as CAN expansion board
- 12.418 M955: Configure Accelerometer
- 12.419 M956: Collect accelerometer data and write to file
- 12.420 M957: Raise event
- 12.421 M958: Excite harmonic vibration
- 12.422 M970: Enable/Disable Phase Stepping
- 12.423 M970.1: Configure Phase Stepping Velocity Constant
- 12.424 M970.2: Configure Phase Stepping Acceleration Constant
- 12.425 M972: Retrieve Current Correction
- 12.426 M973: Set Single Entry in Current Correction Table
- 12.427 M974: Measure Print Head Resonance
- 12.428 M975: Measure Dwarf Accelerometer Sampling Frequency
- 12.429 M976: Measure Print Head Resonance
- 12.430 M977: Calibrate Motor
- 12.431 M995: Calibrate Touch Screen
- 12.432 M997: Perform in-application firmware update
- 12.433 M998: Request resend of line
- 12.434 M999: Restart after being stopped by error
- 13 Other commands
- 13.1 G: List all G-codes
- 13.2 M: List all M-codes
- 13.3 T: Select Tool
- 13.4 D: Debug codes
- 13.4.1 D-1: Endless Loop
- 13.4.2 D0: Reset
- 13.4.3 D1: Clear EEPROM and RESET
- 13.4.4 D2: Read/Write RAM
- 13.4.5 D3: Read/Write EEPROM
- 13.4.6 D4: Read/Write PIN
- 13.4.7 D5: Read/Write FLASH
- 13.4.8 D6: Read/Write external FLASH
- 13.4.9 D7: Read/Write Bootloader
- 13.4.10 D8: Read/Write PINDA
- 13.4.11 D9: Read/Write ADC
- 13.4.12 D10: Set XYZ calibration = OK
- 13.4.13 D12: Time
- 13.4.14 D20: Generate an offline crash dump
- 13.4.15 D21: Print crash dump to serial
- 13.4.16 D22: Clear crash dump state
- 13.4.17 D23: Request emergency dump on serial
- 13.4.18 D80: Bed check
- 13.4.19 D81: Bed analysis
- 13.4.20 D106: Print measured fan speed for different pwm values
- 13.4.21 D2130: Trinamic stepper controller
- 13.4.22 D9125: PAT9125 filament sensor
- 14 Proposed EEPROM configuration codes
- 15 Replies from the RepRap machine to the host computer
- 16 Proposal for sending multiple lines of G-code
- 17 Alternatives to G-code
Introduction
A typical piece of G-code as sent to a RepRap machine might look like this:
N3 T0*57 N4 G92 E0*67 N5 G28*22 N6 G1 F1500.0*82 N7 G1 X2.0 Y2.0 F3000.0*85 N8 G1 X3.0 Y3.0*33
G-code can also be stored in files on SD cards. A file containing RepRap G-code usually has the extension .g
, .gco
or .gcode
.
Files for BFB/RapMan have the extension .bfb
.
G-code stored in file or produced by a slicer might look like this:
G92 E0 G28 G1 F1500 G1 X2.0 Y2.0 F3000 G1 X3.0 Y3.0
The meaning of all those symbols and numbers (and more) is explained below.
Slicers will (optionally?) add G-code scripts to the beginning and end of their output file to perform specified actions before and/or after a print such as z-probing the build-area, heating/cooling the bed and hotend, performing ooze free "nozzle wipe" startup routine, switching system power on/off, and even "ejecting" parts. More info on the Start GCode routines and End GCode routines pages.
To find out which specific G-code(s) are implemented in any given firmware, there are little tables attached to the command descriptions, like this one:
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Partial | ??? | ??? | ??? | ??? | Experimental | ??? | ??? | Partial | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | ??? | Yes | ??? | Yes | Automatic | Yes | ??? |
Here means:
??? | Unknown if the firmware supports this G-code. You may want to test this yourself before using it in production. |
Yes | The G-code is fully supported by the firmware. |
1.23+ | The G-code is supported by version 1.23 and above. |
No | The firmware does not support the G-code at all. |
Partial | There is only partial support for the full G-code specification. It may be required to rebuild the source code with extra options or flip configuration switches on the mainboard. |
Experimental | The G-code is experimental and may change or be removed. |
Automatic | The firmware handles this G-code automatically, so there's no need to send the command. An example is power supply on/off G-code (M80 /M81 ) in the Teacup firmware.
|
For the technically-minded, G-code line endings are Unix Line Endings (\n
), but will accept Windows Line Endings (\r\n
), so you should not need to worry about converting between the two, but it is best practice to use Unix Line Endings where possible.
Fields
A RepRap G-code is a list of fields that are separated by white spaces or line breaks. A field can be interpreted as a command, parameter, or for any other special purpose. It consists of one letter directly followed by a number, or can be only a stand-alone letter (Flag). The letter gives information about the meaning of the field (see the list below in this section). Numbers can be integers (128) or fractional numbers (12.42), depending on context. For example, an X coordinate can take integers (X175
) or fractionals (X17.62
), but selecting extruder number 2.76 would make no sense. In this description, the numbers in the fields are represented by nnn
as a placeholder.
In RepRapFirmware, some parameters can be followed by more than one number, with colon used to separate them. Typically this is used to specify extruder parameters, with one value provided per extruder. If only one value is provided where a value is needed for each extruder, then that value is applied to all extruders.
Letter | Meaning |
---|---|
Gnnn | Standard G-code command, such as move to a point |
Mnnn | RepRap-defined command, such as turn on a cooling fan |
Tnnn | Select tool nnn. In RepRap, a tool is typically associated with a nozzle, which may be fed by one or more extruders. |
Snnn | Command parameter, such as time in seconds; temperatures; voltage to send to a motor |
Pnnn | Command parameter, such as time in milliseconds; proportional (Kp) in PID Tuning |
Xnnn | A X coordinate, usually to move to. This can be an Integer or Fractional number. |
Ynnn | A Y coordinate, usually to move to. This can be an Integer or Fractional number. |
Znnn | A Z coordinate, usually to move to. This can be an Integer or Fractional number. |
U,V,W | Additional axis coordinates (RepRapFirmware) |
Innn | Parameter - X-offset in arc move; integral (Ki) in PID Tuning |
Jnnn | Parameter - Y-offset in arc move |
Dnnn | Parameter - used for diameter; derivative (Kd) in PID Tuning |
Hnnn | Parameter - used for heater number in PID Tuning |
Fnnn | Feedrate in mm per minute. (Speed of print head movement) |
Rnnn | Parameter - used for temperatures |
Qnnn | Parameter - not currently used |
Ennn | Length of extrudate. This is exactly like X, Y and Z, but for the length of filament to consume. |
Nnnn | Line number. Used to request repeat transmission in the case of communications errors. |
*nnn | Checksum. Used to check for communications errors. |
Case sensitivity
The original NIST G-code standard requires gcode interpreters to be case-insensitive, except for characters in comments. However, not all 3D printer firmwares conform to this and some recognise uppercase command letters and parameters only.
- Firmwares that are known to be case-insensitive
- RepRapFirmware version 1.19 and later (except within quoted strings)
- Druid Firmware version 1.00 by default is case-insensitive: ( M544 S0 = case-sensitive / M544 S1 = case-insensitive )
- Firmwares that are known to be case-sensitive
- RepRapFirmware version 1.18 and earlier
- Druid Firmware version 1.00 for case-sensitive: M544 S0 = case-sensitive
Quoted strings
In RepRapFirmware, some commands support quoted strings when providing file names and other string parameters. This allows file names, WiFi passwords etc. to contain spaces, semicolons and other characters that would otherwise not be permitted. Double-quote characters are used to delimit the string, and any double-quote character within the string must be repeated.
Unfortunately, some gcode sender programs convert all characters to uppercase and don't provide any means to disable this feature. Therefore, within a quoted-string, the single-quote character is used as a flag to force the following character to lowercase. If you want to include a single quote character in the string, use two single quote characters to represent one single quote character.
Example: to add SSID MYROUTER with password ABCxyz;" 123
to the WiFi network list, use command:
M587 S"MYROUTER" P"ABCxyz;"" 123"
or if you can't send lowercase characters:
M587 S"MYROUTER" P"ABC'X'Y'Z;"" 123"
Using expressions in parameters
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | ??? | No | ??? | No | No | No | ??? |
RepRapFirmware 3.1 and later allow parameter values to be computed from an expression enclosed in { }. Such an expression may include constants, values from the machine object model, operators and functions. Example:
G1 X{move.axes[0].max-5} Y{move.axes[1].min+5} F6000 ; move to 5mm short of the X and Y axis limits
See https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands for more details.
Comments
G-code comments begin at a semicolon, and end at the end of the line:
N3 T0*57 ; This is a comment N4 G92 E0*67 ; So is this N5 G28*22
Some firmwares also obey the CNC G-code standard, which is to enclose comments in round brackets. Comments of this form must start and end on the same line:
(Home some axes) G28 (here come the axes to be homed) X Y
Comments and white space will be ignored by your RepRap Printer. It's better to strip these out on the host computer before sending the G-code to your printer, as this saves bandwidth.
Special fields
N: Line number
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | ??? | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | ??? | Yes | Yes | Yes | Yes | Yes | ??? |
- Example
N123
If present, the line number should be the first field in a line. For G-code stored in files on SD cards the line number is usually omitted.
If checking is supported, the RepRap firmware expects line numbers to increase by 1 each line, and if that doesn't happen it is flagged as an error. But you can reset the count using M110
(see below).
Although supported, usage of N in Machinekit is discouraged as it serves no purpose.
*: Checksum
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | ??? | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | ??? | Yes | ??? | No | Yes | No | ??? |
Example: *71
If present, the checksum should be the last field in a line, but before a comment. For G-code stored in files on SD cards the checksum is usually omitted.
The firmware compares the checksum against a locally-computed value. If they differ, it requests a repeat transmission of the line.
*: CRC
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | ??? | No | ??? | No | No | No | ??? |
Example: *37428
The 8-bit checksum provides insufficient protection against noise on the received data connection in some situations, for example where the cable from a display device runs close to an extruder cable. Therefore RepRapFirmware allows a CRC to be used in place of a checksum. If present, the CRC should be the last field in a line, but before the semicolon and comment if present. RepRapFirmware assumes that * followed by 5 digits is a CRC, whereas * followed by 1, 2 or 3 digits is a checksum. The polynomial used is 0x1021 as for CCITT CRC16.
Checking
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | ??? | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | ??? | Yes | ??? | No | Yes | No | ??? |
- Example
N123 [...G Code in here...] *71
The RepRap firmware checks the line number and the checksum (or CRC if supported). You can leave both of these out - RepRap will still work, but it won't do checking. You have to have both or neither though. If only one appears, it produces an error.
The checksum "cs" for a G-code string "cmd" (including its line number) is computed by exor-ing the bytes in the string up to and not including the * character as follows:
int cs = 0; for(i = 0; cmd[i] != '*' && cmd[i] != NULL; i++) cs = cs ^ cmd[i]; cs &= 0xff; // Defensive programming...
and the value is appended as a decimal integer to the command after the * character.
Conditional Execution and Loops
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | ??? | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | ??? | No | ??? | No | No | No | ??? |
RepRapFirmware 3.01 and later supports conditions and loops in GCode. Properties from the firmware object model (e.g. current position, current tool) can be included in controlling expressions. See https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands for details.
Buffering
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | ??? | ??? | ??? | ??? | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | ??? | ??? | Yes | ??? | Yes | Yes | Yes | ??? |
If buffering is supported, the RepRap firmware stores some commands in a ring buffer internally for execution. This means that there is no (appreciable) delay while a command is acknowledged and the next transmitted. In turn, this means that sequences of line segments can be plotted without a dwell between one and the next. As soon as one of these buffered commands is received it is acknowledged and stored locally. If the local buffer is full, then the acknowledgment is delayed until space for storage in the buffer is available. This is how flow control is achieved.
Typically, the following moving commands are buffered: G0
-G3
and G28
-G32
. The Teacup Firmware buffers also some setting commands: G20
, G21
, G90
and G91
. All other G
, M
or T
commands are not buffered.
RepRapFirmware also implements an internal queue to ensure that certain codes (like M106) are executed in the right order and not when the last move has been added to the look-ahead queue.
When an unbuffered command is received it is stored, but it is not acknowledged to the host until the buffer is exhausted and then the command has been executed. Thus the host will pause at one of these commands until it has been done. Short pauses between these commands and any that might follow them do not affect the performance of the machine.
G-commands
G0 & G1: Move
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
-
G0
: Rapid Move -
G1
: Linear Move
- Usage
G0 Xnnn Ynnn Znnn Ennn Fnnn Snnn
G1 Xnnn Ynnn Znnn Ennn Fnnn Snnn
- Parameters
- Not all parameters need to be used, but at least one has to be used
Xnnn
The position to move to on the X axisYnnn
The position to move to on the Y axisZnnn
The position to move to on the Z axisEnnn
The amount to extrude between the starting point and ending pointFnnn
The feedrate per minute of the move between the starting point and ending point (if supplied)Hnnn
(RepRapFirmware) Flag to check if an endstop was hit (H1
to check,H0
to ignore, otherHnnn
see note, default isH0
)1Rnnn
(RepRapFirmware) Restore point number 4Snnn
Laser cutter/engraver power. In RepRapFirmware, when not in laser mode S in interpreted the same as H.- Examples
G0 X12 ; move to 12mm on the X axis G0 F1500 ; Set the feedrate to 1500mm/min G1 X90.6 Y13.8 E22.4 ; Move to 90.6mm on the X axis and 13.8mm on the Y axis while extruding 22.4mm of material
The RepRap firmware spec treats G0
and G1
as the same command, since it's just as efficient as not doing so.2
Most RepRap firmwares do subtle things with feedrates.
G1 F1500 ; Set feedrate to 1500mm/min G1 X50 Y25.3 E22.4 ; Move and extrude
In the above example, we first set the feedrate to 1500mm/min, then move to 50mm on X and 25.3mm on Y while extruding 22.4mm of filament between the two points.
G1 F1500 ; Feedrate 1500mm/min G1 X50 Y25.3 E22.4 F3000 ; Accelerate to 3000mm/min
However, in the above example, we set a feedrate of 1500 mm/min, then do the same move, but accelerating to 3000 mm/min. Everything stays synchronized, so extrusion accelerates right along with X and Y movement.
The RepRap spec treats the feedrate as simply another variable (like X, Y, Z, and E) to be linearly interpolated. This gives complete control over the acceleration and deceleration of the printer head in a way that ensures everything moves smoothly together and the right volume of material is extruded at all points.3
To reverse the extruder by a given amount (for example to reduce its internal pressure while it does an in-air movement so that it doesn't dribble) simply use G0
or G1
to send an E
value that is less than the currently extruded length.
- Notes
1Some firmwares allow for the RepRap to enable or disable the "sensing" of endstops during a move. Please check with whatever firmware you are using to see if they support the H
parameter in this way, as damage may occur if you assume incorrectly. In RepRapFirmware, using the H1
or H2
parameter on a delta printer causes the XYZ
parameters to refer to the individual tower motor positions instead of the head position, and to enable endstop detection as well if the parameter is H1. H3 may be used to measure axis lengths and H4 can be used to stop when an endstop is hit while updating the position only (H4 is supported in 3.2-b4 and later).
2In the RS274NGC Spec, G0
is Rapid Move, which was used to move between the current point in space and the new point as quickly and efficiently as possible, and G1
is Controlled Move, which was used to move between the current point in space and the new point as precise as possible. In RepRapFirmware, G1 is always a linear move but G0 may not be linear (e.g. on a SCARA machine); however a G0 move will never go below the lower of the initial and final Z height of the move.
3Some firmwares may not support setting the feedrate inline with a move.
4RepRapFirmware provides an additional 'R' parameter to tell the machine to add the coordinates of the specified restore point to all axis coordinates mentioned in the G0 or G1 command. Axes that are not mentioned in the G0 or G1 command are not moved. When a print is paused, the coordinates are saved in restore point #1. When a tool change is commenced, the coordinates are saved in restore point #2. Coordinates can also be saved in restore points explicity using the G60 command.
Some older machines, CNC or otherwise, used to move faster if they did not move in a straight line. This is also true for some non-Cartesian printers, like delta or polar printers, which move easier and faster in a curve.
G2 & G3: Controlled Arc Move
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes1 | Yes | Yes3 | Yes2 | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | No | No | Yes | Experimental | No | Yes | No |
- Usage
G2 Xnnn Ynnn Innn Jnnn Ennn Fnnn
(Clockwise Arc)G3 Xnnn Ynnn Innn Jnnn Ennn Fnnn
(Counter-Clockwise Arc)- Parameters
Xnnn
The position to move to on the X axisYnnn
The position to move to on the Y axisZnnn
The position to move to on the Z axis (optional, may not be supported in some firmwares)Innn
The point in X space from the current X position to maintain a constant distance fromJnnn
The point in Y space from the current Y position to maintain a constant distance fromEnnn
The amount to extrude between the starting point and ending pointFnnn
The feedrate per minute of the move between the starting point and ending point (if supplied)Knnn
The point in Z space from the current Z position to maintain a constant distance from (used only when the current plane is YZ or ZX - see G18 and G19)Rnnn
The radius of the arc (can be used in place of I and J, may not be supported in some firmwares)- Examples
G2 X90.6 Y13.8 I5 J10 E22.4
(Move in a Clockwise arc from the current point to point (X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)
G3 X90.6 Y13.8 I5 J10 E22.4
(Move in a Counter-Clockwise arc from the current point to point (X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)
- Notes
1In Marlin Firmware not implemented for DELTA printers.
2Prusa Firmware implements arcs only in Cartesian XY.
3On Klipper, a gcode_arcs
section must be enabled in the configuration file.
G4: Dwell
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Pause the machine for a period of time.
- Parameters
Pnnn
Time to wait, in milliseconds (In Teacup, P0, wait until all previous moves are finished)Snnn
Time to wait, in seconds (Only on Repetier, Marlin, Prusa, Smoothieware, and RepRapFirmware 1.16 and later)- Example
G4 P200
In this case sit still doing nothing for 200 milliseconds. During delays the state of the machine (for example the temperatures of its extruders) will still be preserved and controlled.
On Marlin, Smoothie and RepRapFirmware, the "S" parameter will wait for seconds, while the "P" parameter will wait for milliseconds. "G4 S2" and "G4 P2000" are equivalent.
G6: External Motion Control (Marlin)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.1.2 | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
With DIRECT_STEPPING
enabled Marlin can receive low-level stepper movement commands from a host device (e.g., OctoPrint with a plugin) in a compact binary format, so all acceleration and other motion tuning can be done on the host side.
The commands are routed directly to page storage on the printer by a "page manager" system on the host side. The page manager operates in parallel with the usual G-code commands over the USB serial connection. The host is thus able to load data onto the machine quickly alongside regular G-code processing.
The G6 command triggers the movements stored in the pages by referencing the corresponding page. Depending on the format, direction arguments may also be needed in the G6 command.
Requires Step Daemon by @ColinRGodsey. See the Direct Stepping article for more information.
- Parameters
I(index)
Set page indexR(rate)
Step rate per second. Last value is cached for future invocations.S(rate)
Number of steps to take. Defaults to max steps.X(direction)
1 for positive, 0 for negative. Last value is cached for future invocations. Not used for directional formats.Y(direction)
1 for positive, 0 for negative. Last value is cached for future invocations. Not used for directional formats.Z(direction)
1 for positive, 0 for negative. Last value is cached for future invocations. Not used for directional formats.E(direction)
1 for positive, 0 for negative. Last value is cached for future invocations. Not used for directional formats.
G6: Direct Stepper Move (Druid)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Use G1 S2 or G1 H2 instead | No | No | No | No | No | Yes | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Perform a direct, uninterpolated, and non-kinematic synchronized move of one or more steppers directly. Units may be linear (e.g., mm or inches on DELTA
) or specified in degrees (SCARA). This command is useful for initialization, diagnostics, and calibration, and should be disabled on production equipment. This type of move can be potentially dangerous, especially for deltabots, so implementations should do their best to limit movement to prevent twerking and damaging the carriage assembly.
- Parameters
Annn
Stepper A position or angleBnnn
Stepper B position or angleCnnn
Stepper C position or angleR
Relative move flag- SCARA Examples
G6 A45 ; Move SCARA A stepper to the 45° position G6 B20 R ; Move SCARA B stepper 20° counter-clockwise
- DELTA Example
G6 C10 R ; Move DELTA C carriage up by 10mm
G10: Set tool Offset and/or workplace coordinates and/or tool temperatures
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | Yes | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | Yes | No | No | Yes | ??? |
- Usage
G10 Lnnn Pnnn Xnnn Ynnn Znnn Rnnn Snnn
1- Parameters
Pnnn
Tool numberLnnn
Offset mode 5Xnnn
X offsetYnnn
Y offsetZnnn
Z offset2U,V,W,A,B,Cnnn
other axis offsets4Rnnn
Standby temperature(s) (RepRapFirmware)Snnn
Active temperature(s) (RepRapFirmware)- Examples
G10 L1 P2 X17.8 Y-19.3 Z0.0
(sets the offset for tool 2 to the X, Y, and Z values specified)
G10 P1 R140 S205
(RepRapFirmware only - set standby and active temperatures3 for tool 1)
Remember that any parameter that you don't specify will automatically be set to the last value for that parameter. That usually means that you want explicitly to set Z0.0. RepRapFirmware will report the tool parameters if only the tool number is specified.
The precise meaning of the X, Y (and other offset) values is: with no offset this tool is at this position relative to where a tool with offset (0, 0, 0) would be. So if the tool is 10mm to the left of a zero-offset tool the X value would be -10, and so on.
The R
value is the standby temperature in oC that will be used for the tool, and the S
value is its operating temperature. If you don't want the tool to be at a different temperature when not in use, set both values the same. See the T code (select tool) below. In tools with multiple heaters the temperatures for them all are specified thus: R100.0:90.0:20.0 S185.0:200.0:150.0 .
See also M585
.
- Notes
1Marlin uses G10/G11 for executing a retraction/unretraction move. Smoothie uses G10
for retract and G10 Ln
for setting workspace coordinates. RepRapFirmware interprets a G10 command with no P or L parameter as a retraction command.
2It's usually a bad idea to put a non-zero Z
value in as well unless the tools are loaded and unloaded by some sort of tool changer or are on indepedent carriages. When all the tools are in the machine at once they should all be set to the same Z height.
3If the absolute zero temperature (-273.15) is passed as active and standby temperatures, RepRapFirmware will only switch off the tool heater(s) without changing their preset active or standby temperatures. RepRapFirmware-dc42 does not support this setting.
4Tool offsets are applied after any X axis mapping has been performed. Therefore if for example you map X to U in your M563
command to create the tool, you should specify a U offset not an X offset. If you map X to both X and U, you can specify both offsets. (Not supported on all firmwares).
5L1 sets the offsets of the specified tool relative to the head reference point to the specified values. L2 sets the current workplace coordinate offsets to the specified values. L20 adjusts the current workplace coordinate offsets so that the current tool head position has the specified coordinates. NOTE on some firmwares L is required (and is required by NIST standard). P is also required to specify either the tool to update or the WCS to update.
G10: Retract
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | 0.92 | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
Snnn
retract length (S1 = long retract, S0 = short retract = default) (Repetier only)- Example
G10
Retracts filament according to settings of M207
(Marlin, RepRapFirmware) or according to the S
value (Repetier).
RepRapFirmware recognizes G10
as a command to set tool offsets and/or temperatures if the P
parameter is present, and as a retraction command if it is absent.
G11: Unretract
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | 0.92 | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
Snnn
retract length (S1 = long retract, S0 = short retract = default) (Repetier only)- Example
G11
Unretracts/recovers filament according to settings of M208
(Marlin, RepRapFirmware) or according to the S
value (Repetier).
G12: Clean Tool
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0 | Use a macro instead | ??? | No | No | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | No |
- Usage
[P<0|1>] [S<count>] [T<count>]
G12 Pnnn Snnn Tnnn
- Parameters
Pnnn
1 Pattern style selectionSnnn
Number of strokes (i.e. back-and-forth movements)Tnnn
Number of repetitionsEnnn
0=Never 1=Always apply software endstops (Marlin 2.0.6+)- Examples
G12 ; stroke pattern (default)
To generate a three triangle zig-zag pattern which will be stroked three times time use the following command. G12 P1 S3 T2 ; zig-zag pattern with 2 triangles
- Notes
1In Marlin firmware and Derivatives Mk4duo this is implemented by hard-coded firmware behaviours As defined for variables NOZZLE_CLEAN_STROKES, NOZZLE_CLEAN_START_POINT, NOZZLE_CLEAN_END_POINT and NOZZLE_CLEAN_PARK.
With NOZZLE_CLEAN_PARK enabled, the nozzle will automatically return to the XYZ position after G12 is run.
More on this behaviour is documented inside of the code base.
The use of G12 for tool cleaning clashes with the established use of G12 for circular pocket milling on CNC machines. For this reason, RepRapFirmware does not support G12.
G17..19: Plane Selection (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.4 | G18 and G19 need RRF 3.3 or later | ??? | No | No | ??? | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | ??? | ??? | ??? | Yes | No | ??? | Yes | ??? |
These codes set the current plane as follows:
-
G17
: XY (default) -
G18
: ZX -
G19
: YZ
This mode applies to G2
/G3
arc moves. Normal arc moves are in the XY plane, and for most applications that's all you need. For CNC routing it can be useful to do small "digging" moves while making cuts, so to keep the G-code compact it uses G2
/G3
arcs involving the Z plane.
These commands are supported in Marlin 1.1.4 and later with ARC_SUPPORT
and CNC_WORKSPACE_PLANES
enabled.
G20: Set Units to Inches
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | No | No | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | No | Yes | Yes | No | Yes | Yes | No |
- Example
G20
Units from now on are in inches. In RepRapFirmware, the inches/mm setting applies to regular printing and travel moves (G0, G1, G2 etc.) but not to configuration commands. Therefore configuration should be done in mm.
When executing a macro file, RepRapFirmware remembers the initial inches/mm setting and restores it after execution of the macro has completed.
G21: Set Units to Millimeters
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | No | No | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ??? |
- Example
G21
Units from now on are in millimeters. (This is the RepRap default.)
In RepRapFirmware, the inches/mm setting applies to regular printing and travel moves (G0, G1, G2 etc.) but not to configuration commands. Therefore configuration should be done in mm.
When executing a macro file, RepRapFirmware remembers the initial inches/mm setting and restores it after execution of the macro has completed. So a macro file such as pause.g (executed when a pause command is received) can safely use G21 at the start to switch the units to mm without affecting the job after the macro completes, regardless of whether the job was using inches or mm.
G22: Firmware Retract
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
G10 | Use G10 | ??? | No | G10 | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | No | No | No | No |
- Usage
G22 ; Do a retract move
Use this command (along with G23
) to have the firmware to do retraction moves (in contrast to generating an E axis G1
move). The retract length and speed are set in the firmware.
G23: Firmware Recover
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
G11 | Use G11 | ??? | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | No | No | No | No |
- Usage
G23 ; Do a recover move
Use this command (along with G22
) to have the firmware to do a recover move. The recover length and speed are set in the firmware.
G26: Mesh Validation Pattern
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0 | No | No | No | Yes | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
G26 C P O2.25 ; Do a typical test sequence
The G26
Mesh Validation Pattern is designed to be used in conjunction with various Mesh Bed Leveling systems – those that adjust for an uneven —rather than just tilted— bed. The G26
command prints a single layer pattern over the entire print bed, giving a clear indication of how accurately every mesh point is defined. G26
can be used to determine which areas of the mesh are less-than-perfect and how much to adjust each mesh point.
G26
has large feature list, including a built-in test that extrudes material onto the bed. By default this is configured for PLA temperatures and a nozzle size of 0.4mm. (This will be adjustable in an upcoming version of Marlin.)
See the G26_Mesh_Validation_Tool.cpp
file in the Marlin source code for full documentation of the G26
parameter list.
G27: Park toolhead
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0 | No | No | No | Yes1 | No | No | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Park the toolhead (i.e., nozzle) at a predefined XY position, with a Z raise value that applies over 0 or over the current position depending on the P
parameter.
In Marlin this G-code is enabled by NOZZLE_PARK_FEATURE
and the park position is defined by NOZZLE_PARK_POINT
. See G27 Park Toolhead for details.
- Usage
G27 Xnnn Ynnn Znnn Pn
- Parameters
- Not all parameters need to be used, but at least one has to be used
Xnnn
X park position 1Ynnn
Y park position 1Znnn
Z park position 1Pn
[value] Z action-
0
(Default) Relative raise by NOZZLE_PARK_Z_RAISE_MIN before XY parking -
1
(Default) Absolute move to NOZZLE_PARK_POINT.z before XY parking. This may move the nozzle down, so use with caution! -
2
Relative raise by NOZZLE_PARK_POINT.z before XY parking.
-
- Examples
G27 P0 ; Park, raising Z by NOZZLE_PARK_Z_RAISE_MIN, using NOZZLE_PARK_POINT.z as a safe height over 0 G27 P1 ; Park, raising Z to at least NOZZLE_PARK_POINT.z over 0 G27 P2 ; Park, raising Z by NOZZLE_PARK_POINT.z over the current Z
G28: Move to Origin (Home)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes2 | Yes3 | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes1 | Yes |
- Usage
G28 Xnnn Ynnn Znnn I N O P Rnnn S W C
- Parameters
- This command can be used without any additional parameters.
X
Flag to go back to the X axis originY
Flag to go back to the Y axis originZ
Flag to go back to the Z axis originI
imprecise: do not perform precise refinement 3L
Force leveling state ON (if possible) or OFF after homing (Requires RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28) 3N
No-change mode (do not change any motion setting such as feedrate) 3O
Home only if the position is not known and trusted 3P
Do not check print sheet presence 3R
<linear> Raise by n mm/inches before homing 3S
Simulated homing only in MARLIN_DEV_MODE 3W
Suppress mesh bed leveling if `X`, `Y` or `Z` are not provided 2C
Calibrate X and Y origin (home) - Only on MK3/s 2
- Examples
G28 ; Home all axes (On Prusa i3 MK2/s,MK2.5/s,MK3/s it will also perform mesh bed leveling)2 G28 X Z ; Home the X and Z axes
When the firmware receives this command, it quickly moves the specified axes (or all axes if none are given) to the endstops, backs away from each endstop by a short distance, and slowly bumps the endstop again to increase positional accuracy. This process, known as "Homing", is required to determine the position of the print carriage(s). Some firmware may even forbid movement away from endstops and other operations until the axes have been homed.
The X
, Y
, and Z
parameters act only as flags. Any coordinates given are ignored. For example, G28 Z10
results in the same behavior as G28 Z
. Delta printers cannot home individual axes, but must always home all three towers, so the X Y Z
parameters are simply ignored on these machines.
Marlin firmware (version 1.1.0 and later) provides an option called Z_SAFE_HOMING
for printers that use a Z probe to home Z instead of an endstop. With this option, the XY axes are homed first, then the carriage moves to a position –usually the middle of the bed– where it can safely probe downward to home Z.
RepRapFirmware uses macro files to home either all axes or individual axes. If all axes are homed, the file homeall.g
is processed. For individual axes the homex.g
, homey.g
, or homez.g
file will be used. On Delta printers, G28
command will always home all three towers by processing the homedelta.g
file, regardless of any X
Y
Z
parameters.
Because the behavior of G28
is unspecified, it is recommended not to automatically include G28
in your ending G-code. On a Cartesian this will result in damaging the printed object. If you need to move the carriage at the completion of a print, use G0
or G1
.
- Notes
1 MK4duo has a B
parameter that tells the printer to return to the coordinates it was at before homing.
2 Original Prusa i3 MK2/s, MK2.5/s, MK3/s supports a W
parameter to suppress mesh bed leveling. If W
is omitted, G28 will home only and NOT perform mesh bed leveling.
Original Prusa i3 MK3/s (TMC2130 drivers) supports a C
parameter to calibrate the X and Y home position.
W
Suppress mesh bed leveling (Prusa MK2/s, MK2.5/s and MK3/s only)2C
Calibrate X and Y home position (Prusa MK3/s only)2
G29: Detailed Z-Probe
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | 1.17+ | ??? | G811 | Yes | 0.91.7 | No: see G32 | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | Yes | No | No | ??? |
This command uses a probe to measure the bed height at 3 or more points to determine its tilt and overall flatness. It then enables compensation so that the nozzle will remain parallel to the bed. The printer must be homed with G28
before using this command.
Each firmware behaves differently and depends on the type of bed leveling that's been configured. For example, Marlin 1.0.2 provides 3 different types of automatic bed leveling (probe required) and a manual bed leveling option. See your firmware's documentation for the specific options available.
- Usage
G29
G29 Snnn
- Parameters
Snnn
Firmware-dependent behaviorPfile.csv
Optional file name for bed height map file (RepRapFirmware only)- Examples
G29 ; Probe the bed and enable compensation G29 S2 ; Special operation - see below G29 P1 ; UBL automated probe - see below
G29 Auto Bed Leveling (Marlin - MK4duo)
Marlin 1.0.2 and earlier provides three options for automatic bed leveling:
- The 3-point method probes the bed at three points to produce a matrix, adjusting for a flat but tilted bed.
- The planar grid method (non-Delta) probes a grid pattern to produce a matrix by the "least-squares" method, adjusting for a flat but tilted bed.
- The bilinear grid method (Delta only) probes a grid pattern to produce a mesh, using bilinear interpolation to adjust for an uneven bed.
Marlin 1.1.0 and later allows the bilinear grid (i.e., "mesh") method to be used on all types of machines, not just deltas. This is the recommended leveling method going forward.
Also in Marlin 1.1.0 and later, the PROBE_MANUALLY
option allows all forms of Auto Bed Leveling to be used without a probe. The procedure is similar to that of MESH_BED_LEVELING
(see below). Begin the process with G29
to move the nozzle to the first point. Adjust the Z axis using G1
or your host software. Send G29
again to move to the next point and repeat until all points have been sampled.
- Parameters
P
Set the size of the grid that will be probed (P x P points). Not supported by non-linear delta printer bed leveling. Example:G29 P4
S
Set the XY travel speed between probe points (in units/min)D
Dry-Run mode. Just evaluate the bed Topology - Don't apply or clean the rotation Matrix. Useful to check the topology after a first run of G29.V
Set the verbose level (0-4). Example:G29 V3
T
Generate a Bed Topology Report. Example:G29 P5 T
for a detailed report. This is useful for manual bed leveling and finding flaws in the bed (to assist with part placement). Not supported by non-linear delta printer bed leveling.F
Set the Front limit of the probing gridB
Set the Back limit of the probing gridL
Set the Left limit of the probing gridR
Set the Right limit of the probing grid
- Global Parameters
E
By defaultG29
will engage the Z probe, test the bed, then disengage. IncludeE
orE1
to engage/disengage the Z probe for each sample. (This has no effect for fixed probes.)
G29 Unified Bed Leveling (Marlin - MK4duo)
Marlin firmware (version 1.1.0 and later) includes the AUTO_BED_LEVELING_UBL
option for Unified Bed Leveling. UBL combines mesh leveling, tilted plane adjustment, 3-point leveling, and manual editing tools all together in a single package. To accomplish so much, UBL overloads `G29` with several new parameters and provides an additional G26
Mesh Tuning feature.
See the MarlinFW website for a dedicated Unified Bed Leveling page and complete documentation on `G29` for UBL and `G26` Mesh Validation.
- G29 UBL Parameters (synopsis)
A Activate Activate the Unified Bed Leveling system. (i.e., M420 S1) D Disable Disable the Unified Bed Leveling system. (i.e., M420 S0) B# Business Do Manual Probing in 'Business Card' mode. H# Height Height to raise the nozzle after each Manual Probe of the bed. C Continue Continue, Constant, or Current Location, depending on Phase. E Every Stow the probe after every sampled point. F# Fade Fade leveling compensation gradually, until it ceases at the given height. I# Invalidate Invalidate a specified number of Mesh Points (X and Y). J# Grid Do a grid (planar) leveling of the current Mesh using a grid with n points on a side. K# Kompare Compare (diff) current Mesh with stored Mesh #, replacing current Mesh with the result. L Load Load Mesh from the previously activated location in the EEPROM. L# Load Load Mesh from the specified location in the EEPROM. S Store Store the current Mesh in the Activated area of the EEPROM. Also save all settings. S # Store Store the current Mesh at the specified area in EEPROM, set as the Activated area. S -1 Store Store the current Mesh as a print-out suitable to be fed back into the system. O Map Display the Mesh Map Topology. P0 Phase 0 Zero Mesh Data and turn off the Mesh Compensation System. P1 Phase 1 Invalidate the Mesh and do Automatic Probing to generate new Mesh data. P2 Phase 2 Probe unpopulated areas of the Mesh (those that couldn't be auto-probed). P3 Phase 3 Fill unpopulated Mesh points with a fixed value. No 'C' for "smart fill" extrapolation. P4 Phase 4 Fine tune the Mesh. ** Delta Mesh Compensation requires an LCD panel. ** P5 Phase 5 Find Mean Mesh Height and Standard Deviation. P6 Phase 6 Shift Mesh height. All Mesh points are adjusted by the amount specified with 'C'. Q Test Load specified Test Pattern to help check system operation. R # Repeat Repeat the command the specified number of times. Default: grid points X * Y. T 3-Point Perform a 3-Point Bed Leveling on the current Mesh. U Unlevel Perform a probe of the outer perimeter to assist in physically leveling the bed. W What? Print a report of Unified Bed Leveling stored data. X # The X location for the command Y # The Y location for the command Z Zero Do a single probe to set the Z Height of the nozzle. Z # Zero Raise/lower the entire Mesh to conform with the specified difference (plus zprobe_zoffset).
G29 Manual Bed Leveling (Marlin - MK4duo)
Marlin firmware (version 1.0.2 and later) also provides a MESH_BED_LEVELING
feature that can be used to perform bed leveling on machines lacking a probe. This form of bed leveling compensates for uneven Z height across the surface of the bed using a mesh and bilinear interpolation.
- Manual Bed Leveling Usage
G29 S1 ; Move to the first point and wait for a measurement G29 S2 ; Store the current Z, move to the next point G29 S3 Xn Yn Zn.nn ; Modify the Z height of a single point
- Options for the
S
parameter S0
Produces a mesh reportS1
Start probing mesh pointsS2
Probe the next mesh pointS3 Xn Yn Zn.nn
Manually modify a single pointS4 Zn.nn
Set z offset. Positive away from bed, negative closer to bed.
G29 Auto Bed Leveling (Repetier-Firmware)
Repetier firmware since v0.91 supports G29
with the optional Snnn parameter as described below. Useful to simply detect the Z bed angle so you can manually readjust your bed and get it as close to in plane as possible. If you wish to apply automatic software Z plane compensation on Repetier, use G32
instead with firmware 0.92.8 and above.
S0
Default value. Z bed heights are calculated at the measured points, relative to current Z position before issuingG29
.S1
Same asS0
, except printer immediately moves to Z maximum position (Z max endstop required!), and calculates new Z maximum height. You must first issueG28 Z
to home to Z maximum position before issuingG29 Snnn
for this to work correctly, or the printer height will be invalid.S2
Same asS1
, except new calculated Z height is also stored to EEPROM.
G29 Mesh Bed Compensation (RepRapFirmware)
RepRapFirmware:
S0
(default if noS
parameter) Probe the bed, save the height map in a file on the SD card, and activate the height map. The default folder for the height map file is/sys
and the default file name isheightmap.csv
.S1
Load the height map from file and activate bed compensation. The default folder and filename as forS0
.S2
Clear the currently-loaded bed height map
To define the grid, see M557.
In RepRapFirmware 3.2 and later, G29 runs macro file mesh.g if it exists, otherwise it behaves like G29 S0. The mesh.g file can perform other actions (e.g. homing or tool selection) and then use G29 S0 to do the probing.
- Notes
In Prusa Firmware G29
is not active by default, instead G81 is used.1
G29.1: Set Z probe head offset
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M851 | No | ??? | M851 | M851 | No | No | No | M851 | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | No | No | No | No |
- Example
G29.1 X30 Y20 Z0.5
Set the offset of the Z probe head. The offset will be subtracted from all probe moves.
G29.2: Set Z probe head offset calculated from toolhead position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | No | No | No | No |
- Example
G29.2 Z0.0
Set the offset of the Z probe head. The offset will be subtracted from all probe moves. The calculated value is derived from the distance of the toolhead from the current axis zero point.
The user would typically place the toolhead at the zero point of the axis and issue the G29.2
command.
G30: Single Z-Probe
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | No2 | Yes | Yes | Yes | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | Yes | G28,G92 | No1 | No |
- Usage
G30 Pnnn Xnnn Ynnn Znnn Hnnn Snnn
- Parameters
Pnnn
Probe point numberXnnn
X coordinateYnnn
Y coordinateZnnn
Z coordinateHnnn
Height correctionSnnn
Set parameter- Example
G30
- Examples (RepRapFirmware)
G30 ; Probe the bed at the current XY position. When the probe is triggered, set the Z coordinate to the probe trigger height. G30 S-1 ; Probe the bed at the current XY position. When the probe is triggered, do not adjust the Z coordinate. G30 P0 X20 Y50 Z-99999 ; Probe the bed at X20 Y50 and save the XY coordinates and the height error as point 0 G30 P3 X180 Y180 Z-99999 S4 ; Probe the bed at X180 Y180, save the XY coordinates and the height error as point 3 and calculate 4-point compensation or calibration G30 P3 X180 Y180 Z-99999 S-1 ; As previous example but just report the height errors
In its simplest form probes bed at current XY location.
RepRapFirmware supports additional behaviour: if a Pn
field is specified the probed X
, Y
, and Z
values are saved as point n on the bed for calculating the offset plane or for performing delta printer calibration. If X
, Y
, or Z
values are specified (e.g. G30 P1 X20 Y50 Z0.3
) then those values are used instead of the machine's current coordinates. A silly Z
value (less than -9999.0) causes the machine to probe at the current point to get Z, rather than using the given value. If an S field is specified (e.g. G30 P1 Z0.3 S
) the bed plane is computed for compensation and stored. The combination of these options allows for the machine to be moved to points using G1
commands, and then probe the bed, or for the user to position the nozzle interactively and use those coordinates. The user can also record those values and place them in a setup G-code file for automatic execution.
RepRapFirmware uses the value of the S
parameter to specify what computation to perform. If the value is -1 then the Z offsets of all the points probed are printed, but no calibration is done. If the value is zero or not present, then this specifies that the number of factors to be calibrated is the same as the number of points probed. Otherwise, the value indicates the number of factors to be calibrated, which must be no greater than the number of points probed. In version 1.09, the number of factors may be 3, 4 or 5 when doing auto bed compensation on a Cartesian or CoreXY printer, and 3, 4, 6 or 7 when doing auto calibration of a Delta printer.
RepRapFirmware supports an optional H
parameter, which is a height correction for that probe point. It allows for the Z probe having a trigger height that varies with XY position. The nominal trigger height of the Z probe (e.g. at bed centre) is declared in the Z
parameter of the G31
command in the config.g file. When you probe using G30
and the probe triggers, the firmware will assume that the nozzle is at the nominal trigger height plus the value you have in the H
parameter.
1MK4duo Firmware support an optional parameter for Delta.
- Usage
G30 Xnnn Ynnn S Z P
- Parameters
Xnnn
X coordinateYnnn
Y coordinateSn
Stows the probe if 1 (default=1)Zn
<bool> with a non-zero value will apply the result to current delta_heightPn
<bool> with a non-zero value will apply the result to current zprobe_zoffset
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.2
G31: Set or Report Current Probe status
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | 0.91.7 | Yes | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | ??? |
- Usage
G31 Pnnn Xnnn Ynnn Znnn Cnnn Snnn
- Parameters
Pnnn
Trigger valueXnnn
Probe X offset1Ynnn
Probe Y offset1Znnn
Trigger Z heightCnnn
Temperature coefficient(s) of trigger height2Snnn
Calibration temperature2Tnnn
(RepRapFirmware 1.17 and later) Z probe type to which these parameters apply, defaults to the current Z probe type as defined byM558 P
parameter- Examples
G31 P500 Z2.6 G31 X16.0 Y1.5
When used on its own this reports whether the Z probe is triggered, or gives the Z probe value in some units if the probe generates height values. If combined with a Z and P field (example: G31 P312 Z0.7
) this will set the Z height to 0.7mm when the Z-probe value reaches 312 when a G28 Z0
(zero Z axis) command is sent. The machine will then move a further -0.7mm in Z to place itself at Z = 0. This allows non-contact measuring probes to approach but not touch the bed, and for the gap left to be allowed for. If the probe is a touch probe and generates a simple 0/1 off/on signal, then G31 Z0.7
will tell the RepRap machine that it is at a height of 0.7mm when the probe is triggered.
In RepRapFirmware, separate G31
parameters may be defined for different probe types (i.e. 0+4 for switches, 1+2 for IR probes and 3 for alternative sensors). To specify which probe you are setting parameters for, send a M558 command to select the probe type before sending the G31
command, or use the T
parameter.
In Repetier, G31
supports no parameters and simply prints the high/low status of the Z probe.
- Notes
1X and Y offsets of the Z probe relative to the print head (i.e. the position when the empty tool is selected) can be specified in RepRapFirmware. This allows you to calculate your probe coordinates based on the geometry of the bed, without having to correct them for Z probe X and Y offset.
2In RepRapFirmware, additional parameters 'S' (bed temperature in oC at which the specified Z
parameter is correct, default is current bed temperature) and 'C' (temperature coefficient of Z
parameter in mm/oC, default zero) can be set for the alternative (ultrasonic) sensor. This is useful for probes that are affected by temperature such as PINDA. RepRapFirmware 3.1 and later allow both first and second order temperature coefficients to be specified, e.g. C0.015:0.001.
G31: Dock Z Probe sled
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | No1 | ??? | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | Yes | No | No | No |
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.1
G32: Probe Z and calculate Z plane
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
G29 | Yes | No | G29 | G29 | 0.92.8+ | Yes | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
G32 ; Probe and calculate G32 Snnn ; Each firmware has its own parameters G32 Snnn Pnnn ; Refer to their specific documentation
This command is implemented as a more sophisticated form of bed leveling (which uses a transformation matrix or motorized correction. Smoothieware uses this code instead of `G29`.
Each firmware behaves differently. For example, Repetier firmware allows for motorized rotation of the bed whilst ReprapFirmware probes the bed with a transformation matrix.
Probe and calculate in Reprapfirmware
RepRapFirmware executes macro file bed.g
in response to the G31 command. The bed.g
file is typically used to probe the bed and then perform delta calibration if the printer is a delta, or to perform individual leadscrew adjustment to level the bed if the printer has multiple independently-controlled Z motors, or to advise the user on how much to adjust each bed levelling adjustment screw.
Probe and calculate in Repetier firmware
This command probes the bed at 3 or more pre-defined points and implements bed leveling compensation by either moving the A axis during printing (as with regular bed leveling, G29
) or by tilting the bed with motors.
- Parameters
Snnn
Bed leveling methodPnnn
Bed correction method
The values for Snnn and Pnnn are as follows:
S0
This method measures at the 3 probe points and creates a plane through these points. If you have a really planar bed this gives the optimum result. The 3 points must not be in one line and have a long distance to increase numerical stability.S1
This measures a grid. Probe point 1 is the origin and points 2 and 3 span a grid. We measure BED_LEVELING_GRID_SIZE points in each direction and compute a regression plane through all points. This gives a good overall plane if you have small bumps measuring inaccuracies.S2
Bending correcting 4 point measurement. This is for cantilevered beds that have the rotation axis not at the side but inside the bed. Here we can assume no bending on the axis and a symmetric bending to both sides of the axis. So probe points 2 and 3 build the symmetric axis and point 1 is mirrored to 1m across the axis. Using the symmetry we then remove the bending from 1 and use that as plane.P0
Use a rotation matrix. This will make z axis go up/down while moving in x/y direction to compensate the tilt. For multiple extruders make sure the height match the tilt of the bed or one will scratch. This is the default.P1
Motorized correction. This method needs a bed that is fixed on 3 points from which 2 have a motor to change the height. The positions are defined in firmware by BED_MOTOR_1_X, BED_MOTOR_1_Y, BED_MOTOR_2_X, BED_MOTOR_2_Y, BED_MOTOR_3_X, BED_MOTOR_3_Y Motor 2 and 3 are the one driven by motor driver 0 and 1. These can be extra motors like Felix Pro 1 uses them or a system with 3 z axis where motors can be controlled individually like the Sparkcube does. This method requires a Z max endstop.
G32: Undock Z Probe sled
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | No1 | No | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | Yes | No | No | No |
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.1
G33: Firmware dependent
G33: Measure/List/Adjust Distortion Matrix (Repetier - Redeem)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | 0.92.8+ | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | Yes | No | No | No |
- Usage
G33
G33 Lnnn
G33 Rnnn
G33 Xnnn Ynnn Znnn
- Parameters
L0
List distortion matrix in a reportR0
Reset distortion matrixX[pos] Y[pos] Z[zCorrection]
Set correction for nearest point- Examples
G33 G33 R0
When used with no parameters, G33
will measure a grid of points and store the distortion dips and valleys in the bed surface, and then enable software distortion correction for the first few or several layers. The values will be stored in EEPROM if enabled in firmware. You must previously have G28
homed, and your Z minimum/maximum height must be set correctly for this to work. Use the optional parameters to list, reset or modify the distortion settings. Distortion correction behavior can be later turned on or off by code M323
.
G33: Delta Auto Calibration (Marlin 1.1.x - MK4duo)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Use G32 | ??? | No | No | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
End-stops and tower angle corrections are normalized (P0);
Performs a 1-4-7 point calibration of delta height (P1), end-stops, delta radius (P2) and tower angle corrections (P>=3) by a least squares iteration process based on the displacement method.
- Usage
G33
G33 Pn T Cx.xx Fn Vn E O Rx.xx
- Parameters
Pn
Number of probe points: n*n (n= 0-10), when P is omitted the default set in Configuration.h is used.T
Do not calibrate tower angle corrections (if used with P>=3); do not use the probe points near the towers, but the probe points opposite to the towers (if used with P=2)Cx.xx
Force the iterations to stop when a standard deviation from the zero plane less then x.xx mm is achieved; when C is omitted the iterations go on until the best possible standard deviation is reached.Fn
Force to run at least n iterations (n=1-30) and take the best resultVn
Verbose level: (n=0-3) 0 = dry run without calibration; 1(default) = settings at start and end; 2 = settings at all iterations; 3 = settings and probe resultsE
Engage the probe for each pointO
Do not probe at the required kinematic points but at positions offseted to the probe-offsets 1R
Temporary reduce the size of the probe grid by the specified amount (mm) 1
- Notes
1 since 2.0.9.2
- Examples
G33 : calibrates with the default settings. G33 Auto Calibrate Checking... AC .Height:297.77 Ex:+0.00 Ey:+0.00 Ez:+0.00 Radius:100.00 .Tower angle : Tx:+0.00 Ty:+0.00 Tz:+0.00 Iteration : 01 std dev:0.306 Iteration : 02 std dev:0.049 Iteration : 03 std dev:0.033 Iteration : 04 std dev:0.031 Calibration OK rolling back. .Height:297.69 Ex:-0.10 Ey:-0.12 Ez:+0.00 Radius:100.91 .Tower angle : Tx:-0.03 Ty:+0.25 Tz:+0.00 Save with M500 and/or copy to Configuration.h
G33 P6 V0 : probes 36 points in dry run mode. G33 Auto Calibrate Checking... AC (DRY-RUN) .Height:297.77 Ex:+0.00 Ey:+0.00 Ez:+0.00 Radius:100.00 .Tower angle : Tx:+0.00 Ty:+0.00 Tz:+0.00 . c:+0.03 x:+0.32 y:+0.34 z:+0.41 . yz:+0.37 zx:+0.32 xy:+0.17 End DRY-RUN std dev:0.306
G33 P4 C0.05 T : probes 16 points and stops when a standard deviation of 0.05mm is reached; calibrates delta height, endstops and delta radius, leaves the tower angle corrections unaltered. G33 Auto Calibrate Checking... AC .Height:297.78 Ex:+0.00 Ey:+0.00 Ez:+0.00 Radius:100.00 Iteration : 01 std dev:0.317 Iteration : 02 std dev:0.059 Calibration OK std dev:0.042 .Height:297.66 Ex:-0.17 Ey:-0.13 Ez:+0.00 Radius:100.91 Save with M500 and/or copy to Configuration.h
G33 P2 : probes center and tower positions and calibrates delta height, endstops and delta radius. G33 Auto Calibrate Checking... AC .Height:297.78 Ex:+0.00 Ey:+0.00 Ez:+0.00 Radius:100.00 Iteration : 01 std dev:0.374 Iteration : 02 std dev:0.054 Iteration : 03 std dev:0.007 Calibration OK rolling back. .Height:297.68 Ex:-0.14 Ey:-0.14 Ez:+0.00 Radius:101.23 Save with M500 and/or copy to Configuration.h
G33 P1 : probes the center and calibrates the delta height only. G33 Auto Calibrate Checking... AC .Height:261.40 Offset:+0.30 Calibration OK std dev:0.000 .Height:261.58 Offset:+0.10 Save with M500 and/or copy to Configuration.h
note: Height = delta height; Ex, Ey, Ez = end-stop corrections; Radius = delta radius; Tx, Ty, Tz = tower angular corrections; c, x, y, z, yz, zx, xy = probe results at center, towers and opposite to towers; std dev = standard deviation of the probe results towards the zero plane.
G34: Z Stepper Auto-Align
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.4+ | Use M671 and G32 | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Use multiple Z steppers and a probe to align Z axis connection points. See M422
for other options.
- Example
G34 I3 T0.8 A1.5 ; 3 iterations, Target Accuracy 0.8, Amplification 1.5
G34: Calculate Delta Height from toolhead position (DELTA)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Example
G34
The values specified are added to the calculated end stop position when the axes are referenced. The calculated value is derived from the distance of the toolhead from the current axis zero point.
The user would typically place the toolhead at the zero point of the axis and issue the G34
command.
This value can be saved to EEPROM using the M500
command.
G38.x Straight Probe (CNC specific)
G38.2 probe toward workpiece, stop on contact, signal error if failure
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0+ | 3.0+ | ??? | No | No | ??? | Yes | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | Yes | No | No | No | No |
Monitors probe input while moving linearly towards the specified coordinates, stopping upon detecting contact or reaching specified coordinates.
- Usage
G38.2 Xnnn Ynnn Znnn Fnnn
- Parameters
Xnnn
target X coordinateYnnn
target Y coordinateZnnn
target Z coordinateFnnn
Feedrate in mm/min- Example
G38.2 Z0 G38.2 X50 G38.2 Z10 Y10
G38.3 probe toward workpiece, stop on contact
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0+ | 3.0+ | ??? | No | No | ??? | Yes | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | Yes | No | No | No | No |
G38.4 probe away from workpiece, stop on loss of contact, signal error if failure
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.0+ | 3.0+ | ??? | No | No | ??? | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | Yes | No | No | No | No |
G38.5 probe away from workpiece, stop on loss of contact
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.0+ | 3.0+ | ??? | No | No | ??? | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | Yes | No | No | No | No |
G40: Compensation Off (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | Yes | No | No | Yes | No |
G40
turns off cutter compensation. If tool compensation was on the next move must be a linear move and longer than the tool diameter. It is OK to turn compensation off when it is already off.
http://www.linuxcnc.org/docs/2.5/html/gcode/tool_compensation.html
G42: Move to Grid Point
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.2+ | No | No | No | Yes | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
G42
does a fast move in XY to any of the intersection points in the bed calibration grid. This is useful during calibration to align the nozzle or probe.
- Parameters
Inn
Grid X index (zero-based). If omitted, the nearest latitude.Jnn
Grid Y index (zero-based). If omitted, the nearest longitude.P
Probe flag. Moves the probe to the grid point (instead of the nozzle).Fnnn
Feedrate (mm/min)- Example
G42 I3 J4 P F3000 ; Move the probe to grid coordinate 3, 4
G53..59: Coordinate System Select (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.0+ | 1.21+ | No | No | No | No | Yes | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | Yes | No | No | Yes | No |
See linuxcnc.org for more help
Not all builds of RepRapFirmware support these commands. For those that do (e.g. Duet WiFi/Ethernet and Duet 3), from firmware version 2.02 the workplace coordinate offsets are included in the data saved to config-override.g by the M500 command.
G60: Save / Restore position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.2+ | 1.21+ | No | No | No | No | No | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Use this command to save the current position to a memory slot, restore (and move to) a saved position, or delete a previously-saved position. When moving to a saved position, you can choose which axes to move, and some firmwares allow you to specify an offset distance for each axis. See usage notes for each firmware below.
- G60 S Usage
G60 Snn
- Parameters
Snn
<nn> specifies a memory slot # (0-based) to save into (default 0)
- RepRapFirmware: RRF 1.21 has 3 slots (0..2). RRF 2.02 adds two more slots (4..5) skipping slot index 3. When a print is paused the coordinates are saved to slot 1 automatically, and at the start of a tool change the coordinates are saved to slot 2 automatically. Use G0 or G1 with the R0, R1 or R2 parameter to move the current tool to a saved position.
- Marlin: The number of save slots is defined with
SAVED_POSITIONS
.
- Druid: This firmware always has 64 slots (0..63).
- G60 Q Usage
G60 Qnnn Fnnn X Y Z ... E
Move back to a saved position. Specify one or more axes to restore unless all axes should be restored.
- Parameters
Qnnn
- From slot # 0-63 (required)Fnnn
- Feedrate (units/min)X
- Flag to restore XY
- Flag to restore YZ
- Flag to restore ZE
- Flag to restore E
- Other axis letters may be included for fancier robots. If no axes are specified with
G60 Qnn
then all axes are restored.
- Marlin: Put a value next to an axis letter to specify an offset to add to the position before moving. The E axis is restored but never actually moved by this command.
- G60 D Usage
G60 Dnnn
- Delete content of slot number nnn (0...63)G60 D
- if D is provided without a slot number, all 64 slots will be deleted.
- Notes
- Only one of S, Q, or D may be used in the command. If more than one is present, the whole command will be ignored.
- Examples
G60 S0 ; Save current position to slot #0 G60 S63 ; Save current position to slot #63 G60 Q55 ; Move to the position stored in slot #55 G60 Q10 F20000 X Y ; Move XY to the position stored in slot #10, with feedrate 20000 units/min. G60 Q0 X ; Move X to the position saved in slot #0 G60 D0 ; Delete the position saved in slot #0 G60 D ; Delete all saved positions from all slots G60 ; List all saved positions
G61: Restore saved position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.2+ | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Use this command to restore (and move to) a saved position, optionally specifying which axes to restore, with an optional offset for each axis.
- Usage
G61 Snn
- Parameters
Snn
<nn> specifies memory slot # (0-based) to restore from (default 0)
Move back to the position that was saved in the given slot. If nothing was saved in the slot, do nothing.
G61 Snn Fnnn X Y Z E
Move back to a saved position, specifying one or more axes to restore, with optional offset. The E axis is restored but never actually moved by this command.
- Parameters
Snnn
- From slot # 0-63 (required)Fnnn
- Feedrate (units/min)X
- Flag to restore X axis, with optional X offsetY
- Flag to restore Y axis, with optional Y offsetZ
- Flag to restore Z axis, with optional Z offsetE
- Flag to restore E axis, with optional E offset
Other axis letters may be included for fancier robots. If no axes are specified then all axes are restored.
Put a value next to an axis letter to specify the offset to add to the position before moving / restoring.
- Examples
G61 S15 ; Move to the position from slot #15 G61 S10 F20000 X3 Y ; Move XY to the XY position from slot #10, shifting X by 3, with feedrate 20000 units/min G61 S0 X ; Move X to the X position from slot #0
G68: Coordinate rotation
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
??? | 3.4 and later | ??? | ??? | ??? | ??? | ??? | No | ??? | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? |
- Usage
G68 Xnnn Ynnn Rnnnn [I]
G68 Annn Bnnn Rnnnn [I]
- Parameters
Xnnn, Ynnn...
Centre coordinates to rotate aboutAnnn
first centre coordinate in the selected plane (e.g. equivalent to Xnnn if the selected plane is XY)Bnnn
second centre coordinate in the selected plane (e.g. equivalent to Ynnn if the selected plane is XY)Rnnn
angle to rotate in degrees. Positive angles rotate anticlockwise when viewing the selected plane from above.I
if this parameter is present, the R parameter is added to the existing rotation instead of being absolute
Rotates the coordinate system in the current plane as selected by G17, G18 or G19. You may either specify the coordinates of the two axes of the selected plan (e.g. X and Y if using the default XY plane or after G17) or you may specify A and B coordinates.
RepRapFirmware implements G68 for the XY plane only.
G69: Cancel coordinate rotation
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
??? | 3.4 and later | ??? | ??? | ??? | ??? | ??? | No | ??? | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? |
- Usage
G69
This cancels any coordinate rotation that was set up by G68.
G75: Print temperature interpolation
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Show/print PINDA temperature interpolating.
- Usage
G75
G76: PINDA probe temperature calibration
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes1 | Use G31 | No | Yes | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
This G-code is used to calibrate the temperature drift of the PINDA (inductive Sensor).
The PINDAv2 sensor has a built-in thermistor which has the advantage that the calibration can be done once for all materials.
The Original i3 Prusa MK2/s uses PINDAv1 and this calibration improves the temperature drift, but not as good as the PINDAv2.
- Usage
G76
G76 B
1G76 P
1
- Parameters
B
Calibrate bed only 1P
Calibrate probe only 1
- Example
G76 echo PINDA probe calibration start echo start temperature: 35.0° echo ... echo PINDA temperature -- Z shift (mm): 0.---
- Notes1
Marlin requires PROBE_TEMP_COMPENSATION
.
This process can take a very long time. The timeout is currently set to 15min to allow the parts to fully heat up and cool down.
Use M500
to save the result to EEPROM.
At this moment it is only supported in Marlin bugfix-2.0.x branch.
G80: Cancel Canned Cycle (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | ??? | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | ??? | ??? | ??? | ??? | No | ??? | No | ??? |
It cancel canned cycle modal motion. G80 is part of modal group 1, so programming any other G code from modal group 1 will also cancel the canned cycle.
G80: Mesh-based Z probe
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
G29 | No | No | Yes | Yes3 | No | No | No | G29 | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Default 3x3 grid can be changed on MK2.5/s and MK3/s to 7x7 grid.
- Parameters
- This command can be used without any additional parameters.
N
Number of mesh points on x axis. Default is 3. Valid values are 3 and 7.C
Probe retry counts. Default is value stored in EEPROM. Valid values are 1 to 10.O
Return to origin. Default is 1. Valid values are 0 (false) and 1 (true). 2M
Use magnet compensation. Will only be used if number of mesh points is set to 7. Default is value stored in EEPROM. Valid values are 0 (false) and 1 (true). 2
Using the following parameters enables additional "manual" bed leveling correction. Valid values are -100 microns to 100 microns.
L
Left Bed Level correct value in um.R
Right Bed Level correct value in um.F
Front Bed Level correct value in um.B
Back Bed Level correct value in um.
The following parameters are used to define the area used by the print:
X
area lower left point X coordinate 2Y
area lower left point Y coordinate 2W
area width (on X axis) 2H
area height (on Y axis) 2
1Prusa Firmware till version 3.13.3
R
Probe retries. Default 3 max. 10 1V
Verbosity level 1=low, 10=mid, 20=high.It can be only used if firmware has been compiled with SUPPORT_VERBOSITY active. 1
2Prusa Firmware from version 3.14.0
3Prusa MK3.5, MK3.9 and MK4
G81: Mesh bed leveling status
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M420 | No | No | Yes | M420 | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Prints mesh bed leveling status and bed profile if activated.
- Usage
G81
- Notes
Equivalent to M420 V
in Marlin Firmware (and possibly G29 T depending on leveling system).
G82: Single Z probe at current location
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
G30 | G30 | No | Yes1 | G30 | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
WARNING! USE WITH CAUTION! If you'll try to probe where is no leveling pad, nasty things can happen!
- Usage
G82
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.1
G83: Babystep in Z and store to EEPROM
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes1 | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
G83
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.1
G84: UNDO Babystep Z (move Z axis back)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes 1 | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
G84
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.1
G85: Pick best babystep
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes1 | ??? | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
G85
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.1
G86: Disable babystep correction after home
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
This G-code will be performed at the start of a calibration script.
- Usage
G86
G87: Enable babystep correction after home
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
This G-code will be performed at the end of a calibration script.
- Usage
G87
G88: Reserved
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes1 | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
G88
- Notes
This G-code currently does not do anything.
G90: Set to Absolute Positioning
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
- Example
G90
All coordinates from now on are absolute relative to the origin of the machine. (This is the RepRap default.)
G91: Set to Relative Positioning
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes |
- Example
G91
All coordinates from now on are relative to the last position. Note: RepRapFirmware latest revision firmware uses M83
to set the extruder to relative mode: extrusion is NOT set to relative by ReprapFirmware on G91
: only X,Y and Z are set to relative. By contrast, Marlin (for example) DOES also set extrusion to relative on a G91
command, as well as setting X, Y and Z.
G92: Set Position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
- Parameters
- This command can be used without any additional parameters.
Xnnn
new X axis positionYnnn
new Y axis positionZnnn
new Z axis positionEnnn
new extruder position- Example
G92 X10 E90
Allows programming of absolute zero point, by reseting the current position to the values specified. This would set the machine's X coordinate to 10, and the extrude coordinate to 90. No physical motion will occur.
A G92
without coordinates will reset all axes to zero on some firmware. This does not apply to RepRapFirmware.
G92.x: Reset Coordinate System Offsets (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.6+ | No | No | No | No | No | Yes | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | No | No | No |
- Usage
G92.1
- Reset axis offsets (and parameters 5211-5219) to zero. (X Y Z A B C U V W
)G92.2
- Reset axis offsets to zero
G93: Feed Rate Mode (Inverse Time Mode) (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | 3.5+ | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | No | Yes | No |
G93
is Inverse Time Mode. In inverse time feed rate mode, an F
word means the move should be completed in (one divided by the F
number) minutes.
For example, F2.0
means the move should be completed in a half a minute.
When the inverse time feed rate mode is active, an F
word must appear on every line which has a G1
, G2
, or G3
motion, and an F
word on a line that does not have G1
, G2
, or G3
is ignored. Being in inverse time feed rate mode does not affect G0
(rapid move) motions.
G94: Feed Rate Mode (Units per Minute) (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
??? | 3.5+ | ??? | ??? | ??? | ??? | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | ??? | ??? | ??? | ??? | No | ??? | Yes | ??? |
G94 is Units per Minute Mode. In units per minute feed mode, an F word is interpreted to mean the controlled point should move at a certain number of inches per minute, millimeters per minute, or degrees per minute, depending upon what length units are being used and which axis or axes are moving.
G98: Activate farm mode
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Enable Prusa-specific Farm functions and g-code.
- Usage
G98
- Notes
Set of internal Prusa commands
PRUSA [ Ping | PRN | FAN | fn | thx | uvlo | fsensor_recover | MMURES | RESET | fv | M28 | SN | Fir | Rev | Lang | Lz | Beat | FR ]
- Parameters
Ping
PRN
Prints revision of the printer.FAN
Prints fan details.fn
Prints farm number.thx
uvlo
Resets UVLO aka Power Panic and continues SD print.fsensor_recover
Filament sensor recover - restore print and continue.MMURES
Reset MMU.Reset
Resets Printer.fv
??? get file version. ???M28
M28 write to SD.SN
Get serial number from 32U2 processor. Typical format of S/N is:CZPX0917X003XC13518Fir
Prints firmware version.Rev
Prints filament size, elelectronics, nozzle type.Lang
Reset the language.Lz
??? maybe resets Live Z values to 0 ???Beat
Kick farm link timer.FR
Full factory reset.nozzle set 'diameter'
Set nozzle diameter.nozzle D'diameter'
Check nozzle diameter.nozzle
Print nozzle diameter
G99: Deactivate farm mode
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
G99
G100: Calibrate floor or rod radius
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | 0.92+ | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
X
Flag to set floor for X axisY
Flag to set floor for Y axisZ
Flag to set floor for Z axisRnnn
Radius to add- Examples
G100 X Y Z ; set floor for argument passed in. Number ignored and may be absent. G100 R5 ; Add 5 to radius. Adjust to be above floor if necessary G100 R0 ; Set radius based on current z measurement. Moves all axes to zero
G130: Set digital potentiometer value
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | Yes |
- Example
G130 X10 Y18 Z15 A20 B12
Set the digital potentiometer value for the given axes. This is used to configure the current applied to each stepper axis. The value is specified as a value from 0-127; the mapping from current to potentimeter value is machine specific.
G131: Remove offset
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | 0.91+ | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
G132: Calibrate endstop offsets
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | 0.91+ | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
G133: Measure steps to top
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | 0.91+ | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
G161: Home axes to minimum
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | Yes | No | Yes |
- Parameters
X
Flag to home the X axis to its minimum positionY
Flag to home the Y axis to its minimum positionZ
Flag to home the Z axis to its minimum positionFnnn
Desired feedrate for this command- Example
G161 X Y Z F1800
Instruct the machine to home the specified axes to their minimum position. Similar to G28
, which decides on its own in which direction to search endstops.
G162: Home axes to maximum
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | Yes | No | Yes |
- Parameters
X
Flag to home the X axis to its maximum positionY
Flag to home the Y axis to its maximum positionZ
Flag to home the Z axis to its maximum positionFnnn
Desired feedrate for this command- Example
G162 X Y Z F1800
Instruct the machine to home the specified axes to their maximum position.
G425: Perform auto-calibration with calibration cube
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.0+ | No | No | No | Yes | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
This performs an automatic calibration of backlash, positional errors and nozzle offset by touching the nozzle on the sides of a bed mounted, electrically conductive cube, washer or bolt.
- Parameters
B
Perform calibration of backlash only.Tnnn
Perform calibration of toolhead only.V
Probe cube and print position, error, backlash and hotend offset.Unnn
Uncertainty, how far to start probe away from the cube (mm)
- Examples (Marlin)
G425 ; Perform full calibration sequence T1 ; Switch to second nozzle G425 V ; Validate by showing report for T1 T0 ; Switch to second nozzle G425 V ; Validate by showing report for T0
M-commands
M0: Stop or Unconditional stop
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | No | Yes3 | Yes | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | Yes | Yes | No | Yes | Yes | No |
- Parameters
- This command can be used without any additional parameters.
Pnnn
Time to wait, in milliseconds1Snnn
Time to wait, in seconds2- Example
M0
The RepRap machine finishes any moves left in its buffer, then shuts down. All motors and heaters are turned off. It can be started again by pressing the reset button on the master microcontroller, although this step is not mandatory on RepRapFirmware. See also M1
, M112
.
The Marlin Firmware does wait for user to press a button on the LCD, or a specific time. "M0 P2000" waits 2000 milliseconds, "M0 S2" waits 2 seconds.
RepRapFirmware executes cancel.g if this file is present, if the print is paused and if the axes are homed. Otherwise stop.g is run and the drives are put into idle mode. Also the heaters are turned off if no 'H1' parameter is specified.
- Notes
1Not available in RepRapFirmware, but as a work-around G4
can be run before M0
.
2Only available on Marlin and Prusa Firmware.
3"Wait for user ..." is shown on LCD in Prusa Firmware.
M1: Sleep or Conditional stop
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes1 | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | No | Yes | No |
- Example
M1 M1 Hello world 1
The RepRap machine finishes any moves left in its buffer, then shuts down. All motors and heaters are turned off. It can still be sent G and M codes, the first of which will wake it up again. See also M0
, M112
.
The Marlin does the same as M0
.
In Prusa 8-bit Firmware 1 the M1
needs at least a space behind the command to be executed correctly. It can be used the same as M0 P<ms>
or M0 S<seconds>
but will ignore the following "message".
- Prusa Firmware 8-bit example
M1 S5
will wait for 5 seconds and show in the LCD status line "Waiting for user..." the same asM0 S5
M1 Hello world
will show in the LCD status line "Hello world" and wait until the user press the LCD knob.
If Marlin is emulated in RepRapFirmware, this does the same as M25 if the code was read from a serial or Telnet connection, else the macro file sleep.g
is run before all heaters and drives are turned off.
M2: Program End
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | Yes | Yes | Yes |
- Example
M2
Teacup firmware does the same as M84
.
M3: Spindle On, Clockwise (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | No | No | No | Yes | Yes | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | Yes | Yes | No |
- Parameters
Snnn
Spindle RPM- Example
M3 S4000
The spindle is turned on with a speed of 4000 RPM.
Teacup firmware turn extruder on (same as M101
).
RepRapFirmware interprets this code only if in CNC mode (M453
), in laser mode (M452
) or if a Roland mill has been configured. You must always provide an S parameter with this command to specify the required spindle speed pr laser power. In RepRapFirmware 2.05RC2 and later, and RepRapFirmware 3.0beta13 and later, in laser mode (M452) the laser will only fire during G1/G2/G2 moves.
In Repetier-Firmware in laser mode you need S0
..S255
to set laser intensity. Normally you use S255
to turn it on full power for moves. Laser will only fire during G1
/G2
/G3
moves and in laser mode (M452
).
M4: Spindle On, Counter-Clockwise (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | No | No | Yes | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | No | Yes | No |
- Example
M4 S4000
The spindle is turned on with a speed of 4000 RPM.
M5: Spindle Off (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | No | No | Yes | Yes | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | Yes | Yes | ??? |
- Example
M5
The spindle is turned off.
Teacup firmware turn extruder off (same as M103
).
M6: Tool change
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | ??? | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | Yes | Yes | ??? |
- Example
M6
M7: Mist Coolant On (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | Yes: Use M106 | Yes | ??? |
- Example
M7
Mist coolant is turned on (if available)
Teacup firmware turn on the fan, and set fan speed (same as M106
).
M8: Flood Coolant On (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | Yes: Use M106 | Yes | ??? |
- Example
M8
Flood coolant is turned on (if available)
M9: Coolant Off (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | Yes: Use M106 | Yes | ??? |
- Example
M9
All coolant systems are turned off.
M10: Vacuum On (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | Yes: Use M106 | Yes | ??? |
- Example
M10
Dust collection vacuum system turned on.
M11: Vacuum Off (CNC specific)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | Yes: Use M106 | Yes | ??? |
- Example
M11
Dust collection vacuum system turned off.
M13: Spindle on (clockwise rotation) and coolant on (flood)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | ??? | ??? | No | No | ??? | ??? | ??? | ??? | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | Yes | ??? |
This one M-code does the work of both M03 and M08. It is not unusual for specific machine models to have such combined commands, which make for shorter, more quickly written programs.
- Example
M13
M16: Expected Printer Check
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
(2.0+) | No | ??? | No | No | No | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
Do a case-sensitive comparison between the string argument and the configured MACHINE_NAME
. If the machine name doesn't match, halt the printer so that a reset is required. This safety feature is meant to prevent G-code sliced for a specific machine from being used on any other machine. In Marlin this feature is enabled with EXPECTED_PRINTER_CHECK
.
- Example
M16 Cookie Monster
M17: Enable/Power all stepper motors
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | 3.3 and later | ??? | Yes | Yes | No | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | Yes | (automatic) | No | ??? |
- Parameters
- This command can be used without any additional parameters.1
X
X axisY
Y axisZ
Z axisE
All extruders
- Example
M17 M17 X E0
Powers on stepper motors.
- Notes
1Ability to specify axes was added to Marlin 2.0 and may not be available on other firmware implementations.
M18: Disable all stepper motors
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M84 | Yes | Yes | M843 | Yes | No | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | Yes | Yes: Use M2 | No | Yes |
- Parameters
- This command can be used without any additional parameters.13
X
X axisY
Y axisZ
Z axisE
Extruder drive(s)2S
Seconds3- Examples
M18 M18 X E0
Disables stepper motors and allows axes to move 'freely.'
On Marlin, M18
is a synonym of M84
, so it can also be used to configure or disable the idle timeout.
- Examples
M18 S10 ; Idle steppers after 10 seconds of inactivity M18 S0 ; Disable idle timeout
- Notes
1Some firmware implementations do not support parameters to be passed, but at least Marlin and RepRapFirmware do.
2RepRapFirmware allows stepper motors to be disabled selectively. For example, M18 X E0:2
will disable the X, extruder 0 and extruder 2 motors.
3In Prusa Firmware this command can be used to set the stepper inactivity timeout (`S`) or to disable steppers (`X`,`Y`,`Z`,`E`)
M20: List SD card
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes4 | Yes1,2 | Yes3 | Yes4 | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | Yes | No | ??? |
- Parameters
- This command can be used without any additional parameters.
Snnn
Output style1Rnnn
File number to start at1P"ddd"
Directory to list2L
Reports long filenames instead of just short filenames. Requires host software parsing (Cap:EXTENDED_M20).4T
Report timestamps as well. The value is one uint32_t encoded as hex. Requires host software parsing (Cap:EXTENDED_M20).4
- Examples
M20 M20 S2 P"/gcodes/subdir" M20 L 4 M20 T 4
This code lists all files in the root folder or G-code directory of the SD card to the serial port. One name per line, like:
SQUARE.G SQCOM.G ZCARRI~2.GCO CARRIA~1.GCO
Please note that a file list response is usually encapsulated. Standard configurations of RepRapFirmware mimic this style in emulation mode:
Begin file list: SQUARE.G ZCARRI~2.GCO End file list ok
The file size may be appended as an integer representing the size in bytes:
Begin file list: SQUARE.G 1234 ZCARRI~2.GCO 234 End file list ok
At least OctoPrint also supports an additional format showing the file's long name (see also M33) after the size:
Begin file list: SQUARE.G 1234 SQUARE.G ZCARRI~2.GCO 234 ZCARRIAGE_V2.GCO End file list ok
If RepRapFirmware emulates no firmware compatibility, a typical response looks like:
G-code files: "Traffic cone.g","frog.gcode","calibration piece.g"
Note that some firmwares list file names in upper case, but - when sent to the M23
command (below) they must be in lower case. Teacup and RepRapFirmware have no such trouble and accept both. RepRapFirmware always returns long filenames in the case in which they are stored.
- Notes
1If the S2 parameter is used on RepRapFirmware, then the file list (or as much as can be fitted in the output buffer) is returned in JSON format as a single array called "files" with each name that corresponds to a subdirectory preceded by an asterisk, and the directory is returned in variable "dir". The optional R parameter is the file number to start at, default 0. The JSON response also returns value "next" which is the number of the first file that wasn't returned, or 0 if all files were returned. The caller can enumerate all files even if there are very many by making successive M20 S2 calls with each call using R from the "next" value in the previous response, util "next" is zero.
- Example
M20 S2 P/gcodes {"dir":"\/gcodes","first":0,"files":["4-piece-1-2-3-4.gcode","Hinged_Box.gcode","Hollow_Dodecahedron_190.gcode","*Calibration pieces"],"next":0}
- Example for
M20 L
4
Begin file list TEST1.GCO 1234 "TEST1.GCO" DIR_ENTER: /TESTFO~1/ "test folder" DIR_EXIT LFNFIL~1.GCO 56789 "LFN file.gcode" End file list
- Example for
M20 L T
4
Begin file list TEST1.GCO 1234 0x52936b00 "TEST1.GCO" DIR_ENTER: /TESTFO~1/ "test folder" DIR_EXIT LFNFIL~1.GCO 56789 0x52936b08 "LFN file.gcode" End file list
- Example for
M20 T
4
Begin file list TEST1.GCO 1234 0x52936b00 DIR_ENTER: /TESTFO~1/ "test folder" DIR_EXIT LFNFIL~1.GCO 56789 0x52936b08 End file list
2This parameter is only supported by RepRapFirmware and defaults to the 0:/gcodes directory, which is the directory that printable gcode files are normally stored in.
3On Klipper, a virtual SD card is required for this to work.
4The timestamp is a combination of both the date and time into a single integer and printed as a hex.
M21: Initialize SD card
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes1 | Yes | Yes | Yes | Yes | Yes2 | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | Yes | No | ??? |
- Parameters
Pnnn
SD card number (RepRapFirmware only, default 0)- Examples
M21 M21 P1
The specified SD card is initialized. If an SD card is loaded when the machine is switched on, this will happen by default. SD card must be initialized for the other SD functions to work.
Marlin 2.0.9.4 added S
and U
parameters to mount the SD Card or USB drive, respectively. Hosts can look for "Cap:MULTI_VOLUME:1
".
- Notes
1On Klipper, a virtual SD card is required for this to work.
2On Druid:
M21 is named "Mount Media" M21 P0 or S = Mount external SD CARD M21 P1 or M = Mount onboard Micro Sd-Card M21 P2 or U = Mount USB Flash Drive M21 = Mount current volume
M22: Release SD card
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | No | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | Yes | No | ??? |
- Parameters
Pnnn
SD card number (RepRapFirmware only, default 0)- Examples
M22 M22 P1
The specified SD card is released, so further (accidental) attempts to read from it are guaranteed to fail. Helpful, but not mandatory before removing the card physically.
M23: Select SD file
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes1 | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | Yes | No | ??? |
- Example
M23 filename.gco
The file specified as filename.gco (8.3 naming convention is supported) is selected ready for printing. RepRapFirmware supports long filenames as well as 8.3 format.
- Notes
1On Klipper, a virtual SD card is required for this to work.
M24: Start/resume SD print
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes1 | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | Yes | No | No | No | Yes | Yes | No | No |
- Example
M24
The machine prints from the file selected with the M23
command. If the print was previously paused with M25
, printing is resumed from that point. To restart a file from the beginning, use M23
to reset it, then M24
.
When this command is used to resume a print that was paused, RepRapFirmware runs macro file resume.g
prior to resuming the print.
- Notes
1On Klipper, a virtual SD card is required for this to work.
M25: Pause SD print
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes1 | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | Yes | No | No | No | Yes | Yes | No | No |
- Example
M25
The machine pauses printing at the current position within the file. To resume printing, use M24. Do not use this code within a GCode file to pause the print at that point, use M226 instead.
Prior to pausing, RepRapFirmware runs macro file pause.g
. This allows the head to be moved away from the print, filament to be retracted, etc.
RepRapFirmware 1.20 and later also save the current state of the print to file /sys/resurrect.g. This is so that if the printer is turned off after pausing, the print can subsequently be resumed.
Without any parameters it will park the extruder to default or last set position. The default pause position will be set during power up and a reset, the new pause positions aren't permanent.
- Usage
M25 [ X | Y | Z | S ]
2
- Parameters
X
X position to park 2Y
Y position to park 2Z
Z raise before park 2S
Set values [S0 = set to default values | S1 = set values] without pausing 2
- Notes
1On Klipper, a virtual SD card is required for this to work.
2Prusa Firmware equivalent to M125 and M601
M26: Set SD position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes1 | Yes | Yes | Yes | aborts | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | No | No | ??? |
- Parameters
Snnn
File position from start of file in bytesPnnn
(Optional, RepRapFirmware only) Proportion of the first move to be skipped, default 0.0, must be less than 1.0- Example
- M26 S49315
Set the file offset in bytes from the start of the SD card file selected by M23. The offset must correspond to the start of a G-code command.
- Notes
1On Klipper, a virtual SD card is required for this to work.
M27: Report SD print status
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes1 | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | No | No | ??? |
- Parameters
- C Report the open file's name and long name (Marlin 1.1.9 and up)
- Sn Set the auto-report interval (Marlin 1.1.9 and up)
- Example
M27
Report SD print status.
Marlin and RepRapFirmware report the number of bytes processed in this format, which can be processed by Pronterface:
SD printing byte 2134/235422
If no file is being printed, only this message is reported:
Not SD printing.
In Marlin 1.1.9 and up M27 C
reports the open file's DOS 8.3 name and long filename, if any.
- Example
M27 C
Current file: filena~1.gco Filenagotcha.gcode
In Marlin 1.1.9 and up M27 Sn
sets the auto-report interval. This requires the AUTO_REPORT_SD_STATUS
configuration option to be enabled. Marlin reports this capability in M115
as Cap: AUTO_REPORT_SD_STATUS 1
when this option is available.
- Example
M27 S2 ; Report the SD card status every 2 seconds
- Notes
1On Klipper, a virtual SD card is required for this to work.
M28: Begin write to SD card
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | No | No | ??? |
- Example
M28 filename.gco
File specified by filename.gco is created (or overwritten if it exists) on the SD card and all subsequent commands sent to the machine are written to that file.
M29: Stop writing to SD card
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | No | No | ??? |
- Example
M29 filename.gco
File opened by M28
command is closed, and all subsequent commands sent to the machine are executed as normal.
M30: Delete a file on the SD card
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | Yes | No | No | No | No | No | No | ??? |
- Example
> M30 filename.gco > filename.gco is deleted.
M30: Program Stop
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
Yes | No | No | No | No | No | No | Yes | ??? |
- For Yaskawa and in grbl - Same as M2 in Yaskawa G-code
- Example
M30 ; Exchange pallet shuttles and end the program. Pressing cycle start will start the program at the beginning of the file.
M31: Output time since last M109
or SD card start to serial
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | Yes | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M31
The response looks like:
echo:54 min, 38 sec
M32: Select file and start SD print
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | No | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M32 filename.gco
It can be used when printing from SD card and does the same as M23
and M24
.
tba available in marlin(14/6/2014)
M33: Get the long name for an SD card file or folder
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Not required | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
Get the long name for a file or folder on the SD card from a dos path. Introduced in Marlin firmware 1.1.0 September 2015.
Example input:
M33 miscel~1/armchair/armcha~1.gco
Example output:
/Miscellaneous/Armchair/Armchair.gcode
M33: Stop and Close File and save restart.gcode
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No: Use M25 | ??? | No | No | ??? | ??? | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | No | ??? |
Stop the printing from SD and save all position in restart.gcode for restart printing in future
M34: Set SD file sorting options
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | No | No | No | No | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
- S1 Enable sorting
- S0 Disable sorting
- F-1 Folders first, followed by the files (both group, alphabetically)
- F0 Folders and files together, listed alphabetically
- F1 Files first, followed by folders (both group, alphabetically)
Enable and disable SD card file-sorting, and/or set the folder sorting order. Proposed by Marlin firmware, May 2015.
M35: Upload firmware NEXTION from SD
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | ??? | ??? | No | No | ??? | ??? | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? |
M36: Return file information
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | No |
- Example
- M36 filename.gco
- M36
Returns information in JSON format for the specified SD card file (if a filename was provided) or for the file currently being printed. A sample response is:
- {"err":0,"size":436831,"fileName":"EscherLizardModified.gcode","lastModified":"2017-09-21T16:58:07","height":5.20,"layerHeight":0.20,"printTime":660,"simulatedTime":1586,"filament":[1280.7],"generatedBy":"Simplify3D(R) Version 4.0.0"}
The "err" field is zero if successful, nonzero if the file was not found or an error occurred while processing it. The "size" field should always be present if the operation was successful. The presence or absence of other fields depends on whether the corresponding values could be found by reading the file. The "filament" field is an array of the filament lengths required from each spool. The size is in bytes, the times are in seconds, all other values are in mm. "printTime" is the printing time estimated by the slicer, "simulationTime" is the time measured when the print was simulated by the firmware. The fields may appear in any order, and additional fields may be present. Versions of RepRapFirmware prior to 3.4 do not provide the "fileName" field if information for a specific file was requested.
RepRapFirmware 3.4 and later also return information about thumbnail imaged embedded in the GCode file via an additional JSON field "thumbnails". A sample value for this field is:
- "thumbnails":[{"width":32,"height":32,"fmt":"qoi","offset":103,"size":2140},{"width":220,"height":220,"fmt":"qoi","offset":2384,"size":25464}]
The "fmt" field denotes the encoding of the thumbnail and is either "png" or "qoi". The "thumbnails" field is omitted entirely if there are no thumbnails embedded in the GCode file.
M36.1: Return embedded thumbnail data
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | 3.4 and later | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | No |
- Parameters
- P"filename" Name of the GCode file from which thumbnail data is to be retrieved
- Snnnn Byte offset into the file at which thumbnail data is to be fetched
This command is used to return the data for an thumbnail image in a GCode file. The offset value should be either the offset of the start of data for a thumbnail as returned by the M36 command, or the value returned in the "next" field by a previous M36.1 command. The response is in JSON format. Here is a sample response:
- {fileName":"EscherLizardModified.gcode","offset":103,"data":"cW9pZgAAACA....AAAAB","next":0,err": 0}
The "fileName" and "offset" values are as given in the command. "data" is part or all of the base64-encoded thumbnail data starting at that offset. "next" is zero if there is no more data for that thumbnail, otherwise not all the thumbnail data was returned and "next" is the byte offset in the file of the rest of the thumbnail data. "err" is 0 if the command was successful, otherwise "err" is nonzero and the other fields may or may not be present.
M37: Simulation mode
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
- S1 Enter simulation mode
- S0 Leave simulation mode
- P"filename" (optional) Simulate printing a file from SD card
- Examples
- M37 S1
- M37 P"MyModel.g"
Used to switch between printing mode and simulation mode. Simulation mode allows the electronics to compute an accurate printing time, taking into account the maximum speeds, accelerations etc. that are configured.
M37 S1 enters simulation mode. All G and M codes will not be acted on, but the time they would take to execute will be calculated.
M37 S0 leaves simulation mode and prints the total time taken by simulated moves since entering simulation mode.
M37 with no S parameter prints the time taken by the simulation, from the time it was first entered using M37 S1, up to the current point (if simulation mode is still active) or the point that the simulation was ended (if simulation mode is no longer active).
M37 P"filename" enters simulation mode, prints the specified file, exits simulation mode, reports the print time, and appends it to the G-code file as a comment for later retrieval.
M38 Compute SHA1 hash of target file
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
Used to compute a hash of a file on the SD card. Examples:
> M38 gcodes/myfile.g > Cannot find file > M38 www/reprap.htm > 91199139dbfadac15a18cfb962dfd4853db83999
Returns a hexadecimal string which is the SHA1 of the file. If the file cannot be found, then the string "Cannot find file" is returned instead.
M39 Report SD card information
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes: 1.20.1 and later | ??? | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
- Pn SD slot number, default 0
- Sn Response format. S0 returns a plain text response, S2 returns a response in JSON format.
- Examples
- M39 ; report information for SD card 0 in plain text format
- M39 P1 S2 ; report information for SD card 1 in JSON format
This command returns information about the SD card in the specified slot in the requested format. At least the following is returned:
- Whether or not a usable card is present in the slot
- The capacity of the card in bytes (if a card is present)
- The amount of free space on the card in bytes (if a card is present)
The JSON response has the following format (more fields may be added in future):
{"SDinfo":{"slot":0,"present":1,"capacity":4294967296,"free":2147485184,"speed":20971520,"clsize":32768}}
The capacity, free space and cluster size are in bytes, and the interface speed is in bytes/second.
M40: Eject
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Use macro file M40.g | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
If your RepRap machine can eject the parts it has built off the bed, this command executes the eject cycle. This usually involves cooling the bed and then performing a sequence of movements that remove the printed parts from it. The X, Y and Z position of the machine at the end of this cycle are undefined (though they can be found out using the M114
command, q.v.).
See also M240
and M241
below.
M41: Loop
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No, use 'while' command | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M41
If the RepRap machine was building a file from its own memory such as a local SD card (as opposed to a file being transmitted to it from a host computer) this goes back to the beginning of the file and runs it again. So, for example, if your RepRap is capable of ejecting parts from its build bed then you can set it printing in a loop and it will run and run. Use with caution - the only things that will stop it are:
- When you press the reset button,
- When the build material runs out (if your RepRap is set up to detect this), and
- When there's an error (such as a heater failure).
M42: Switch I/O pin
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | No | No | No |
- Parameters
Pnnn
Pin numberSnnn
Pin value- Example
M42 P7 S255
M42
switches a general purpose I/O pin. Use M42 Px Sy
to set pin x to value y, when omitting Px the LEDPIN will be used.
In Teacup, general purpose devices are handled like a heater, see M104.
In Marlin Firmware, pin numbers for 32-bit processors are in the form PORT * 100 + PIN. So pin P1_02 on LPC1768 can be set with M42 P102 S1
.
Marlin 1.x includes an I
parameter to permit setting "volatile" pins that Marlin is using.
Marlin 2.0.5.2 - 2.0.9.3 uses the M
parameter to set the pin mode: 0=INPUT, 1=OUTPUT, 2=INPUT_PULLUP, 3=INPUT_PULLDOWN. In Marlin 2.0.9.4 and up the T
parameter is used instead.
In RepRapFirmware, the S field may be in the range 0..1 or 0..255. The pin reference is an internal firmware reference named "digital pin", see Duet pinout. It maps on different connector pins depending the hardware. On Duet 0.6 and 0.8.5 hardware using pre-1.16 firmware, the supported pin numbers and their names on the expansion connector are:
P | Name | Expansion Port Pin |
---|---|---|
16 | TXD1 | 11 |
17 | RXD1 | 12 |
18 | TXD0 | 13 |
19 | RXD0 | 14 |
20 | TWD1 | 35 |
21 | TWCK1 | 36 |
23 | PA14 | 10 |
36 | PC4 | 18 |
52 | AD14 | 41 |
67 | PB16 | 32 |
In firmware 1.16, the pin numbering has changed.
P | Name | Expansion Port Pin |
---|---|---|
60 | PA10/RXD0 | 14 |
61 | PA11/TXD0 | 13 |
62 | PA12/RXD1 | 12 |
63 | PA13/TXD1 | 11 |
64 | PA14/RTS1 | 10 |
65 | PB12/TWD1 | 35 |
66 | PB13/TWCK1 | 36 |
67 | PB16/DAC1* | 32 |
68 | PB21/AD14 | 41 |
69 | PC4 | 18 |
- Also used as CS signal on external SD card socket
P | Signal Name | Expansion Connector Label | Expansion Pin |
---|---|---|---|
60 | CS5 | CS5 | 50 |
61 | CS6 | E3_STOP | 9 |
62 | CS7 | E4_STOP | 14 |
63 | CS8 | E5_STOP | 19 |
See Using servos and controlling unused I/O pins for all pin definitions.
Pre-1.16 example:
M42 P20 S1 ;set the connector pin 35 to high.
On RADDS hardware running RepRapFirmware-dc42, the supported Arduino Due pin numbers and their names are:
5 TIOA6, 6 PWML7, 39 PWMH2, 58 AD3, 59 AD2, 66 DAC0, 67 DAC1, 68 CANRX0, 69 CANTX0, 70 SDA1, 71 SCL1, 72 RX LED, 73 TX LED.
See also M583
.
M43: Stand by on material exhausted
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M600 | No | No | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Example
M43
If your RepRap can detect when its material runs out, this decides the behaviour when that happens. The X and Y axes are zeroed (but not Z), and then the machine shuts all motors and heaters off except the heated bed, the temperature of which is maintained. The machine will still respond to G and M code commands in this state.
M43: Pin report and debug
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
M43 En Pnnn Wn In
- Parameters
En
Enable / disable background endstop monitoringPnnn
Pin to read or watch. If omitted, read/watch all pinsWn
bool watch pins -reporting changes- until reset, click, orM108
In
bool Flag to ignore pin protection
- Note
- You must have
PINS_DEBUGGING
uncommented in yourConfiguration_adv.h
file for M43 to work.
M44: Codes debug - report codes available
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
In MK4duo you must enable FASTER_GCODE_EXECUTE
to get this G-code.
- Parameters
In
G-code listJn
M-code list
M44: Reset the bed skew and offset calibration
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
??? | ??? | ??? | Yes | ??? | ??? | ??? | ??? | ??? | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? |
Resets the bed skew and offset calibration on Prusa i3 MK2/s,MK2.5/s,MK3/s.
M45: Bed skew and offset with manual Z up
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
??? | ??? | ??? | Yes | ??? | ??? | ??? | ??? | ??? | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? |
Runs the xyz calibration on Prusa i3 MK2/s,MK2.5/s,MK3/s.
- Parameters
Vnn
Verbosity level 1, 10 and 20 (low, mid, high). Only when SUPPORT_VERBOSITY is defined. This parameter is optional.
M46: Show the assigned IP address
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
??? | Use M552 | ??? | Yes | Yes | ??? | ??? | ??? | ??? | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? |
Reports the assigned IP address of a Toshiba FlashAir on Prusa i3 MK2/s,MK2.5/s,MK3/s. At this moment it is deactivated.
M47: Show end stops dialog on the display
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
??? | ??? | ??? | Yes | ??? | ??? | ??? | ??? | ??? | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? | ??? |
Show end stops dialog on the display on Prusa i3 MK2/s,MK2.5/s,MK3/s.
M48: Measure Z-Probe repeatability
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Use macro M48.g | ??? | Yes1 | No | No | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Pnnn
number of pointsXnnn
position on the X axisYnnn
position on the Y axisVnnn
verbosityE
engageLnnn
legs of travelS
schizoid
As with G29
, the E flag causes the probe to stow after each probe.
The S flag will result is a random sized, 5 pointed star, being traced (X and Y axis) between each sample. Usually a user will get worse repeat-ability numbers with S specified because the X axis and Y axis movements will add to the machine's positioning errors.
- Prusa specific 1
This function assumes the bed has been homed. Specifically, that a G28 command as been issued prior to invoking the M48 Z-Probe repeatability measurement function. Any information generated by a prior G29 Bed leveling command will be lost and need to be regenerated.
The number of samples will default to 10 if not specified. You can use upper or lower case letters for any of the options EXCEPT n. n must be in lower case because Marlin uses a capital N for its communication protocol and will get horribly confused if you send it a capital N.
- Usage
M48 nAA Xnnnn Ynnnn Vn Lnn
- Parameters
nAA
number(AA) of samples, default=10 (valid values between 4 and 50)Xnnn
X position for samplesYnnn
Y position for samplesVn
Verbosity level 1-4 (low to highest)Lnn
Legs of travel 1-15
M49: Set G26 debug flag
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
- M49 S1 ; Enable G26 verbose debug output
M70: Display message
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M117 | M117 | M117 | No | No | M117 | M117 | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | M117 | No | M117 | Yes |
- Example
M70 P200 Message
Display a message on the LCD. P
is the time to display message for.
M72: Firmware dependent
M72: Play a tone or song
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M300 | M300 | No | M300 | M300 | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No: See M300 | Yes |
- Example
M72 P2
Instruct the machine to play a preset song. Acceptable song IDs are machine specific. P is the ID of the song to play.
M72: Set/get Printer State
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Without any parameter get printer state
0
NotReady Used by PrusaConnect1
IsReady Used by PrusaConnect2
Idle3
SD printing finished4
Host printing finished5
SD printing6
Host printing
- Usage
M72 [ S ]
- Parameters
S
Set printer state 0 = not_ready, 1 = ready
M73: Set/Get build percentage
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | 3.3 and later | ??? | Yes1 | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | Yes |
- Example
M73 P50
Tell the firmware the current build progress percentage. The machine is expected to display this on its display. If the percentage is exactly 0 a "Build Start" notification is sent to the host. If the percentage is exactly 100 a "Build End" notification is sent to the host.
Use "M73" by itself to get a report of the current print progress.
- Prusa specific1
Prusa firmware shows percent done, time remaining and time to change/pause/user interaction.
- Usage
M73 P R Q S C1 D1
- Parameters
- This command can be used without any additional parameters.
P
Percent in normal modeR
Time remaining in normal mode (minutes)Q
Percent in silent modeS
Time remaining in silent mode (minutes)C
Time to change/pause/user interaction in normal mode (minutes)1D
Time to change/pause/user interaction in silent mode (minutes)1- Examples
M73 echo NORMAL MODE: Percent done: ---%; print time remaining in mins: -----" echo SILENT MODE: Percent done: ---%; print time remaining in mins: -----" Prusa Firmware 3.10.0+1 echo NORMAL MODE: Percent done: ---%; print time remaining in mins: -----; Change in mins: -----"1 echo SILENT MODE: Percent done: ---%; print time remaining in mins: -----; Change in mins: -----"1
M74: Set weight on print bed
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | Yes | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
W
Set the total mass in grams of everything that is currently on the bed.
- Example
M74 W100
Tell the firmware the current weight of 100g on the bed.
M75: Start the print job timer
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | Yes | Yes | No | No | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
M76: Pause the print job timer
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | Yes | Yes | No | No | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
M77: Stop the print job timer
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | Yes | Yes | No | No | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
M78: Show statistical information about the print jobs
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | No | Yes | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
M79: Start host timer
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | Yes | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Start the printer-host enable keep-alive timer. While the timer has not expired, the printer will enable host specific features.
- Usage
M79 [ S ]
- Parameters
S
Quoted string containing two characters e.g. "PL"
M80: ATX Power On
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes1 | Yes | Yes | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | Yes | No | No | No | No | automatic | No | ??? |
- Parameters
C"port_name"
(RepRapFirmware 3.4 and later only) Name of the pin used to control the power supply, default "pson"
- Examples
M80 ; Turn on the power supply M80 S ; Report power supply state (Marlin 1.1.1) M80 C"!pson" ; invert the PS_ON output for Meanwell power supplies
Turns on the ATX power supply from standby mode to fully operational mode. No-op on electronics without standby mode.
- Notes
- Marlin requires the
POWER_SUPPLY
configuration option to be set to a non-zero value to enableM80
. - Some firmwares (e.g., Teacup) handle power on/off automatically, so this is redundant there. Also, see RAMPS wiring for ATX on/off.
- Prusa requires
defined (PS_ON_PIN)
andPS_ON_PIN
must be set.1
M81: ATX Power Off
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes1 | Yes | Yes | No | No | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | Yes | No | No | No | Yes | automatic | No | ??? |
- Parameters
- P quit the daemon (redeem only)
- R restart the daemon (redeem only)
- Sn n=0 turn power off immediately (default), n=1 turn power off when all thermostatic fans have turned off (RepRapFirmware 1.20 and later only)
- Examples
- M81 ; turn power off immediately
- M81 S1 ; turn power off when everything has cooled down (RepRapFirmware)
Turns off the ATX power supply. Counterpart to M80
.
- Notes
- Prusa requires
defined (PS_ON_PIN)
andPS_ON_PIN
must be set to Power off.1
M82: Set extruder to absolute mode
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | Yes | Yes | ??? |
- Example
M82
Makes the extruder interpret extrusion as absolute positions.
This is the default in repetier and for Yaskawa controllers.
M83: Set extruder to relative mode
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | Yes | Yes | ??? |
- Example
M83
Makes the extruder interpret extrusion values as relative positions.
Note that the Ultimaker 3 will revert back to absolute extrusion after each tool change.
M84: Stop idle hold
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes3 | Yes2 | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | Yes | Yes | No | ??? |
- Parameters
- This command can be used without any additional parameters.
Innn
Reset flags1- Example
M84
Stop the idle hold on all axis and extruder. In some cases the idle hold causes annoying noises, which can be stopped by disabling the hold. Be aware that by disabling idle hold during printing, you will get quality issues. This is recommended only in between or after printjobs.
On Marlin, Repetier and RepRapFirmware, M84
can also be used to configure or disable the idle timeout. For example, "M84 S10" will idle the stepper motors after 10 seconds of inactivity. "M84 S0" will disable idle timeout; steppers will remain powered up regardless of activity.
For Yaskawa systems M84 is not applicable due to servo motors not producing the annoying noises.
- Notes
1RepRapFirmware-dc42 and other firmware may not support this parameter.
2Prusa firmware uses M84
similar to G-code#M18:_Disable_all_stepper_motors
3On Klipper M84
is equivalent to G-code#M18:_Disable_all_stepper_motors
- Prusa Usage
M84 E S X Y Z
- Prusa Parameters
- This command can be used without any additional parameters.2
E
Extruder drive(s)2S
SecondsX
X axisY
Y axisZ
Z axis
M85: Set Inactivity Shutdown Timer
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | Yes | Yes | Yes | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | No | No | ??? |
- Example
M85 S30
Set Inactivity Shutdown Timer with parameter S<seconds>. "M85 S0" will disable the inactivity shutdown time (default)
M86: Set Safety Timeout
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.1.3 | No | ??? | Yes | Yes | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
M86 Snnnn
- Parameters
S
SecondsT
Trigger Temperature (Marlin)E
Extruder Idle Temperature (Marlin)B
Bed Idle Temperature (Marlin)
Similar to M85
but applies to the "safety timer" in Prusa and Marlin Firmware.
Set the Safety Timeout in seconds. M86 S0 will disable the safety timer.
When the safety timer expires, heatbed and nozzle target temperatures are set to zero (Prusa Firmware) or idle temperatures (Marlin).
In Marlin Firmware the Hotend Idle Timeout is active whenever the hotend temperature goes above the trigger value and the timer gets reset whenever the extruder or other axes move. So if the machine is sitting idle for the timeout period (set by M86 T) the machine will reduce the hotend and bed temperatures to those set by M86 E and M86 B. These settings are saved to the EEPROM by M500 and reset to configuration defaults by M502.
M87: Cancel Safety Timer
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.1.3 | No | No | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Usage
M87
Cancels the safety timer. Equivalent to M86 S0
.
M92: Set axis_steps_per_unit
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | Yes | No | No | ??? |
- Parameters
Xnnn
Steps per unit for the X driveYnnn
Steps per unit for the Y driveZnnn
Steps per unit for the Z driveEnnn
Steps per unit for the extruder drive(s)Snnn
Defines in which microstepping the above steps per unit are given. If omitted it will use the microstepping currently set by M350.1- Examples
M92 X87.489 Y87.489 Z87.489 M92 E420:420
Allows programming of steps per unit (usually mm) for motor drives. These values are reset to firmware defaults on power on, unless saved to EEPROM if available (M500
in Marlin) or in the configuration file (config.g in RepRapFirmware). Very useful for calibration.
RepRapFirmware will report the current steps/mm if you send M92
without any parameters.
For Yaskawa systems M92/M93 is not applicable due to use of servo motors.
- Notes
1 Only available in RepRapFirmware >=2.03
M93: Send axis_steps_per_unit
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Use M92 | ??? | ??? | ??? | ??? | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | No | No | No | ??? |
M98: Call Macro/Subprogram
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | Yes | No |
- Parameters
Pnnn
Macro filename. In RepRapFirmware 3 this must be enclosed in double-quote characters. In RepRapFirmware 2 the double-quote characters are optional.- Example
M98 Pmymacro.g M98 P"mymacro.g"
Runs the macro in the file mymacro.g. In conventional G Codes for CNC machines the P
parameter normally refers to a line number in the program itself (P2000 would run the Macro starting at line O2000, say). For RepRap, which almost always has some sort of mass storage device inbuilt, it simply refers to the name of a G-code file that is executed by the G98
call. That G-code file does not need to end with an M99
(return) as the end-of-file automatically causes a return. RepRapFirmware supports nested macro calls up to a depth of 5.
Certain machine parameters are saved at the start of the macro call and restored at the end. For RepRapFirmware these are: axis movement relative/absolute mode, extruder movement absolute/relative mode, feed rate, inches/mm setting, and whether or not volumetric extrusion is selected. This allows the macro to change these settings without affecting the subsequent behaviour of the calling file.
RepRapFirmware also allows the filename to include a path to a subdirectory. For relative paths, the default folder is /sys, but some implementations may check the /macros directory too. Absolute file paths are supported by RepRapFirmware too.
M99: Return from Macro/Subprogram
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | Yes | No |
- Example
M99
Returns from an M98
call.
RepRapFirmware closes the currently active macro file. If a nested macro is being run, RepRapFirmware goes up one stack level.
M101: Turn extruder 1 on (Forward), Undo Retraction
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes: 1.17c and later | ??? | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | Yes | No | No | No | Yes | No | ??? |
In Teacup firmware:
If a DC extruder is present, turn that on. Else, undo filament retraction, which means, make the extruder ready for extrusion. Complement to M103
.
In BFB/RapMan: Turn extruder on (forward/filament in).
In RepRapFirmware: undo filament retraction. The length and speed are set by the M207
command. RepRapFirmware supports this command for compatibility with Simplify3D.
In other firmwares:
Deprecated. Regarding filament retraction, see G10
, G11
, M207
, M208
, M227
, M228
, M229
.
M102: Turn extruder 1 on (Reverse)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | Yes | No | No | No | No | No | No |
In BFB/RapMan firmware: Turn extruder on Reverse (Still to add)
M102: Configure Distance Sensor
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.1.1 | No | No | No | No | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
For Marlin's BD_SENSOR
option, configure the sensor.
-
M102 S<10ths>
: Set adjustable Z height in 10ths of a mm (e.g., 'M102 S4
' enables adjusting for Z <= 0.4mm.) -
M102 S0
: Disable adjustable Z height.
- Negative S values are commands
-
M102 S-1
: Read sensor information -
M102 S-5
: Read raw Calibration data -
M102 S-6
: Start Calibration
M103: Turn all extruders off, Extruder Retraction
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes: 1.17c and later | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | Yes | No | No | No | Yes | No | ??? |
In Teacup firmware:
If a DC extruder is present, turn that off. Else, retract the filament in the hope to prevent nozzle drooling. Complement to M101
.
In BFB/RapMan firmware: Turn extruder off.
In RepRapFirmware: retract filament. The length and speed are set by the M207
command. RepRapFirmware supports this command for compatibility with Simplify3D.
In other firmwares: Deprecated. Regarding filament retraction, see G10
, G11
, M207
, M208
, M227
, M228
, M229
.
M104: Set Extruder Temperature
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
- Parameters
C
Use fan for cooling (Buddy only)Dnnn
Display temperature (Buddy only)Snnn
Target temperatureRnnn
Idle temperature (Only MK4duo)
- Example
M104 S190 M104 S190 R170
Set the temperature of the current extruder to 190oC and return control to the host immediately (i.e. before that temperature has been reached by the extruder). See also M109.
See also using G10. Deprecation of M104
is subject to discussion. --Traumflug 11:33, 19 July 2012 (UTC)
M104 in Marlin Firmware
See Marlin Wiki. In Marlin Firmware, using M104
with no parameters will turn off the heater for the current extruder. This is also the case for M104 S
without a number after the S
parameter.
M104 in Teacup Firmware
In Teacup Firmware, M104
can be additionally used to handle all devices using a temperature sensor. It supports the additional P
parameter, which is a zero-based index into the list of sensors in config.h. For devices without a temp sensor, see M106.
- Example
M104 P1 S100
Set the temperature of the device attached to the second temperature sensor to 100°C.
M104 in RepRapFirmware and Klipper
RepRapFirmware and some other firmwares support the optional T
parameter (as generated by slic3r) to specify which tool the command applies to.
M105: Get Extruder Temperature
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes1 | Yes | Yes | Yes | Yes2 | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | Yes | No | Yes | Yes | No | Yes |
- Parameters
- This command can be used without any additional parameters.
- Examples
M105
Request the temperature of the current extruder, the build base and the build chamber in degrees Celsius. The temperatures are returned to the host computer. For example, the line sent to the host in response to this command can look like:
ok T:201 B:117 ok T:201 /202 B:117 /120 ok T:201 /202 B:117 /120 C:49.3 /50 ok T:201 /202 T0:110 /110 T1:23 /0 B:117 /120 C:49.3 /50 ok T0:110 /110 T1:23 /0 B:117 /120 ok T:20.2 /0.0 B:19.1 /0.0 T0:20.2 /0.0 @:0 B@:0 P:19.8 A:26.4
The parameters mean the following:
- T, T0, ..., Tn - extruder temperature. In a single extruder setup, only T will be reported. Some firmware variants will report no T0 in multi extruder setups - in that case T is to be considered the temperature of the first tool. Otherwise, T should be considered the temperature of the currently selected tool (which will be repeated in one of the Tn entries)
- B - bed temperature
- C - chamber temperature
- @ - Hotend power
- B@ - Bed power
- P - PINDAv2 actual (Prusa MK2.5/s MK3/s only)1
- A - Ambient actual (Prusa MK3/s only)1
A temperature report will usually include actual and target temperature for all available heaters, with the format being "actual/target" or - for some firmware variants - "actual /target". During a blocking heatup some firmware variants only report the temperature tuple for the heater that is currently in blocking heatup state.
Note that temperatures can be reported as integers or floats. There sadly are a lot of interpretations of how an M105 response should look like across firmware variants, making parsing them potentially tricky.
Expansion/generalization of M105
to be considered using S1 parameter as noted in Pronterface I/O Monitor
In Repetier and MK4duo you can add X0 (X1 MK4duo) to get raw values as well:
M105 X0 ==> 11:05:48.910 : T:23.61 /0 @:0 T0:23.61 /0 @0:0 RAW0:3922 T1:23.89 /0 @1:0 RAW1:3920
Recent versions of RepRapFirmware also report the current and target temperatures of all active heaters.
1Druid firmware
Temperature actual/target in Celcius (actual with one decimal , target is integer)
- T0: in a single extruder systems,
- T0: and T1: in dual extruder systems.
- B: for Heated bed
- C: for Heated chamber
Power applied (PWM value 0-255)
- @0: and @1: for Hotends
- B@: for Heated bed
- C@: for Heated chamber
Active or not, the values for all available heaters on the system are sent.
- Examples
- T0:27.8/0 @0:0
- T0:27.7/0 B:21.6/0 @0:0 B@:0
- T0:27.8/0 T1:27.8/210 B:21.6/0 C:85.0/0 @0:0 @1:255 B@:0 C@:0
M106: Fan On
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ??? |
- Parameters
Pnnn
Fan number (optional, defaults to 0)2Snnn
Fan speed (0 to 255; RepRapFirmware also accepts 0.0 to 1.0))- Extra Parameters
Innn
Invert signal, or disable fan1 3Fnnn
Set fan PWM frequency, in Hz1 3Lnnn
Set minimum fan speed (0 to 255 or 0.0 to 1.0)1 3Xnnn
Set maximum fan speed (0 to 255 or 0.0 to 1.0)1 3Bnnn
Blip time - fan will be run at full PWM for this number of seconds when started from standstill1Hnn:nn:nn...
Select heaters monitored when in thermostatic mode1 3Rnnn
Restore fan speed to the value it has when the print was paused1Tnnn
Set thermostatic mode trigger temperatureCnnn
Set custom name (RRF > 2.01 only)1- Example
M106 S127
- Examples (RepRapFirmware)
M106 P1 I1 S87 M106 P1 T45 H1:2 M106 P2 B0.1 L0.05
The first example turns on the default cooling fan at half speed. The second one inverts the cooling fan signal of the second fan and sets its value to 1/3 of its maximum. The third one sets the second fan to a thermostatic fan for heaters 1 and 2 (e.g. the extruder heaters in a dual-nozzle machine) such that the fan will be on when either hot end is at or above 45C.
Mandatory parameter 'S' declares the PWM value (0-255). M106 S0
turns the fan off. In some implementations like RepRapFirmware the PWM value may alternatively be specified as a real fraction: M106 S0.7
.
- Notes
1These parameters are only available in RepRapFirmware.
2Marlin 1.0 to 1.1.6 only supports a single fan. Marlin 1.1.7 and up supports up to 3 fans.
3These parameters are only available in MK4duo.
M106 in RepRapFirmware
If an S
parameter is provided but no other parameter is present, then the speeds of the print cooling fans associated with the current tool will be set (see the F
parameter in the M563
command). If no tool is active then the speed of Fan 0 will be set. Either way, the speed is remembered so that it can be recalled using the R2
parameter (see below).
If no S
parameter is given but the R1 parameter is used, the fan speed when the print was last paused will be set. If the R2
parameter is used, then the speeds of the print cooling fans associated with the current tool will be set to the remembered value (see above).
The T
and H
parameters allow a fan to be configured to operate in thermostatic mode, for example to use one of the fan channels to control the hot end fan. In this mode the fan will be fully on when the temperature of any of the heaters listed in the H
parameter is at or above the trigger temperature set by the T
parameter, and off otherwise. Thermostatic mode can be disabled using parameter H-1.
The B
parameter sets the time for which the fan will be operated at full PWM when started from cold, to allow low fan speeds t be used. A value of 0.1 seconds is usually sufficient.
The L
parameter defines the minimum PWM value that is usable with this fan. If a lower value is commanded that is not zero, it will be rounded up to this value.
The X
parameter defines the maximum PWM value that is allowed for this fan. If a higher value is commanded, it will be rounded down to this value.
The I
parameter causes the fan output signal to be inverted if its value is greater than zero. This makes the cooling fan output suitable for feeding the PWM input of a 4-wire fan via a diode. If the parameter is present and zero, the output is not inverted. If the I
parameter is negative then in RRF 1.16 and later the fan is disabled, which frees up the pin for use as a general purpose I/O pin that can be controlled using M42
.
M106 in Teacup Firmware
Additionally to the above, Teacup Firmware uses M106
to control general devices. It supports the additional P
parameter, which is an zero-based index into the list of heaters/devices in config.h.
- Example
M106 P2 S255
Turn on device #3 at full speed/wattage.
Note: When turning on a temperature sensor equipped heater with M106
and M104
at the same time, temperature control will override the value given in M106
quickly.
Note well: The ambiguous text in the note above needs to be reworded by someone who knows the actual functioning. Below is my interpretation based on language use, not practical experience or code inspection.
Note: If M104
is (or becomes) active on a heater (or other device) with a feedback sensor it will correct any M106
initiated control output value change in the time it takes for the PID (of other feedback) loop to adjust it back to minimum error. It may not be easy to observe a change in the temperature (process value) due to this brief change in the control value
M107: Fan Off
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | Yes | Yes | Yes | Yes | No | Yes | ??? |
Deprecated in Teacup firmware and in RepRapFirmware. Use M106 S0
instead.
M108: Cancel Heating
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | No | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | Yes | No | No | Yes | No | No | ??? |
Breaks out of an M109
or M190
wait-for-temperature loop, continuing the print job. Use this command with caution! If cold extrusion prevention is enabled (see M302
) and the temperature is too low, this will start "printing" without extrusion. If cold extrusion prevention is disabled and the hot-end temperature is too low, the extruder may jam.
This command was introduced in Marlin 1.1.0. As with other emergency commands [e.g., M112
] this requires the host to leave space in the command buffer, or the command won't be executed until later.
Recent versions of Marlin introduce EMERGENCY_PARSER
, which overcomes the buffer limitation by watching the incoming serial stream. Commands M108, M112, M410, and M876 can all be intercepted by the emergency parser, so it is recommended to enable this feature.
M108: Set Extruder Speed (BFB)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | Yes | No | No | No | No | No | ??? |
Sets speed of extruder motor.
(Deprecated in FiveD firmware, see M113
)
M109: Set Extruder Temperature and Wait
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | Yes | Yes | Yes | not needed | Yes | Yes |
- Parameters
C
Use fan for cooling (Buddy only)Snnn
minimum target temperature, waits until heatingRnnn
maximum target temperature, waits until cooling (Sprinter)Rnnn
accurate target temperature, waits until heating and cooling (Marlin and MK4duo)Tn
tool number (RepRapFirmware and Klipper), optional- Example
M109 S215
M109 in Teacup
Not needed. To mimic Marlin behaviour, use M104 followed by M116.
M109 in Marlin, MK4duo, Sprinter (ATmega port), RepRapFirmware, Prusa
Set extruder heater temperature in degrees celsius and wait for this temperature to be achieved.
- Example
M109 S185
RepRapFirmware also supports the optional T
parameter (as generated by slic3r) to specify which tool the command refers to (see below).
M109 in Sprinter (4pi port)
Parameters: S
(optional), set target temperature value. If not specified, waits for the temperature set by M104. R
(optional), sets target temperature range maximum value.
- Example
M109 S185 R240 ; set extruder temperature to 185 and wait for the temperature to be between 185 - 240.
If you have multiple extruders, use T
or P
parameter to specify which extruder you want to set/wait.
Another way to do this is to use G10.
M109 in MakerBot
- Example
M109 S70 T0
Sets the target temperature for the current build platform. S is the temperature to set the platform to, in degrees Celsius. T is the platform to heat.
M109 in Klipper
According to the documentation, Klipper will wait for the specified temperature to settle, i.e. it will wait until it goes back down in case it overshoots. Klipper also supports the optional T
parameter to specify which tool the command refers to (see above).
M110: Set Current Line Number
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | Yes | not needed | No | ??? |
This command is used for host handshaking, error detection, and resend requests in host-driven print jobs when line numbers are used. See the G-code protocol described above.
- Parameters
Nnnn
Line number- Example
M110 N123
This example sets the current command line number to 123. Thus the expected next line after this command will be 124.
In Marlin 2.1.3 and up M110
with no parameter reports the current command line number.
M111: Set Debug Level
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | No2 | Yes | Yes | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | Yes | Debug | No | ??? |
- Parameters
Pnnn
Debug module1Snnn
Debug on/off- Examples
M111 S6 M111 P1 S1
Enable or disable debugging features in the firmware. The implementation may look different per firmware.
- Notes
1This parameter is only available in RepRapFirmware.
2Prusa fimrware use D-codes/commands for debugging.
M111 in RepRapFirmware
RepRapFirmware allows debugging to be set for each module. If the optional 'P' parameter is not specified, debugging will be enabled for all modules. For a list of modules, send M111 S1 P15
.
M111 in Repetier
Set the level of debugging information transmitted back to the host to level 6. The level is the OR of three bits:
#define DEBUG_ECHO (1<<0) #define DEBUG_INFO (1<<1) #define DEBUG_ERRORS (1<<2) #define DEBUG_DRYRUN (1<<3) // repetier-firmware #define DEBUG_COMMUNICATION (1<<4) // repetier-firmware
Thus 6 means send information and errors, but don't echo commands. (This is the RepRap default.)
For firmware that supports ethernet and web interfaces M111 S9
will turn web debug information on without changing any other debug settings, and M111 S8
will turn it off. Web debugging usually means that HTTP requests will be echoed to the USB interface, as will the responses.
M112: Full (Emergency) Stop
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | Yes | Yes | No | ??? |
- Example
M112
Any moves in progress are immediately terminated, then RepRap shuts down. All motors and heaters are turned off. It can be started again by pressing the reset button on the master microcontroller. See also M0
and M1
.
Please note while many systems termed this an Emergency Stop, this terminology is regulated in many regions with specific requirements behind its use. Marlin 2.0.x has renamed this to Full Stop. RepRapFirmware has indicated an intention to make a similar change as well. This stop function is NOT implemented in a Category 0 or 1 stop fashion or with fail-safe hardware compliying with PLd or better. The function as implemented is a category 2 software stop with no redundancies.
M113: Set Extruder PWM
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | No | No | No | ??? |
- Example
M113
Set the PWM for the currently-selected extruder. On its own this command sets RepRap to use the on-board potentiometer on the extruder controller board to set the PWM for the currently-selected extruder's stepper power. With an S field:
M113 S0.7
it causes the PWM to be set to the S
value (70% in this instance). M113 S0
turns the extruder off, until an M113
command other than M113 S0
is sent.
M113: Host Keepalive
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.9+ | No | ??? | Yes | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
During some lengthy processes, such as G29, Marlin may appear to the host to have “gone away.” The “host keepalive” feature will send messages to the host when Marlin is busy or waiting for user response so the host won’t try to reconnect.
- Usage
M113 Snnn
- Parameters
Snnn
keepalive interval to set- Examples
M113 S2
M114: Get Current Position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | Yes | No | Yes | Yes | No | Yes |
- Example
M114
This causes the RepRap machine to report its current X, Y, Z and E coordinates to the host.
For example, the machine returns a string such as:
ok C: X:0.00 Y:0.00 Z:0.00 E:0.00
In Marlin first 3 numbers is the position for the planner. The other positions are the positions from the stepper function. This helps for debugging a previous stepper function bug.
X:0.00 Y:0.00 RZ:0.00 LZ:0.00 Count X:0.00 Y:0.00 RZ:41.02 LZ:41.02
M115: Get Firmware Version and Capabilities
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes2 | Yes | Yes | Yes | Yes | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | Yes | No | Yes | Yes | No | No |
- Parameters
- This command can be used without any additional parameters.
Bnnn
(RepRapFirmware 3 only) Expansion board number (typically the CAN address) for which the firmware version is requested, default 0 (i.e. main board)Pnnn
Electronics type1V
Report the Prusa version number2Unnnnnn
Check the firmware version provided2- Examples
M115 M115 P2
Request the Firmware Version and Capabilities of the current microcontroller The details are returned to the host computer as key:value pairs separated by spaces and terminated with a linefeed.
sample data from firmware:
ok PROTOCOL_VERSION:0.1 FIRMWARE_NAME:FiveD FIRMWARE_URL:http%3A//reprap.org MACHINE_TYPE:Mendel EXTRUDER_COUNT:1
This M115
code is inconsistently implemented, and should not be relied upon to exist, or output correctly in all cases. An initial implementation was committed to svn for the FiveD Reprap firmware on 11 Oct 2010. Work to more formally define protocol versions is currently (October 2010) being discussed. See M115_Keywords for one draft set of keywords and their meanings. See the M408
command for a more comprehensive report on machine capabilities supported by RepRapFirmware.
- Notes
1This parameter is supported only in RepRapFirmware and can be used tell the firmware about the hardware on which it is running. If the P
parameter is present then the integer argument specifies the hardware being used. The following are currently supported:
M115 P0 Automatic board type selection if supported, or default if not M115 P1 Duet 0.6 M115 P2 Duet 0.7 M115 P3 Duet 0.85
2These parameters are only supported in Prusa Firmware. Parameter Unnnnnn
will check the firmware version provided. If the firmware version provided by the U code is higher than the currently running firmware, it will pause the print for 30s and ask the user to upgrade the firmware.
sample data M115
:
FIRMWARE_NAME:Prusa-Firmware 3.8.1 based on Marlin FIRMWARE_URL:https://github.com/prusa3d/Prusa-Firmware PROTOCOL_VERSION:1.0 MACHINE_TYPE:Prusa i3 MK3S EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000
sample data M115 V
3.8.1
sample data on display for 30s or user interactionM115 U3.8.2-RC1
New firmware version availible: 3.8.2-RC1 Please upgrade.
M116: Wait
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | Yes | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | Yes | Yes | No | Yes |
- Parameters
- This command can be used without any additional parameters.1
Pnnn
Tool numberHnnn
Heater numberCnnn
Chamber number- Examples
M116 M116 P1
Wait for all temperatures and other slowly-changing variables to arrive at their set values if no parameters are specified. See also M109
.
- Notes
1Most implementations don't support any parameters, but RepRapFirmware version 1.04 and later supports an optional 'P' parameter that is used to specify a tool number. If this parameter is present, then the system only waits for temperatures associated with that tool to arrive at their set values. This is useful during tool changes, to wait for the new tool to heat up without necessarily waiting for the old one to cool down fully.
Recent versions of RepRapFirmware also allow a list of the heaters to be specified using the 'H' parameter, and if the 'C' parameter is present, this will indicate that the chamber heater should be waited for.
M117: Get Zero Position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | No | No | No | No: See M70 |
- Example
M117
This causes the RepRap machine to report the X, Y, Z and E coordinates in steps not mm to the host that it found when it last hit the zero stops for those axes. That is to say, when you zero X, the x coordinate of the machine when it hits the X endstop is recorded. This value should be 0, of course. But if the machine has drifted (for example by dropping steps) then it won't be. This command allows you to measure and to diagnose such problems. (E is included for completeness. It doesn't normally have an endstop.)
M117: Display Message
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes1 | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | Yes | No | No | No |
- Example
M117 Hello World
This causes the given message to be shown in the status line on an attached LCD. The above command will display Hello World. If RepRapFirmware is used and no LCD is attached, this message will be reported on the web interface.
- Notes
In Prusa Firmware it is also used to display internal messages on LCD.1
In RepRapFirmware the message may optionally be enclosed in double-quotation marks. Doing this is recommended, to clarify the extent of the text to be displayed.
M118: Echo message on host
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.4+ | Yes | Yes | No | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
Use this code to print a visible message to the host console, preceded by 'echo:'.
- Parameters
Pn
(RepRapFirmware only) Message targets(s): 0 = generic [default], 1 = USB, 2 = LCD, 3 = HTTP, 4 = TelnetS"msg"
(RepRepFirmware only) Message to send- Example (Marlin)
M118 Color changing to blue
- Example (RepRapFirmware)
M118 P2 S"Color changing to blue"
M118: Negotiate Features
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M118 P42
This M-code is for future proofing. NO firmware or hostware supports this at the moment. It is used in conjunction with M115
's FEATURES keyword.
See Protocol_Feature_Negotiation for more info.
M119: Get Endstop Status
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | No | Yes | Yes | No | ??? |
- Example
M119
Returns the current state of the configured X, Y, Z endstops. Takes into account any 'inverted endstop' settings, so one can confirm that the machine is interpreting the endstops correctly.
In redeem, M119
can also be used to invert end stops.
- Example
M119 X1 1
This will invert end stop X1 (Inverted means switch is connected in Normally Open state (NO))
M120: Push
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | Yes | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M120
Push the state of the RepRap machine onto a stack. Exactly what variables get pushed depends on the implementation (as does the depth of the stack - a typical depth might be 5). A sensible minimum, however, might be
- Current feedrate
- Whether moves are relative or absolute
- Whether extrusion is relative or absolute
RepRapFirmware calls this automatically when a macro file is run. In addition to the variables above, it pushes the following values on the stack:
- Whether the units are inches or mm
- Whether or not volumetric extrusion is in use
- The selected plane (see G17/G18/G19) for G2/G3 moves
M121: Pop
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | Yes | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M121
Recover the last state pushed onto the stack. RepRapFirmware calls this automatically when execution of a macro file terminates.
M120: Enable endstop detection
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | M121 | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
M121: Disable endstop detection
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | M120 | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
M122: Firmware dependent
M122: Diagnose (RepRapFirmware)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
- Bmmm Expansion board number for which diagnostics are requested, default 0 which means main board
- Pnnn Optional parameter to specify what diagnostics are required. Caution: some values of P will crash the firmware deliberately to test error handling! See the Duet3D wiki for more details.
- "DSF" Immediate DSF diagnostics (RRF3/Duet3 only with attached SBC)
P200
- LPC and STM32 Port Only Outputs the configuration of all the pins allocated by the firmware and board.txt
- Example
- M122
Sending an M122
causes the RepRap to transmit diagnostic information, for example via a USB serial link.
If RepRapFirmware is used and debugging is enabled for the Network module, this will also print LWIP stats to the host via USB.
M122: Set Software Endstop (MK4duo)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
Disabled or Enabled Software Endstop M122 S<0/1>
M122: Debug Stepper drivers (Marlin)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | No | Yes | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Get diagnostic info about L6470 or Trinamic stepper drivers having a UART or SPI interface.
With Trinamic drivers there are some extra parameters, and depending on the configuration either basic or detailed information will be reported. Use parameters X
, Y
, Z
, etc. to limit the report only to the specified steppers, otherwise all steppers are reported. Pass I
to re-initialize the drivers. Use parameter S
to sample at regular intervals. The P
parameter can be used to set the sample interval in milliseconds.
- Example
M122
M123: Firmware dependent
M123: Tachometer value (RepRap, Prusa & Marlin)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes2 | No | ??? | Yes1 | Yes | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
Sending a M123
causes the RepRap to transmit filament tachometer values from all extruders.
Sending a M123
is used in Prusa firmware to report fan speeds and fan pwm values.1
Sending a M123
is used in Marlin firmware to report only extruders fans speeds and pwm values.2
- Usage
M123
- Parameters2
Sn
autoreport every n seconds (0 to disable)
- Prusa firmware output1
E0: - Hotend fan speed in RPM
PRN1: - Part cooling fans speed in RPM
E0@: - Hotend fan PWM value
PRN1@: - Part cooling fan PWM value
- Examples1
echo E0:3240 RPM PRN1:4560 RPM E0@:255 PRN1@:255
- Examples2
echo E0:7040 RPM E0@:255
M123: Endstop Logic (MK4duo)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
Xn
X LogicYn
Y LogicZn
Z LogicIn
X2 LogicJn
Y2 LogicKn
Z2 LogicPn
Probe LogicDn
Door Logic
- Examples
M123 ; Print Status M123 X1 Y1 Z0 P0
M124: Firmware dependent
M124: Immediate motor stop
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
Immediately stops all motors.
M124: Set Endstop Pullup
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Parameters
Xn
X Pullup on/offYn
Y Pullup on/offZn
Z Pullup on/offIn
X2 Pullup on/offJn
Y2 Pullup on/offKn
Z2 Pullup on/offPn
Probe Pullup on/offDn
Door Pullup on/off
- Examples
M124 ; Print Status M124 X1 Y1 Z0 P0
M125: Firmware dependent
M125: Park Head
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | No | Yes | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | ??? | No | No | ??? |
Save the current nozzle position and move to the configured park position.
- Usage
M125 [L | P | X | Y |Z ]
- Parameters
L
Retract lengthP
Always show a prompt and await a response 1X
X position to parkY
Y position to parkZ
Z raise before park
1 Not in Prusa Buddy firmware
M125: Pause print
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | Yes | Yes | No | No | No | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | ??? | No | No | ??? |
Without any parameters it will park the extruder to default or last set position. The default pause position will be set during power up and a reset, the new pause positions aren't permanent.
- Usage
M125 [ X | Y | Z | S ]
- Parameters
X
X position to parkY
Y position to parkZ
Z raise before parkS
Set values [S0 = set to default values | S1 = set values] without pausing
Equivalent to M601 and M25 in Prusa Firmware
M126: Open Valve
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | ??? | ??? | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | No | No | No | Yes |
- Example
M126 P500
Open the extruder's valve (if it has one) and wait 500 milliseconds for it to do so.
M126 in MakerBot
- Example
M126 T0
Enables an extra output attached to a specific toolhead (e.g. fan)
M127: Close Valve
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | ??? | ??? | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | Yes | No | No | No | No | Yes |
- Example
M127 P400
Close the extruder's valve (if it has one) and wait 400 milliseconds for it to do so.
M127 in MakerBot
- Example
M127 T0
Disables an extra output attached to a specific toolhead (e.g. fan)
M128: Extruder Pressure PWM
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | ??? | ??? | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M128 S255
PWM value to control internal extruder pressure. S255
is full pressure.
M129: Extruder pressure off
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | ??? | ??? | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M129 P100
In addition to setting Extruder pressure to 0, you can turn the pressure off entirely. P400 will wait 100ms to do so.
M130: Set PID P value
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M301 | M301 | ??? | M301 | M301 | No | M301 | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | M301 | Yes | M301 | No |
- Parameters
Pnnn
heater numberSnnn
proportional (Kp)- Example
M130 P0 S8.0 ; Sets heater 0 P factor to 8.0
Teacup can control multiple heaters with independent PID controls. For the default shown at https://github.com/Traumflug/Teacup_Firmware/blob/master/config.default.h, heater 0 is the extruder (P0), and heater 1 is the bed (P1).
Teacup's PID proportional units are in pwm/255 counts per quarter C, so to convert from counts/C, you would divide by 4. Conversely, to convert from count/qC to count/C, multiply by 4. In the above example, S=8 represents a Kp=8*4=32 counts/C.
M131: Set PID I value
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M301 | M301 | ??? | M301 | M301 | No | M301 | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | M301 | Yes | M301 | No |
- Parameters
Pnnn
heater numberSnnn
integral (Ki)- Example
M131 P1 S0.5 ; Sets heater 1 I factor to 0.5
Teacup's PID integral units are in pwm/255 counts per (quarter C*quarter second), so to convert from counts/qCqs, you would divide by 16. Conversely, to convert from count/qCqs to count/Cs, multiply by 16. In the above example, S=0.5 represents a Ki=0.5*16=8 counts/Cs.
M132: Set PID D value
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M301 | M301 | ??? | M301 | M301 | No | M301 | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | M301 | Yes | M301 | Yes |
- Parameters
Pnnn
heater numberSnnn
derivative (Kd)- Example
M132 P0 S24 ; Sets heater 0 D factor to 24.0
Teacup's PID derivative units are in pwm/255 counts per (quarter degree per 2 seconds), so to convert from counts/C, you would divide by 4. Conversely, to convert from count/qC to count/C, multiply by 8. In the above example, S=24 represents a Kd=24*8=194 counts/(C/s).
M132 in MakerBot
- Example
M132 X Y Z A B
Loads the axis offset of the current home position from the EEPROM and waits for the buffer to empty.
M133: Set PID I limit value
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
M301 | M301 | ??? | M301 | M301 | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | M301 | Yes | M301 | Yes |
- Parameters
Pnnn
heater numberSnnn
integral limit (Ki)- Example
M133 P1 S264 ; Sets heater 1 I limit value to 264
Teacup's PID integral limit units are in quarter-C*quarter-seconds, so to convert from C-s, you would multiply by 16. Conversely, to convert from qC*qs to C*s, divide by 16. In the above example, S=264 represents an integral limit of 16.5 C*s.
M133 in MakerBot
Wait for the toolhead to reach its target temperature.
- Parameters
Tnn
: Extruder to wait forPnn
: Time limit, in seconds
- Example
M133 T0 P500 ; Wait for Tool 0 to reach target. Fail after 8:20.
M134: Write PID values to EEPROM
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No: See M500 | ??? | No | No | No | No: See M504 | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | Yes | No | Yes |
- Example
M134
M134 in MakerBot
- Example
M134 T0 P500
Instruct the machine to wait for the platform to reach its target temperature. T is the platform to wait for. P if present, sets the time limit.
M135: Set PID sample interval
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | Yes |
- Parameters
Snnn
Heat sample time in seconds- Example
M135 S300
Set the PID to measure temperatures and calculate the power to send to the heaters every 300ms.
M135 in MakerBot
- Example
M135 T0
Instructs the machine to change its toolhead. Also updates the State Machine's current tool_index. T is the toolhead for the machine to switch to and the new tool_index for the state machine to use.
M136: Print PID settings to host
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | M301 | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | Debug | No | ??? |
- Example
M136 P1 ; print heater 0 PID parameters to host
M140: Set Bed Temperature (Fast)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes |
- Parameters
Pnnn
Bed heater index1Hnnn
Heater number1Tnnn
Tool number2Snnn
Active/Target temperatureRnnn
Standby temperature1 2- Example
M140 S55
Set the temperature of the build bed to 55oC and return control to the host immediately (i.e. before that temperature has been reached by the bed).
- Notes
1 These parameters are only supported in RepRapFirmware. RepRapFirmware allows the bed heater to be switched off if the absolute negative temperature (-273.15) is passed as target temperature. In this case the current bed temperature is not affected:
M140 S-273.15
2 These parameters are only supported in MK4duo for Idle temperature
M140 S60 R30 M140 T1 S60 R30
There is an optional R field that sets the bed standby temperature:
M140 S65 R40
.
Recent versions of RepRapFirmware also provide an optional 'H' parameter to set the hot bed heater number. If no heated bed is present, a negative value may be specified to disable it.
M141: Set Chamber Temperature (Fast)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | ??? | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | Yes | No | uses M104 | No | ??? |
- Parameters
Pnnn
Chamber index1Hnnn
Heater number1Tnnn
Tool number2Snnn
Active/Target temperatureRnnn
Standby temperature1 2- Examples
M141 S30 M141 H0
Set the temperature of the chamber to 30oC and return control to the host immediately (i.e. before that temperature has been reached by the chamber).
- Notes
1 These parameters are only supported in RepRapFirmware and work just like in M140.
2 These parameters are only supported in MK4duo and work just like in M140.
M142: Firmware dependent
M142: Holding Pressure
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M142 S1
Set the holding pressure of the bed to 1 bar.
The holding pressure is in bar. For hardware which only has on/off holding, when the holding pressure is zero, turn off holding, when the holding pressure is greater than zero, turn on holding.
M142: Set Cooler Temperature (Fast)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Tnnn
Tool numberSnnn
Active/Target temperatureRnnn
Standby temperature- Examples
M142 S60 M142 S60 R30 M141 T1 S60 R30
Set the temperature of the cooler
M143: Firmware dependent
M143: Set Laser Cooler Temperature (Fast)
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.8+ | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Snnn
Target temperature- Examples
M143 S80
Set the target temperature of the laser cooler and return immediately. Use M193
to set and wait for the temperature to be reached.
M143: Maximum heater temperature
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
H
Heater number (RepRapFirmware 1.17 and later, default 1 which is normally the first hot end)S
Maximum temperature- Examples
M143 S275 ; set the maximum temperature of the hot-end to 275°C M143 H0 S125 ; set the maximum bed temperature to 125C
The default maximum temperature for all heaters was 300°C prior to RepRapFirmware version 1.13, and 262°C from 1.13 onwards. From RepRapFirmware 1.17 onwards, the default maximum temperatures are 262C for extruders and 125C for the bed.
When the temperature of the heater exceeds this value, countermeasures will be taken.
M144: Bed Standby
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | Yes | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
- Pnn Bed heater number, default 0
- Sn 0 = set bed heater to standby (default), 1 = set bad heater active
- Example
M144
Switch the bed heater to its standby temperature. M140 S1
turns it back to its active temperature.
M146: Set Chamber Humidity
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Rnnn
Relative humidity in percent- Example
M146 R60
Set the relative humidity of the chamber to 60% and return control to the host immediately (i.e. before that humidity has been reached by the chamber).
M149: Set temperature units
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
C
Flag to treat temperature as degrees CelsiusK
Flag to treat temperature as Kelvin- Example
M149 K
It affects the S
or R
values in the codes M104
, M109
, M140
, M141
, M143
, M190
and G10.
The default is M149 C
.
M150: Set LED color
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | See below | ??? | No1 | Yes | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Rnnn
Red componentUnnn
Green componentBnnn
Blue componentWnnn
White component (Marlin)Pnnn
Brightness (0-255) (Marlin, also RepRapFirmware 2.03 and later)P
Set full brightness (Marlin)Snnn
(RepRapFirmware) Number of individual LEDs to set to these coloursFn
(RepRapFirmware) Following command action. F0 (default) means this is the last command for the LED strip, so the next M150 command starts at the beginning of the strip. F1 means further M150 commands for the remainder of the strip follow this one.Xn
(RepRapFirmware) LED type: X0 (default) = DotStar, X1 = NeoPixel. This parameter is remembered from one call to the next, so it only needs to be given once.Ynn
(RepRapFirmware) Brightness, 0-31 (alternative to P 0-255)Qnnn
(RepRapFirmware) Use specified SPI frequency (in Hz) instead of default frequency. This parameter is only processed if X parameter also present. When using NeoPixels, only frequencies between about 2.5MHz and 4MHz will work.- Example
M150 R255 U128 B192
- Example (RepRapFirmware)
M150 X1 F3000000 ; set LED type to NeoPixel and set SPI frequency to 3MHz M150 R255 P128 S20 F1 ; set first 20 LEDs to red, half brightness, more commands for the strip follow M150 U255 B255 P255 S20 ; set next 20 LEDs to cyan, full brightness, finished programming LED strip
Set BlinkM, Neopixel, and/or other LED light color and intensity with RGBW component values from 0 to 255. Some LCD controllers use this interface for a backlight. Firmware may override the set color to indicate the current printer status.
RepRapFirmware uses this command to control DotStar or NeoPixel LED strips on controllers that provide a connector for this purpose. When using NeoPixel strips there is a firmware-dependent maximum number of LEDs in the strip supported determined by the size of the DMA buffer.
- Notes
In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.1
M154: Auto Report Position
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.8.1 | No | No | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Hosts normally monitor printer position by sending M114
every couple of seconds. This adds more serial traffic and fails if the command queue is full. M154
reduces traffic by setting the firmware to report the 'projected' position at regular intervals. This behavior is disabled by default for best compatibility with existing hosts. If the firmware supports M154
the output of M115
will report the AUTOREPORT_POS
capability.
- Usage
M154 Snnn
: Set the auto-report interval in seconds. Set the interval to 0 to disable.
M155: Automatically send temperatures
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0+ | No | ??? | Yes1 | Yes | Yes | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Snnn
enable sending temperatures = 1, disable = 0Snnn
Interval in seconds between auto-reports. S0 to disable. (Marlin) Prusa has a Maximum: 2551Cnn
Activate auto-report function (bit mask). Default is temperature.1
- C bitmap1
bit 0 = Auto-report temperatures
bit 1 = Auto-report fans
bit 2 = Auto-report position
bit 3 = free
bit 4 = free
bit 5 = free
bit 6 = free
bit 7 = free
- Examples
M155 S1 ; Enable temperature report (Marlin: every 1 second) M155 S0 ; Stop reporting temperatures M155 S4 ; Report temperatures every 4 seconds (Marlin) M155 S4 C7; Reports temperatures, fans and position every 4 seconds (Prusa)1
Hosts normally monitor printer temperatures by sending M105
every couple of seconds. This not only adds serial traffic but it will fail whenever the command queue is full. M155
addresses these problems by telling the firmware to automatically report temperatures at regular intervals. This behavior is disabled by default for best compatibility with existing hosts. If the firmware supports M155
the output of M115
will report the AUTOREPORT_TEMP
capability:
Cap:AUTOREPORT_TEMP:1
Prusa Firmware 3.10.0+ also adds capabilities:
Cap:AUTOREPORT_FANS:1 Cap:AUTOREPORT_POSITION:1 Cap:EXTENDED_M20:1
M160: Number of mixed materials
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
No | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | No | No | No | No | No | No | No | ??? |
- Example
M160 S4
This command has been superseded by the tool definition command M563
(see below).
Set the number of materials, N, that the current extruder can handle to the number specified. The default is 1.
When N >= 2, then the E field that controls extrusion requires N values separated by colons ":" after it like this:
M160 S4 G1 X90.6 Y13.8 E2.24:2.24:2.24:15.89 G1 X70.6 E0:0:0:42.4 G1 E42.4:0:0:0
The second line moves straight to the point (90.6, 13.8) extruding a total of 22.4mm of filament. The mix ratio for the move is 0.1:0.1:0.1:0.7.
The third line moves back 20mm in X extruding 42.4mm of filament.
The fourth line has no physical effect.
M163: Set weight of mixed material
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0+ | M567 | ??? | No | No | 0.92+ | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Snnn
extruder numberPnnn
weight
Set weight for this mixing extruder drive.
See Repetier Color Mixing for more informations.
M164: Store weights
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0+ | No | ??? | No | No | 0.92 | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Snnn
virtual extruder numberPnnn
store to eeprom (P0 = no, P1 = yes)
Store weights as virtual extruder S.
M165: Set multiple mix weights
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
1.1.0+ | M567 | ??? | No | No | No: | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
A B C D H I
A[factor]
Mix factor for extruder stepper 1B[factor]
Mix factor for extruder stepper 2C[factor]
Mix factor for extruder stepper 3D[factor]
Mix factor for extruder stepper 4H[factor]
Mix factor for extruder stepper 5I[factor]
Mix factor for extruder stepper 6
- Set multiple mix factors for a mixing extruder.
- Factors that are left out will be set to 0.
- All factors together must add up to 1.0.
M190: Wait for bed temperature to reach target temp
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
??? | Yes | No | No | Yes | Yes | M116 | Yes | ??? |
- Parameters
Snnn
minimum target temperature, waits until heatingRnnn
accurate target temperature, waits until heating and cooling (Marlin and Prusa)- Example
M190 S60
Wait for the bed temperature to reach 60 degrees, printing out the temperatures once per second.
M191: Wait for chamber temperature to reach target temp
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.0+ | 1.17+ | ??? | No | No | No | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | No | No | No | No |
- Example
M191 S60
Set the temperature of the build chamber to 60 °C and wait for the temperature to be reached.
- Parameters
Snnn
minimum target temperature, waits until heatingRnnn
accurate target temperature, waits until heating and cooling (Marlin)
M192: Wait for Probe Temperature
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
Use M192
to dwell until the probe is at or above a given temperature.
M193: Set Laser Cooler Temperature
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
2.0.8+ | No | ??? | No | No | No | No | ??? | No | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | No | No | No | No | No |
- Parameters
Snnn
Target temperature- Examples
M193 S65
Set the target temperature of the laser cooler and wait for the temperature to be reached. Use M143
to set the temperature and return immediately. If the Emergency Parser is enabled you can use M108
to break out of the wait loop.
M200: Set filament diameter
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | 1.19+ | ??? | Yes | Yes | Yes | Yes | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | No | No | No | Yes | No | No | No | No |
Volumetric Extrusion is a firmware mode (and an option you can set in some slicers) wherein all extrusion amounts are specified as a volume —using cubic millimeters or inches (i.e., mm3 or in3)— instead of a linear distance. This makes it possible to use the same G-code with any filament diameter.
M200
tells the firmware what the filament diameter is, and (if non-zero) to enable Volumetric Extrusion.
Send M200
without parameters to get the current Volumetric Extrusion state and filament diameters.
Note that slicer-commanded retraction amounts must also be specified in mm3 since the E axis is interpreted as a volume. However, when using Firmware Retraction (G10
/ G11
) the retractions specified by M207
are still set in linear units.
- Parameters (Marlin)
D[linear]
Set the filament diameter in current units. If non-zero, enable Volumetric Extrusion.T[index]
Select the target extruder. If omitted, the active extruder.S[bool]
Enable or Disable Volumetric Extrusion (without modifying the filament diameter).L[limit]
Set the Maximum Extrusion Volume in mm3 per second. (Ignores units set byG20
.) UseL0
for no limit.- Examples (Marlin)
M200 D0 ; Disable Volumetric Extrusion on all extruders M200 D1.75 ; Set filament diameter for the current extruder to 1.75mm M200 T1 D2.85 ; Set filament diameter for E2 to 1.75mm M200 T1 L12 ; Set Maximum Extrusion Volume for E2 to 12mm3 M200 S1 ; Enable Volumetric Extrusion using the last-set diameters
- Parameters (RepRapFirmware)
Daaa:bbb:ccc...
Set filament diameter to aaa for extruder 1, bbb for extruder 2, etc. In RepRapFirmware 3.4 and earlier, if any of aaa, bbb etc. are zero then Volumetric Extrusion is disabled for that extruder.Daaa
Set filament diameter for all extruders.S[bool]
Enable or disable volumetric extrusion for this input channel (RepRapFirmware 3.5 and later)- Examples (RepRapFirmware)
M200 D0 ; Disable volumetric extrusion on all extruders (RRF 3.4 and earlier) M200 S0 ; Disable volumetric extrusion for tis input channel (RRF 3.5 and later) M200 D1.75 ; Set all extruder filament diameters to 1.75mm M200 D1.75:3.0:1.75 ; Set extruder 0 to 1.75mm, E1 to 3.0mm and the rest to 1.75mm
M201: Set max acceleration
Support | Marlin | RepRapFirmware | Klipper | Prusa | Buddy | Repetier | Smoothie | Druid | MK4duo |
---|---|---|---|---|---|---|---|---|---|
Yes | Yes | No | Yes | Yes | Yes | No | ??? | Yes | |
grbl | Sprinter | BFB | FiveD | Machinekit | Redeem | Teacup | Yaskawa | MakerBot | |
No | Yes | No | No | No | Yes | No | No | No |
- Parameters
Xnnn
Acceleration for X axis in units/s2Ynnn
Acceleration for Y axis in units/s2Znnn
Acceleration for Z axis in units/s2Ennn
Acceleration for the active or specified extruder in units/s2- Example
M201 X1000 Y1000 Z100 E2000
Set the acceleration that axes can do in units/s2.
The M201
command is intended to define the machine's physical limits. Slicers should use the M204
command to d