G-code/de

From RepRap
Jump to: navigation, search
Diese Seite wird gerade vom Benutzer Ishtmi neu erstellt oder grundlegend überarbeitet. Fragen und Vorschläge bitte in die Seite Diskussion.


Fortschritt: 5%
Aktuelle arbeit: Grobes übersetzen
Plan: Grobes übersetzen, Grammatische korrekturen, Anpassen der verständlichkeit, hinzufügen von Prüffeldern.



Diese Seite versucht, den Geschmack von G-Codes zu beschreiben, die die RepRap-Firmware verwendet und wie sie funktionieren. Das Hauptziel ist die additive Herstellung mit FFF-Prozessen. Codes für Druckkopfbewegungen folgen dem NIST RS274NGC G-Code Standard, so dass RepRap Firmware auch für CNC Fräsen und ähnliche Anwendungen geeignet ist. Siehe auch auf Wikipedia-G-Code Artikel.

Es gibt ein paar verschiedene Möglichkeiten, GCode für einen Drucker vorzubereiten. Einer ist, eine Slicer wie Slic3r, Skeinforge oder Cura zu verwenden. Diese Programme nehmen ein CAD-Modell, schneiden es in Schichten und geben den GCode für jede Ebene aus. Slicers sind der einfachste Weg, um von einem 3D-Modell zu einem gedruckten Teil zu gehen, aber der Benutzer opfert etwas Flexibilität bei der Verwendung. Eine weitere Option für die GCode-Generierung ist die Verwendung einer untergeordneten Bibliothek wie mecode. Bibliotheken wie mecode geben Ihnen eine präzise Kontrolle über den Werkzeugweg und sind daher nützlich, wenn Sie einen komplexen Druck haben, der nicht für naives Schneiden geeignet ist. Die endgültige Option ist, nur schreiben Sie die GCode selbst. Dies kann die beste Wahl sein, wenn Sie nur ein paar Testlinien laufen müssen, während Sie Ihren Drucker kalibrieren.

Wie viele verschiedene Firmware existieren und ihre Entwickler dazu neigen, neue Features zu implementieren, ohne Strategien zu diskutieren oder zu suchen, was andere vor ihnen getan haben, haben sich im Laufe der Jahre viele verschiedene Unteraromen für die 3D-Druckerspezifischen Codes entwickelt. Aber das ist die Masterseite für RepRap. Nirgendwo hier sollte der gleiche Code für zwei verschiedene Dinge verwendet werden; Es gibt immer mehr Zahlen zu verwenden ... Die Regel ist: fügen Sie Ihren neuen Code hier, dann implementieren Sie es.

Aber die menschliche Natur ist das, was es ist, die Dinge sind nicht immer so gemacht, so dass einige mehrfache Verwendungen des gleichen Codes existieren. Die Regel ist, dass spätere Auftritte von ihnen auf dieser Seite als die ursprüngliche Verwendung eines Codes veraltet sind und geändert werden sollten, es sei denn, es gibt einen guten technischen Grund (wie der allgemeine G-Code-Standard), warum eine spätere Instanz bevorzugt werden sollte. Beachten Sie, dass das Stichtag hier Erscheinungsbild ist, nicht Datum der Umsetzung.

Contents

Introduction

Ein typisches Stück Gcode, das an einen RepRap-Rechner gesendet wurde, könnte so aussehen:

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

Gcode kann auch in Dateien auf SD-Karten gespeichert werden. Eine Datei mit RepRap Gcode hat normalerweise die Erweiterung .g </ code>, <code> .gco </ code> oder <code> .gcode </ code>. Dateien für BFB / RapMan haben die Erweiterung <code> .bfb </ code>. Gcode, der in einer Datei gespeichert oder von einem Slicer erstellt wurde, könnte wie folgt aussehen:

G92 E0
G28
G1 F1500
G1 X2.0 Y2.0 F3000
G1 X3.0 Y3.0

Die Bedeutung all dieser Symbole und Zahlen (und mehr) wird nachfolgend erläutert.

Slicers (ggf.?) Fügen GCode-Scripts zum Anfang und zum Ende ihrer Ausgabedatei hinzu, um bestimmte Aktionen vor und / oder nach einem Druck auszuführen, z. B. z-Sondieren des Build-Bereichs, Heizen / Kühlen des Bettes und hotend, "Düsenwischen" Startroutine, Ein- / Ausschalten der Systemanlage und sogar "Auswerfen" von Teilen. Weitere Informationen über die GCode-Routinen starten und GCode-Routinen Seiten.

Um herauszufinden, welche spezifischen Gcode (s) in einer bestimmten Firmware implementiert sind, gibt es kleine Tabellen, die den Befehlsbeschreibungen beigefügt sind, wie diese:

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Partial ??? ??? ??? ??? Experimental deprecated ??? Partial
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No ??? Yes ??? Yes automatic ??? ???

Damit ist gemeint:

{{yes}}
Der Gcode wird von der Firmware völlig unterstützt
{{partial}} or {{experimental}}
Hier ist etwas Unterstützung für den Gcode. Oft ist es erforderlich, den Quellcode-Zweig für die Firmware auszuprobieren (in der Regel in einem anderen Zweig gespeichert) oder den Konfigurationsschalter auf dem Mainboard zu wechseln.
automatic
Die Firmware behandelt diesen Gcode automatisch, so dass es keine Notwendigkeit gibt, einen Befehl zu senden. Ein Beispiel ist die Stromversorgung ein/aus Gcode (M80 / M81) in der Teacup Firmware.
???
Es ist unbekannt, ob die Firmware diesen Gcode unterstützt. Vielleicht möchten Sie dies selbst testen, bevor Sie es in der Produktion verwenden.
{{ no}}
Die Firmware unerstützt den Gcode nicht.
deprecated
Die Firmware hat diesen Gcode abgelehnt. Der Firmware-Autor sollte den veralteten Gcode auf dieser Seite mit Workarounds (falls erforderlich) und der zuletzt unterstützten Firmwareversion, die diesen Gcode akzeptiert, ändern.

Für die technisch gesinnten Gips-Zeilenendungen sind Unix-Line-Endungen (<code> \ n </ code>), akzeptieren aber Windows Line Endings (<code> \ r \ n </ code>), also solltest du es nicht brauchen Sorgen um die Umwandlung zwischen den beiden, aber es ist die beste Praxis, Unix Line Endings zu verwenden, wo möglich.

Fields

Ein RepRap-Gcode ist eine Liste von Feldern, die durch Leerzeichen oder Zeilenumbrüche getrennt sind. Ein Feld kann als Befehl, Parameter oder für einen anderen speziellen Zweck interpretiert werden. Es besteht aus einem Brief direkt gefolgt von einer Zahl, oder kann nur ein eigenständiger Buchstabe (Flagge) sein. Der Buchstabe gibt Auskunft über die Bedeutung des Feldes (siehe untenstehende Liste). Zahlen können "Ganzzahlen" (128) oder "fraktionale" Zahlen (12.42) sein, je nach Kontext. Zum Beispiel kann eine X-Koordinate ganze Zahlen (<code> X175 </ code>) oder Fraktionen (<code> X17.62 </ code>) annehmen, aber die Auswahl der Extrudernummer 2.76 wäre sinnlos. In dieser Beschreibung werden die Zahlen in den Feldern durch <code> nnn </ code> als Platzhalter dargestellt.

In RepRapFirmware können einige Parameter mehr als eine Zahl folgen, mit Doppelpunkt, um sie zu trennen. Typischerweise wird hierbei die Extruderparameter mit einem pro Extruder vorgesehenen Wert angelegt. Wenn nur ein Wert vorgesehen ist, wo ein Wert für jeden Extruder benötigt wird, wird dieser Wert auf alle Extruder angewendet.

Letter Meaning
Gnnn Standard GCode 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.

Comments

Gcode-Kommentare beginnen bei einem Semikolon und enden am Ende der Zeile:

N3 T0*57 ; This is a comment
N4 G92 E0*67
; So is this
N5 G28*22

Kommentare und Leerzeichen werden von Ihrem RepRap Drucker ignoriert. Es ist besser, diese auf den Host-Computer zu streifen, bevor du den Gcode an deinen Drucker schickst, da das die Bandbreite spart.

Special fields

N: Line number

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
 ? Yes ??? Yes Yes Yes Yes ??? ???
Example
N123

Falls vorhanden, sollte die Zeilennummer das erste Feld in einer Zeile sein. Für G-Code, der in Dateien auf SD-Karten gespeichert ist, wird die Zeilennummer normalerweise weggelassen.

Wenn die Überprüfung unterstützt wird, erwartet die RepRap-Firmware, dass die Zeilennummern um 1 jede Zeile erhöht wird. Wenn dies nicht der Fall ist, wird sie als Fehler markiert. Aber du kannst die Zählung mit <code> M110 </ code> (siehe unten) zurücksetzen.

Obwohl unterstützt, wird die Verwendung von N in Machinekit entmutigt, da es keinen Zweck dient.

*: Checksum

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
 ? Yes ??? Yes ??? No Yes ??? ???

Example: <code>*71

Falls vorhanden, sollte die Prüfsumme das letzte Feld in einer Zeile sein, aber vor einem Kommentar. Bei G-Code, der in Dateien auf SD-Karten gespeichert ist, wird die Prüfsumme in der Regel weggelassen.

Die Firmware vergleicht die Prüfsumme mit einem lokal berechneten Wert. Wenn sie sich unterscheiden, fordert sie eine wiederholte Übertragung der Zeile an.

Checking

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
 ? Yes ??? Yes ??? No Yes ??? ???
Example
N123 [...G Code in here...] *71

Die RepRap-Firmware prüft die Zeilennummer und die Prüfsumme. Du kannst beide verlassen - RepRap wird noch funktionieren, aber es wird nicht überprüft. Du musst beide oder auch nicht haben Wenn nur einer erscheint, erzeugt er einen Fehler.

Die Prüfsumme "cs" für einen GCode-String "cmd" (einschließlich seiner Zeilennummer) wird berechnet, indem die Bytes in der Zeichenkette bis zu und ohne das * Zeichen wie folgt ausgegeben werden:

int cs = 0;
for(i = 0; cmd[i] != '*' && cmd[i] != NULL; i++)
   cs = cs ^ cmd[i];
cs &= 0xff;  // Defensive programming...

Und der Wert wird als Dezimal-Integer an den Befehl nach dem * -Zeichen angehängt.

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 ??? ???

Wenn die Pufferung unterstützt wird, speichert die RepRap-Firmware einige Befehle in einem Ringpuffer intern für die Ausführung. Dies bedeutet, dass es keine (spürbare) Verzögerung gibt, während ein Befehl quittiert wird und der nächste übertragen wird. Im Gegenzug bedeutet dies, dass Sequenzen von Liniensegmenten ohne Verweilen zwischen einem und dem nächsten aufgetragen werden können. Sobald einer dieser gepufferten Befehle empfangen wird, wird er lokal quittiert und gespeichert. Wenn der lokale Puffer voll ist, wird die Quittung verzögert, bis Platz für die Speicherung im Puffer vorhanden ist. So wird die Strömungssteuerung erreicht.

In der Regel werden die folgenden Bewegungsbefehle zwischengespeichert: G0 </ code> - <code> G3 </ code> und <code> G28 </ code> - <code> G32 </ code>. Die Teacup Firmware puffert auch einige Einstellbefehle: <code> G20 </ code>, <code> G21 </ code>, <code> G90 </ code> und <code> G91 </ code>. Alle anderen <code> G </ code>, <code> M </ code> oder <code> T </ code> Befehle werden nicht gepuffert.

RepRapFirmware implementiert auch eine interne Warteschlange, um sicherzustellen, dass bestimmte Codes (wie M106) in der richtigen Reihenfolge ausgeführt werden und nicht, wenn der letzte Zug zum Look- Vor der Warteschlange. Diese Funktion ist in RepRapFirmware-dc42 nicht verfügbar.

Wenn ein ungepufferter Befehl empfangen wird, wird er gespeichert, aber er wird dem Host nicht quittiert, bis der Puffer erschöpft ist und dann der Befehl ausgeführt wurde. So wird der Host an einem dieser Befehle anhalten, bis er fertig ist. Kurze Pausen zwischen diesen Befehlen und irgendwelche, die ihnen folgen können, beeinträchtigen nicht die Leistung der Maschine.

G-commands

G0 & G1: Move

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes Yes Yes Yes Yes Yes ??? Yes
  • <code>G0 : Rapid linear 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 axis
Ynnn The position to move to on the Y axis
Znnn The position to move to on the Z axis
Ennn The amount to extrude between the starting point and ending point
Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied)
Snnn Flag to check if an endstop was hit (S1 to check, S0 to ignore, S2 see note, default is S0)1
Examples
G0 X12               ; move to 12mm on the X axis
G0 F1500             ; Set the feedrate to 1500mm/minute
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

Die RepRap-Firmware-Spezifikation behandelt G0 </ code> und <code> G1 </ code> als denselben Befehl, da es genauso effizient ist wie nicht. 2 </ sup>

Die meisten RepRap-Firmware machen subtile Dinge mit Feedrates.

1. G1 F1500
2. G1 X50 Y25.3 E22.4

In dem oberen Beispiel setzen wir den Vorschub (Feedrate) auf 1500mm/Minute auf Linie 1 und bewegen es dann auf 50 mm auf der X-Achse und 25,3 mm auf der Y-Achse, während 22,4 mm Filament zwischen den beiden Punkten extrudiert werden.

1. G1 F1500
2. G1 X50 Y25.3 E22.4 F3000

Im obigen Beispiel setzen wir jedoch eine Vorschubgeschwindigkeit von 1500 mm/min auf die Linie 1, dann beschleunigen die oben beschriebene Bewegung auf eine Vorschubgeschwindigkeit von 3000 mm/min, wie dies der Fall ist. Die Extrusion beschleunigt sich mit der X- und Y-Bewegung, so dass alles synchronisiert bleibt.

Die RepRap-Spezifikation behandelt den Vorschub als eine andere Variable (wie X, Y, Z und E), um linear interpoliert zu werden. Dies ermöglicht eine vollständige Kontrolle über die Beschleunigung und Verzögerung des Druckkopfes, so dass alles reibungslos zusammenläuft und das richtige Materialvolumen an allen Punkten extrudiert wird. 3

Um den Extruder um einen bestimmten Betrag umzukehren (z. B. um seinen Innendruck zu reduzieren, während er eine In-Air-Bewegung ausführt, so dass er nicht dribbelt), verwenden Sie einfach <code>G0</code> oder <code>G1</code> um einen <code>E</code> Wert zu senden, der kleiner ist als die aktuell extrudierte Länge.

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 <code>S</code> parameter in this way, as damage may occur if you assume incorrectly. In RepRapFirmware, using the <code>S1</code> or <code>S2</code> parameter on a delta printer causes the <code>XYZ</code> 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 S1.

2In the RS274NGC Spec, <code>G0</code> 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 <code>G1</code> is Controlled Move, which was used to move between the current point in space and the new point as precise as possible.

3Some firmwares may not support setting the feedrate inline with a move.

4RepRapFirmware provides an additional 'R1' parameter to tell the machine to go back to the coordinates a print was previously paused at. If this parameter is used and the code contains axis letters, an offset will be added to the pause coordinates (e.g. <code>G1 R1 Z5</code>).

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 No ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes No No Yes Experimental No ??? ???
Usage
<code>G2 Xnnn Ynnn Innn Jnnn Ennn Fnnn</code> (Clockwise Arc)
<code>G3 Xnnn Ynnn Innn Jnnn Ennn Fnnn</code> (Counter-Clockwise Arc)
Parameters
<code>Xnnn</code> The position to move to on the X axis
<code>Ynnn</code> The position to move to on the Y axis
<code>Innn</code> The point in X space from the current X position to maintain a constant distance from
<code>Jnnn</code> The point in Y space from the current Y position to maintain a constant distance from
<code>Ennn</code> The amount to extrude between the starting point and ending point
<code>Fnnn</code> The feedrate per minute of the move between the starting point and ending point (if supplied)
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 and SCARA printers.

G4: Dwell

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes Yes Yes Yes Yes Yes ??? Yes

Pause the machine for a period of time.

Parameters
<code>Pnnn</code> Time to wait, in milliseconds
<code>Snnn</code> Time to wait, in seconds (Only on Repetier, Marlin, 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: Direct Stepper Move

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Use G1 S2 ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
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 <code>DELTA</code>) 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
<code>Annn</code> Stepper A position or angle
<code>Bnnn</code> Stepper B position or angle
<code>Cnnn</code> Stepper C position or angle
<code>R</code> 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: Tool Offset

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes No No ??? ???
Usage
<code>G10 Pnnn Xnnn Ynnn Znnn Rnnn Snnn</code>1
Parameters
<code>Pnnn</code> Tool number
<code>Xnnn</code> X offset
<code>Ynnn</code> Y offset
<code>U,V,Wnnn</code> U, V and W axis offsets5
<code>Znnn</code> Z offset2
<code>Rnnn</code> Standby temperature(s)
<code>Snnn</code> Active temperature(s)
Examples
G10 P2 X17.8 Y-19.3 Z0.0

(sets the offset for tool (or in older implementations extrude head) 2 to the X, Y, and Z values specified)

G10 P1 R140 S205

(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 <code>R</code> value is the standby temperature in oC that will be used for the tool, and the <code>S</code> 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 <code>M585</code>.

Notes

1Marlin uses G10/G11 for executing a retraction/unretraction move. The RepRapPro version of Marlin supports <code>G10</code> for tool offset. Smoothie uses <code>G10</code> for retract and <code>G10 Ln</code> for setting workspace coordinates.

2It's usually a bad idea to put a non-zero <code>Z</code> 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.

4The NIST G-code standard mentions an additional <code>L</code> parameter, which is ignored (except in smoothie). This command is subject to discussion.

5Tool offsets are applied after any X axis mapping has been performed. Therefore if for example you map X to U in your <code>M563</code> 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.

G10: Retract

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes dc42,ch ??? ??? ??? Yes: 0.92 Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> retract length (S1 = long retract, S0 = short retract = default) (Repetier only)
Example
G10

Retracts filament according to settings of <code>M207</code> (Marlin, RepRapFirmware) or according to the <code>S</code> value (Repetier).

RepRapFirmware recognizes <code>G10</code> as a command to set tool offsets and/or temperatures if the <code>P</code> 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 dc42,ch ??? ??? ??? Yes: 0.92 Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> retract length (S1 = long retract, S0 = short retract = default) (Repetier only)
Example
G11

Unretracts/recovers filament according to settings of <code>M208</code> (Marlin, RepRapFirmware) or according to the <code>S</code> value (Repetier).

G17..19: Plane Selection (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? Yes No ??? ??? ???

These codes set the current plane as follows:

  • <code>G17</code> : XY (default)
  • <code>G18</code> : ZX
  • <code>G19</code> : YZ

G20: Set Units to Inches

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes No Yes Yes No Yes ??? ???
Example
G20

Units from now on are in inches.

G21: Set Units to Millimeters

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes Yes Yes Yes Yes Yes ??? ???
Example
G21

Units from now on are in millimeters. (This is the RepRap default.)

G22 & G23: Firmware controlled Retract/Precharge

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes No No ??? ???
Usage
<code>G22 ; Retract</code>
<code>G23 ; Unretract/Precharge</code>

Relying on machine's firmware to execute extrusion retract/precharge move, instead of having slicer generating to E axis <code>G1</code> movement. The retract/precharge length, velocity is handled by the machine firmware.

G28: Move to Origin (Home)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes1
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes Yes Yes Yes Yes Yes ??? Yes
Parameters
This command can be used without any additional parameters.
<code>X</code> Flag to go back to the X axis origin
<code>Y</code> Flag to go back to the Y axis origin
<code>Z</code> Flag to go back to the Z axis origin
Examples
G28     ; Home all axes
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 <code>X</code>, <code>Y</code>, and <code>Z</code> parameters act only as flags. Any coordinates given are ignored. For example, <code>G28 Z10</code> results in the same behavior as <code>G28 Z</code>. Delta printers cannot home individual axes, but must always home all three towers, so the <code>X Y Z</code> parameters are simply ignored on these machines.

Marlin firmware (version 1.1.0 and up) provides an option called <code>Z_SAFE_HOMING</code> 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 <code>homeall.g</code> is processed. For individual axes the <code>homex.g</code>, <code>homey.g</code>, or <code>homez.g</code> file will be used. On Delta printers, <code>G28</code> command will always home all three towers by processing the <code>homedelta.g</code> file, regardless of any <code>X</code> <code>Y</code> <code>Z</code> parameters.

Because the behavior of <code>G28</code> is unspecified, it is recommended not to automatically include <code>G28</code> in your ending GCode. 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 <code>G0</code> or <code>G1</code>.

Notes

1 MK4duo has a <code>B</code> parameter that tells the printer to return to the coordinates it was at before homing.

G29: Detailed Z-Probe

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes, 1.17 and later ??? ??? ??? Yes: 0.91.7 No, see G32 ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes Yes 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 <code>G28</code> 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
<code>G29</code>
<code>G29 Snnn</code>
Parameters
<code>Snnn</code> Firmware-dependent behavior
<code>Pfile.csv</code> 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 Auto Bed Leveling in Marlin

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 up 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 up, the <code>PROBE_MANUALLY</code> option allows all forms of Auto Bed Leveling to be used without a probe. The procedure is similar to that of <code>MESH_BED_LEVELING</code> (see below). Begin the process with <code>G29</code> to move the nozzle to the first point. Adjust the Z axis using <code>G1</code> or your host software. Send <code>G29</code> again to move to the next point and repeat until all points have been sampled.

Parameters
<code>P</code> Set the size of the grid that will be probed (P x P points). Not supported by non-linear delta printer bed leveling. Example: <code>G29 P4</code>
<code>S</code> Set the XY travel speed between probe points (in units/min)
<code>D</code> 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.
<code>V</code> Set the verbose level (0-4). Example: <code>G29 V3</code>
<code>T</code> Generate a Bed Topology Report. Example: <code>G29 P5 T</code> 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.
<code>F</code> Set the Front limit of the probing grid
<code>B</code> Set the Back limit of the probing grid
<code>L</code> Set the Left limit of the probing grid
<code>R</code> Set the Right limit of the probing grid
Global Parameters
<code>E</code>/<code>e</code> By default G29 will engage the Z probe, test the bed, then disengage. Include <code>E</code> to engage/disengage the Z probe for each sample. There's no extra effect if you have a fixed Z probe. Usage
<code>G29 E</code> or <code>G29 e</code>
G29 Manual Bed Leveling in Marlin

Marlin firmware (version 1.0.2 and up) also provides a <code>MESH_BED_LEVELING</code> 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 <code>S</code> parameter
<code>S0</code> Produces a mesh report
<code>S1</code> Start probing mesh points
<code>S2</code> Probe the next mesh point
<code>S3 Xn Yn Zn.nn</code> Manually modify a single point
<code>S4 Zn.nn</code> Set z offset. Positive away from bed, negative closer to bed.
G29 in Repetier firmware

Repetier firmware since v0.91 supports <code>G29</code> 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 <code>G32</code> instead with firmware 0.92.8 and above.

<code>S0</code> Default value. Z bed heights are calculated at the measured points, relative to current Z position before issuing <code>G29</code>.
<code>S1</code> Same as <code>S0</code>, except printer immediately moves to Z maximum position (Z max endstop required!), and calculates new Z maximum height. You must first issue <code>G28 Z</code> to home to Z maximum position before issuing <code>G29 Snnn</code> for this to work correctly, or the printer height will be invalid.
<code>S2</code> Same as <code>S1</code>, except new calculated Z height is also stored to EEPROM.
G29 in RepRapFirmware

RepRapFirmware:

<code>S0</code> (default if no <code>S</code> parameter) Probe the bed, save the height map in a file on the SD card, and activate bed compensation. The default folder for the height map file is <code>/sys</code> and the default file name is <code>heightmap.csv</code>.
<code>S1</code> Load the height map from file and activate bed compensation. The default folder and filename as for <code>S0</code>.
<code>S2</code> Clear bed height map

To define the grid, see M557.

G29.1: Set Z probe head offset

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes 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 <code>G29.2</code> command.

G30: Single Z-Probe

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes1
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes Yes use G28 & G92 ??? ???
Usage
<code>G30 Pnnn Xnnn Ynnn Znnn Hnnn Snnn</code>
Parameters
<code>Pnnn</code> Probe point number
<code>Xnnn</code> X coordinate
<code>Ynnn</code> Y coordinate
<code>Znnn</code> Z coordinate
<code>Hnnn</code> Height correction
<code>Snnn</code> 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 <code>Pn<code> field is specified the probed <code>X</code>, <code>Y</code>, and <code>Z</code> values are saved as point n on the bed for calculating the offset plane or for performing delta printer calibration. If <code>X</code>, <code>Y</code>, or <code>Z</code> values are specified (e.g. <code>G30 P1 X20 Y50 Z0.3</code>) then those values are used instead of the machine's current coordinates. A silly <code>Z</code> 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. <code>G30 P1 Z0.3 S</code>) the bed plane is computed for compensation and stored. The combination of these options allows for the machine to be moved to points using <code>G1</code> 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 GCode file for automatic execution.

RepRapFirmware uses the value of the <code>S</code> 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 <code>H</code> 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 <code>Z</code> parameter of the <code>G31</code> command in the config.g file. When you probe using <code>G30</code> and the probe triggers, the firmware will assume that the nozzle is at the nominal trigger height plus the value you have in the <code>H</code> parameter.

1MK4duo Firmware support an optional parameter for Autocalibration Delta.

Usage
<code>G30 Xnnn Ynnn Znnn Annn E R I D T S U<code>
Parameters
<code>Xnnn</code> X coordinate
<code>Ynnn</code> Y coordinate
<code>Znnn</code> Z coordinate
<code>Annn</code> A Autocalibration width nnn precision
<code>E</code> Adjust Endstop
<code>R</code> Adjust Endstop & Delta Radius
<code>I</code> Adjust Tower
<code>D</code> Adjust Diagonal Rod
<code>T</code> Adjust Tower Radius
<code>Sn</code> Stows the probe if 1 (default=1)
<code>Un</code> <bool> with a non-zero value will apply the result to current zprobe_zoffset

G31: Set or Report Current Probe status

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? Yes: 0.91.7 Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Usage
<code>G31 Pnnn Xnnn Ynnn Znnn Cnnn Snnn</code>
Parameters
<code>Pnnn</code> Trigger value
<code>Xnnn</code> Probe X offset1
<code>Ynnn</code> Probe Y offset1
<code>Znnn</code> Trigger Z height
<code>Cnnn</code> Temperature coefficient2
<code>Snnn</code> Calibration temperature2
<code>Tnnn</code> (RepRapFirmware 1.17 and later) Z probe type to which these parameters apply, defaults to the current Z probe type as defined by <code>M558 P</code> 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: <code>G31 P312 Z0.7</code>) this will set the Z height to 0.7mm when the Z-probe value reaches 312 when a <code>G28 Z0</code> (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 <code>G31 Z0.7</code> will tell the RepRap machine that it is at a height of 0.7mm when the probe is triggered.

In RepRapFirmware, separate <code>G31</code> 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 <code>G31</code> command, or use the <code>T</code> parameter.

In Repetier, <code>G31</code> 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 <code>Z</code> parameter is correct, default is current bed temperature) and 'C' (temperature coefficient of <code>Z</code> parameter in mm/oC, default zero) can be set for the alternative (ultrasonic) sensor. This is useful for probes that are affected by temperature. This facility is deprecated and likely to be removed in a future version of RepRapFirmware.

G31: Dock Z Probe sled

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? ??? No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???

G32: Probe Z and calculate Z plane

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No: See G29 Yes ??? ??? ??? Yes: 0.92.8 Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Usage
<code>G32<code>
<code>G32 Snnn<code>
<code>G32 Snnn Pnnn<code>

This command is implemented as a more sophisticated form of bed leveling which uses a transformation matrix or motorized correction.

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

This command probes the bed at 3 or more pre-defined points (see M557) and updates transformation matrix for bed leveling compensation.

Parameters
<code>Snnn</code> Store transformation matrix after probing1
Examples
G32
G32 S2

RepRapFirmware executes macro file <code>bed.g</code> if present instead of using the M557 coordinates.

Notes

1Currently only Repetier firmware v0.92.8 and higher have working support for an optional Snnn parameter. The numeric value sets the behavior that occurs immediately after point probe and transformation matrix calculation. These are the values for Reprapfirmware:

<code>S0</code> Default value. Transformation matrix is updated in RAM but is not stored to EEPROM. Z bed height not calculated.
<code>S1</code> Transformation matrix is updated in RAM but is not stored to EEPROM. Printer immediately moves to Z maximum position (Z max endstop required!), and calculates new Z maximum height. You must first issue <code>G28</code> to home to Z maximum position before issuing <code>G32 Snnn</code> for this to work correctly, or the printer height will be invalid.
<code>S2</code> Same as S1, except transformation matrix and Z max heights are also stored to EEPROM.
<code>S3</code> Transformation matrix is stored to EEPROM. Z bed height not calculated.
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, <code>G29</code>) or by tilting the bed with motors.

Parameters
<code>Snnn</code> Bed leveling method
<code>Pnnn</code> Bed correction method

The values for Snnn and Pnnn are as follows:

<code>S0</code> 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.
<code>S1</code> 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.
<code>S2</code> 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.
<code>P0</code> 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.
<code>P1</code> 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 ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???

G33: Firmware dependent

G33: Measure/List/Adjust Distortion Matrix (Repetier - Redeem)
Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes: v0.92.8 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???
Usage
<code>G33</code>
<code>G33 Lnnn</code>
<code>G33 Rnnn</code>
<code>G33 Xnnn Ynnn Znnn</code>
Parameters
<code>L0</code> List distortion matrix in a report
<code>R0</code> Reset distortion matrix
<code>X[pos] Y[pos] Z[zCorrection]</code> Set correction for nearest point
Examples
G33
G33 R0

When used with no parameters, <code>G33</code> 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 <code>G28</code> 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 <code>M323</code>.

G33: Delta Auto Calibration (Marlin 1.1.0)
Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Usage
<code>G33</code>
<code>G33 Pn Vn</code>
<code>G33 Pn T0</code>
Parameters (Upper-case = Letter, n = number)
<code>Pn</code> Number of probe points: n*n (n=1-7)
<code>Vn</code> Verbose level: (n=0-2) 0 = dry run without calibration; 1 = settings ; 2 = settings and probe results
<code>T0</code> Do not calibrate tower angle corrections if used with P>=3; do not use tower positions but opposite to towers for P2
Examples
G33 : calibrates with the default settings.
G33 P6 V0 : probes 36 points in dryrun mode.
G33 P4 T0 : probes 16 points and calibrates delta height, endstops and delta radius, leaves the tower angle corrections unaltered.
G33 P2 : probes center and tower positions and calibrates delta height, endstops and delta radius
G33 P1 : probes the center once and sets the delta height only.

Performs a 1-4-7 point calibration of delta height (P1), endstops, delta radius (P2) and tower angle corrections (P>=3) by an iteration process based on the least squares method.

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
Yes: 1.1.0 No ??? ??? ??? ??? Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? ??? No ??? ??? ???
G38.3 probe toward workpiece, stop on contact
Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes: 1.1.0 No ??? ??? ??? ??? Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? ??? 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
??? No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? ??? No ??? ??? ???
G38.5 probe away from workpiece, stop on loss of contact
Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? ??? No ??? ??? ???

G40: Compensation Off (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? Yes No ??? ??? ???

G40 turn cutter compensation off. 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.

G54..59: Coordinate System Select (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? No ??? ??? ??? ??? Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? Yes No ??? ??? ???

See linuxcnc.org for more help

G60: save current position to slot

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? ??? ??? ??? ??? ??? ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? ??? ??? ??? ??? ??? ??? ???
Usage
<code>G60 Snn</code>
Parameters
<code>Snn</code> <nn> specifies memory slot # (0-based) to save into (default 0)

G61: Apply/restore saved coordinates to the active extruder.

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? ??? ??? ??? ??? ??? ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? ??? ??? ??? ??? ??? ??? ???
Usage
<code>G61 Xnnn Ynnn Znnn Ennn Fnnn Snn</code>
Parameters
<code>Xnnn</code> X coordinate
<code>Ynnn</code> Y coordinate
<code>Znnn</code> Z coordinate
<code>Ennn</code> E coordinate
<code>Fnnn</code> F Set Feedrate
<code>Snn</code> S specifies memory slot # (0-based)

G80: Cancel Canned Cycle (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? ??? 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.

G90: Set to Absolute Positioning

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes No Yes Yes Yes Yes ??? Yes
Example
G91

All coordinates from now on are relative to the last position. Note: RepRapFirmware latest revision firmware uses <code>M83</code> to set the extruder to relative mode: extrusion is NOT set to relative by ReprapFirmware on <code>G91</code>: only X,Y and Z are set to relative. By contrast, Marlin (for example) DOES also set extrusion to relative on a <code>G91</code> 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes Yes Yes Yes Yes Yes ??? Yes
Parameters
This command can be used without any additional parameters.
<code>Xnnn</code> new X axis position
<code>Ynnn</code> new Y axis position
<code>Znnn</code> new Z axis position
<code>Ennn</code> 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 <code>G92</code> without coordinates will reset all axes to zero.

G92.x: Reset Coordinate System Offsets (CNC specific)
Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? No ??? ??? ??? ??? Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? ??? No ??? ??? ???
  • <code>G92.1</code> - reset axis offsets to zero and set parameters 5211 - 5219 to zero. (X Y Z A B C U V W)
  • <code>G92.2</code> - 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 ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
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, if the F number is 2.0, the move should be completed in half a minute.

When the inverse time feed rate mode is active, an F word must appear on every line which has a <code>G1</code>, <code>G2</code>, or <code>G3</code> motion, and an F word on a line that does not have <code>G1</code>, <code>G2</code>, or <code>G3</code> is ignored. Being in inverse time feed rate mode does not affect <code>G0</code> (rapid move) motions.

G94: Feed Rate Mode (Units per Minute) (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes ??? ??? ??? ??? No ??? ??? ???

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.

G100: Calibrate floor or rod radius

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes: 0.92 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>X</code> Flag to set floor for X axis
<code>Y</code> Flag to set floor for Y axis
<code>Z</code> Flag to set floor for Z axis
<code>Rnnn</code> 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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 ??? ??? ??? Yes: 0.91 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

G132: Calibrate endstop offsets

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes: 0.91 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

G133: Measure steps to top

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes: 0.91 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No Yes ??? Yes
Parameters
<code>X</code> Flag to home the X axis to its minimum position
<code>Y</code> Flag to home the Y axis to its minimum position
<code>Z</code> Flag to home the Z axis to its minimum position
<code>Fnnn</code> 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 <code>G28</code>, 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No Yes ??? Yes
Parameters
<code>X</code> Flag to home the X axis to its maximum position
<code>Y</code> Flag to home the Y axis to its maximum position
<code>Z</code> Flag to home the Z axis to its maximum position
<code>Fnnn</code> Desired feedrate for this command
Example
G162 X Y Z F1800

Instruct the machine to home the specified axes to their maximum position.

M-commands

M0: Stop or Unconditional stop

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No Yes Yes No Yes ??? ???
Parameters
This command can be used without any additional parameters.
<code>Pnnn</code> Time to wait, in milliseconds1
<code>Snnn</code> 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 <code>M1</code>, <code>M112</code>.

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 macro file <code>stop.g</code> before everything is turned off. Apart from that, RepRapFirmware (v1.09n-ch) accepts an extra 'H' parameter, whose value must be non-zero, to keep all heaters active. This is what Duet Web Control v1.07 sends to cancel a paused print.

Notes

1Not available in RepRapFirmware, but as a work-around <code>G4</code> can be run before <code>M0</code>.

2Only available on Marlin.

M1: Sleep or Conditional stop

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No ??? ??? ???
Example
M1

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 <code>M0</code>, <code>M112</code>.

The Marlin Firmware does the same as <code>M0</code>.

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 <code>sleep.g</code> 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No Yes ??? Yes
Example
M2

Teacup firmware does the same as <code>M84</code>.

M3: Spindle On, Clockwise (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? Yes Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No Yes ??? ???
Parameters
<code>Snnn</code> Spindle RPM
Example
M3 S4000

The spindle is turned on with a speed of 4000 RPM.

Teacup firmware turn extruder on (same as <code>M101</code>).

RepRapFirmware interprets this code only if a Roland mill has been configured.

In Repetier-Firmware in laser mode you need <code>S0</code>..<code>S255</code> to set laser intensity. Normally you use <code>S255</code> to turn it on full power for moves. Laser will only fire during <code>G1</code>/<code>G2</code>/<code>G3</code> moves and in laser mode (<code>M452</code>).

M4: Spindle On, Counter-Clockwise (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No 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
No No ??? ??? ??? Yes Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No Yes ??? ???
Example
M5

The spindle is turned off.

Teacup firmware turn extruder off (same as <code>M103</code>).

M6: Tool change

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No Yes ??? ???
Example
M6

M7: Mist Coolant On (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No use M106 ??? ???
Example
M7

Mist coolant is turned on (if available)

Teacup firmware turn on the fan, and set fan speed (same as <code>M106</code>).

M8: Flood Coolant On (CNC specific)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No use M106 ??? ???
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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes No No No No No use M106 ??? ???
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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No use M106 ??? ???
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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No use M106 ??? ???
Example
M11

Dust collection vacuum system turned off.

M17: Enable/Power all stepper motors

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? No Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes (automatic) ??? ???
Example
M17

M18: Disable all stepper motors

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
call M84 Yes ??? ??? ??? No Yes ??? call M84
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes use M2 ??? Yes
Parameters
This command can be used without any additional parameters.1
<code>X</code> X axis
<code>Y</code> Y axis
<code>Z</code> Z axis
<code>E</code> Extruder drive(s)2
Examples
M18
M18 X E0

Disables stepper motors and allows axes to move 'freely.'

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, <code>M18 X E0:2</code> will disable the X, extruder 0 and extruder 2 motors.

M20: List SD card

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No Yes ??? ???
Parameters
This command can be used without any additional parameters.
<code>Snnn</code> Output style1
<code>Pnnn</code> Directory to list2
Examples
M20
M20 S2 P/gcodes/subdir

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:

ok
SQUARE.G
SQCOM.G
ZCARRI~2.GCO
CARRIA~1.GCO

On Marlin, 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

If RepRapFirmware emulates no firmware compatibility, a typical response looks like:

GCode files:
"Traffic cone.g","frog.gcode","calibration piece.g"

Note that some firmwares list file names in upper case, but - when sent to the <code>M23</code> 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 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".

Example
M20 S2 P/gcodes
{"dir":"\/gcodes","files":["4-piece-1-2-3-4.gcode","Hinged_Box.gcode","Hollow_Dodecahedron_190.gcode","*Calibration pieces"]}

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.

M21: Initialize SD card

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No Yes ??? ???
Parameters
<code>Pnnn</code> 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.

M22: Release SD card

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No Yes ??? ???
Parameters
<code>Pnnn</code> 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 ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No Yes ??? ???
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.

M24: Start/resume SD print

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes Yes ??? ???
Example
M24

The machine prints from the file selected with the <code>M23</code> command. If the print was previously paused with <code>M25</code>, printing is resumed from that point. To restart a file from the beginning, use <code>M23</code> to reset it, then <code>M24</code>.

When this command is used to resume a print that was paused, RepRapFirmware runs macro file <code>resume.g</code> prior to resuming the print.

M25: Pause SD print

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes Yes ??? ???
Example
M25

The machine pauses printing at the current position within the file. To resume printing, use M24. Do not use this code to pause the print in a G-code file, use M226 instead.

Prior to pausing, RepRapFirmware runs macro file <code>pause.g</code>. This allows the head to be moved away from the print, filament to be retracted, etc.

M26: Set SD position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes aborts ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No No ??? ???
Parameters
<code>Snnn</code> File position in bytes
Example
M26

Set SD position in bytes (M26 S12345).

M27: Report SD print status

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No No ??? ???
Example
M27

Report SD print status.

Marlin and recent forks of 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.

M28: Begin write to SD card

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes 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 No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No No ??? ???
Example
M29 filename.gco

File opened by <code>M28</code> 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
Yes Yes No No No No No ??? ???
Example
> M30 filename.gco
> filename.gco is deleted.
M30 in grbl

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 <code>M109</code> or SD card start to serial

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 ??? ???
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 ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M32 filename.gco

It can be used when printing from SD card and does the same as <code>M23</code> and <code>M24</code>.

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 No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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.

M33: Stop and Close File and save restart.gcode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
??? ??? ??? ??? ??? ??? ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? ??? ??? ??? ??? ??? ??? ???

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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

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
??? ??? ??? ??? ??? ??? ??? ??? 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No
Example
M36 filename.gco

Returns information for the specified SD card file in JSON format. A sample response is:

{"err":0,"size":457574,"height":4.00,"layerHeight":0.25,"filament":[6556.3],"generatedBy":"Slic3r 1.1.7 on 2014-11-09 at 17:11:32"}

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, all other values are in mm. The fields may appear in any order, and additional fields may be present.

If the file name parameter is not supplied and a file on the SD card is currently being printed, then information for that file is returned including additional field "fileName". This feature is used by the web interface and by PanelDue, so that if a connection is made when a file is already being printed, the name and other information about that file can be shown.

M37: Simulation mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

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.

<code>M37 S1</code> enters simulation mode. All G and M codes will not be acted on, but the time they take to execute will be calculated.

<code>M37 S0</code> leaves simulation mode.

<code>M37</code> with no <code>S</code> parameter prints the time taken by the simulation, from the time it was first entered using <code>M37 S1</code>, 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).

M38 Compute SHA1 hash of target file

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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.

M40: Eject

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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 <code>M114</code> command, q.v.).

See also <code>M240</code> and <code>M241</code> below.

M41: Loop

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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:

  1. When you press the reset button,
  2. When the build material runs out (if your RepRap is set up to detect this), and
  3. 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 No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No No ??? No
Parameters
<code>Pnnn</code> Pin number
<code>Snnn</code> Pin value
Example
M42 P7 S255

M42 switches a general purpose I/O pin. Use <code>M42 Px Sy</code> 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 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:

Duet M42 P value to Expansion Port Pin Mapping
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.

Duet 0.6 and 0.8.5 v1.16+ M42 P value to Expansion Port Pin Mapping
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
Duet WiFi v1.16+ M42 P value to Expansion Port Pin Mapping
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 <code>M583</code>.

M43: Stand by on material exhausted

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Usage
<code>M43 En Pnnn Wn In</code>
Parameters
<code>En</code> Enable / disable background endstop monitoring
<code>Pnnn</code> Pin to read or watch. If omitted, read/watch all pins
<code>Wn</code> bool watch pins -reporting changes- until reset, click, or <code>M108</code>
<code>In</code> bool Flag to ignore pin protection

M48: Measure Z-Probe repeatability

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 ??? ???
Parameters
<code>Pnnn</code> number of points
<code>Xnnn</code> position on the X axis
<code>Ynnn</code> position on the Y axis
<code>Vnnn</code> verbosity
<code>E</code> engage
<code>Lnnn</code> legs of travel
<code>S</code> schizoid

As with <code>G29</code>, 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.

M70: Display message

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
see M117 see M117 ??? ??? ??? No ??? ??? see M117
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No see M117 No ??? Yes
Example
M70 P200 Message

Instruct the machine to display a message on its interface LCD. <code>P</code> is the time to display message for.

M72: Play a tone or song

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
see M300 see M300 ??? ??? ??? No No ??? see M300
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? 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.

M73: Set build percentage

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? Yes
Example
M73 P50

Instruct the machine that the build has progressed to the specified percentage. The machine is expected to display this on it's interface board. If the percentage is exactly 0, then a Build Start Notification is sent. If the percentage is exactly 100, then a Build End notification is sent.

M80: ATX Power On

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No automatic ??? ???
Example
M80

Turns on the ATX power supply from standby mode to fully operational mode. No-op on electronics without standby mode.

Note: some firmwares, like Teacup, handle power on/off automatically, so this is redundant there. Also, see RAMPS wiring for ATX on/off

M81: ATX Power Off

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes automatic ??? ???
Example
M81

Turns off the ATX power supply. Counterpart to <code>M80</code>.

For redeem, adding 'P' will quit the daemon (redeem). Adding parameter 'R' will restart the daemon.

M82: Set extruder to absolute mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No Yes ??? ???
Example
M82

Makes the extruder interpret extrusion as absolute positions.

This is the default in repetier.

M83: Set extruder to relative mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No No Yes ??? ???
Example
M83

Makes the extruder interpret extrusion values as relative positions.

M84: Stop idle hold

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes Yes ??? ???
Parameters
This command can be used without any additional parameters.
<code>Innn</code> 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, <code>M84</code> 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.

Notes

1RepRapFirmware-dc42 and other firmware may not support this parameter.

M85: Set inactivity shutdown timer

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes 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)

M92: Set axis_steps_per_unit

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes No ??? ???
Parameters
<code>Xnnn</code> Steps per unit for the X drive
<code>Ynnn</code> Steps per unit for the Y drive
<code>Znnn</code> Steps per unit for the Z drive
<code>Ennn</code> Steps per unit for the extruder drive(s)
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 (<code>M500</code> 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 <code>M92</code> without any parameters.

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 ??? ???

M98: Call Macro/Subprogram

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No
Parameters
<code>Pnnn</code> Macro filename
Example
M98 Pmymacro.g

Runs the macro in the file mymacro.g. In conventional G Codes for CNC machines the <code>P</code> 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 GCode file that is executed by the <code>G98</code> call. That GCode file does not need to end with an <code>M99</code> (return) as the end-of-file automatically causes a return. Macro calls cannot usually be nested or be recursive; i.e. you can't call a macro from a macro, although RepRapFirmware explicitly supports this.

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 on RepRapFirmware as well.

M99: Return from Macro/Subprogram

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No
Example
M99

Returns from an <code>M98</code> call.

RepRapFirmware closes the currently active macro file. If a nested macro is being run, RepRapFirmware goes up one stack level.

M98: Get axis_hysteresis_mm

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Deprecated - clashes with the G Code standard <code>M98</code> above

Example
M98

Report the current hysteresis values in mm for all of the axis.

Proposed for Marlin

M99: Set axis_hysteresis_mm

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Deprecated - clashes with the G Code standard <code>M99</code> above

Example
M99 X<mm> Y<mm> Z<mm> E<mm>

Allows programming of axis hysteresis. Mechanical pulleys, gears and threads can have hysteresis when they change direction. That is, a certain number of steps occur before movement occurs. You can measure how many mm are lost to hysteresis and set their values with this command. Every time an axis changes direction, these extra mm will be added to compensate for the hysteresis.

Proposed for Marlin

M101: Turn extruder 1 on (Forward), Undo Retraction

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.17c and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No Yes ??? ???

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 <code>M103</code>.

in BFB/RapMan: Turn extruder on (forward/filament in).

in RepRapFirmware: undo filament retraction. The length and speed are set by the <code>M207</code> command. RepRapFirmware supports this command for compatibility with Simplify3D.

in other firmwares: Deprecated. Regarding filament retraction, see <code>G10</code>, <code>G11</code>, <code>M207</code>, <code>M208</code>, <code>M227</code>, <code>M228</code>, <code>M229</code>.

M102: Turn extruder 1 on (Reverse)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

In BFB/RapMan firmware: Turn extruder on Reverse (Still to add)

In other firmwares: Deprecated.

M103: Turn all extruders off, Extruder Retraction

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.17c and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No Yes ??? ???

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 <code>M101</code>.

In BFB/RapMan firmware: Turn extruder off.

In RepRapFirmware: retract filament. The length and speed are set by the <code>M207</code> command. RepRapFirmware supports this command for compatibility with Simplify3D.

in other firmwares: Deprecated. Regarding filament retraction, see <code>G10</code>, <code>G11</code>, <code>M207</code>, <code>M208</code>, <code>M227</code>, <code>M228</code>, <code>M229</code>.

M104: Set Extruder Temperature

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes Yes Yes Yes Yes Yes ??? Yes
Parameters
<code>Snnn</code> Target temperature
Example
M104 S190

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). Duet-dc42 and other firmware also supports the optional <code>T</code> parameter (as generated by slic3r) to specify which tool the command applies to. See also <code>M109</code>.

This is deprecated because temperatures should be set using the <code>G10</code> and <code>T</code> commands (q.v.).

Deprecation is subject to discussion. --Traumflug 11:33, 19 July 2012 (UTC)

M104 in Teacup Firmware

In Teacup Firmware, <code>M104</code> can be additionally used to handle all devices using a temperature sensor. It supports the additional <code>P</code> 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.

M105: Get Extruder Temperature

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No Yes No Yes Yes ??? Yes
Parameters
This command can be used without any additional parameters.
<code>Rnnn</code> Response sequence number1
<code>Snnn</code> Response type1
Examples
M105
M105 S2

Request the temperature of the current extruder and the build base in degrees Celsius. The temperatures are returned to the host computer. For example, the line sent to the host in response to this command looks like:

ok T:201 B:117

Expansion/generalization of <code>M105</code> to be considered using S1 parameter as noted in Pronterface I/O Monitor

In Repetier you can add X0 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.

Notes

1These parameters are only supported by RepRapFirmware, which returns a JSON-formatted response if parameter S2 or S3 is specified. Additionally, parameter Rnn may be provided, where nn is the sequence number of the most recent G-code response that the client has already received. <code>M105 S2</code> is equivalent to <code>M408 S0</code>, and <code>M105 S3</code> is equivalent to <code>M408 S2.</code> Usage of these forms of <code>M105</code> is deprecated, please use <code>M408</code> instead.

M106: Fan On

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes Yes Yes Yes Yes Yes ??? ???
Parameters
<code>Pnnn</code> Fan number (optional, defaults to 0)2
<code>Snnn</code> Fan speed (0 to 255; RepRapFirmware also accepts 0.0 to 1.0))
Extra Parameters
<code>Innn</code> Invert signal, or disable fan1
<code>Fnnn</code> Set fan PWM frequency, in Hz1
<code>Lnnn</code> Set minimum fan speed (0 to 255 or 0.0 to 1.0)1
<code>Bnnn</code> Blip time - fan will be run at full PWM for this number of seconds when started from standstill1
<code>Hnn:nn:nn...</code> Select heaters monitored when in thermostatic mode1
<code>Rnnn</code> Restore fan speed to the value it has when the print was paused1
<code>Tnnn</code> Set thermostatic mode trigger temperature1
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). <code>M106 S0</code> turns the fan off. In some implementations like RepRapFirmware the PWM value may alternatively be specified as a real fraction: <code>M106 S0.7</code>.

Notes

1These parameters are only available in RepRapFirmware.

2Marlin only supports fan 0, all values above 0 will be interpreted as 0

M106 in RepRapFirmware

If an <code>S</code> 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 <code>F</code> parameter in the <code>M563</code> 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 <code>R2</code> parameter (see below).

If no <code>S</code> parameter is given but the R1 parameter is used, the fan speed when the print was last paused will be set. If the <code>R2</code> 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 <code>T</code> and <code>H</code> 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 <code>H</code> parameter is at or above the trigger temperature set by the <code>T</code> parameter, and off otherwise. Thermostatic mode can be disabled using parameter H-1.

The <code>B</code> 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 <code>L</code> 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 <code>I</code> 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 <code>I</code> 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 <code>M42</code>.

M106 in Teacup Firmware

Additionally to the above, Teacup Firmware uses <code>M106</code> to control general devices. It supports the additional <code>P</code> 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 <code>M106</code> and <code>M104</code> at the same time, temperature control will override the value given in <code>M106</code> 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 <code>M104</code> is (or becomes) active on a heater (or other device) with a feedback sensor it will correct any <code>M106</code> 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes Yes Yes Yes Yes No ??? ???

Deprecated in Teacup firmware and in RepRapFirmware. Use <code>M106 S0</code> instead.

M108: Cancel Heating (Marlin)

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 Yes No No No No ??? ???

Breaks out of an <code>M109</code> or <code>M190</code> wait-for-temperature loop, continuing the print job. Use this command with caution! If cold extrusion prevention is enabled (see <code>M302</code>) 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., <code>M112</code>] this requires the host to leave space in the command buffer, or the command won't be executed until later.

M108: Set Extruder Speed (BFB)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

Sets speed of extruder motor. (Deprecated in FiveD firmware, see <code>M113</code>)

M109: Set Extruder Temperature and Wait

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No Yes Yes Yes not needed ??? Yes
Parameters
<code>Snnn</code> minimum target temperature, waits until heating
<code>Rnnn</code> maximum target temperature, waits until cooling (Sprinter)
<code>Rnnn</code> accurate target temperature, waits until heating and cooling (Marlin)
Example
M109 S215
M109 in Teacup

Not needed. To mimic Marlin behaviour, use M104 followed by M116.

M109 in Marlin, Sprinter (ATmega port), RepRapFirmware

Set extruder heater temperature in degrees celsius and wait for this temperature to be achieved.

Example
M109 S185

RepRapFirmware also supports the optional <code>T</code> parameter (as generated by slic3r) to specify which tool the command refers to (see below).

M109 in Sprinter (4pi port)

Parameters: <code>S</code> (optional), set target temperature value. If not specified, waits for the temperature set by M104. <code>R</code> (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 <code>T</code> or <code>P</code> 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.

M110: Set Current Line Number

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No Yes No Yes not needed ??? ???
Parameters
<code>Nnnn</code> Line number
Example
M110 N123

This example sets the current line number to 123. Thus the expected next line after this command will be 124.

M111: Set Debug Level

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No Yes No Yes Debug ??? ???
Parameters
<code>Pnnn</code> Debug module1
<code>Snnn</code> 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.

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 <code>M111 S1 P15</code>.

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 <code>M111 S9</code> will turn web debug information on without changing any other debug settings, and <code>M111 S8</code> will turn it off. Web debugging usually means that HTTP requests will be echoed to the USB interface, as will the responses.

M112: Emergency Stop

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No Yes No Yes Yes ??? ???
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 <code>M0</code> and <code>M1</code>.

M113: Set Extruder PWM

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No Yes 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 <code>S</code> value (70% in this instance). <code>M113 S0</code> turns the extruder off, until an <code>M113</code> command other than <code>M113 S0</code> is sent.

M114: Get Current Position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No Yes No Yes Yes ??? 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 No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No Yes No Yes Yes ??? No
Parameters
This command can be used without any additional parameters.
<code>Pnnn</code> Electronics type1
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 <code>M115</code> 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 <code>M408</code> 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 <code>P</code> 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

M116: Wait

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No Yes No Yes Yes ??? Yes
Parameters
This command can be used without any additional parameters.1
<code>Pnnn</code> Tool number
<code>Hnnn</code> Heater number
<code>Cnnn</code> 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 <code>M109</code>.

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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No Yes 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 Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes 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.

M118: Negotiate Features

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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 <code>M115</code>'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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes Yes ??? ???
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, <code>M119</code> 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 Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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

  1. Current feedrate, and
  2. Whether moves (and separately extrusion) are 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:

  1. Current feedrate
  2. Extruder positions

M121: Pop

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M121

Recover the last state pushed onto the stack.

M120: Enable endstop detection

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 ??? ???

M121: Disable endstop detection

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 ??? ???

M122: Diagnose

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M122

Sending an <code>M122</code> causes the RepRap to transmit diagnostic information, for eaxmple 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.

M123: Tachometer value

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Sending an <code>M123</code> causes the RepRap to transmit filament tachometer values from all extruders.

M124: Immediate motor stop

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Immediately stops all motors.

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 ??? 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 ??? 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 ??? ???
Example
M128 S255

PWM value to control internal extruder pressure. <code>S255</code> 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 ??? ???
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
see M301 No ??? ??? ??? No see M301 ??? see M301
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No see M301 Yes ??? ???
Parameters
<code>Pnnn</code> heater number
<code>Snnn</code> 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
see M301 No ??? ??? ??? No see M301 ??? see M301
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No see M301 Yes ??? ???
Parameters
<code>Pnnn</code> heater number
<code>Snnn</code> 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
see M301 see M301 ??? ??? ??? No See M301 ??? see M301
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No see M301 Yes ??? Yes
Parameters
<code>Pnnn</code> heater number
<code>Snnn</code> 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
see M301 No ??? ??? ??? No No ??? see M301
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No see M301 Yes ??? Yes
Parameters
<code>Pnnn</code> heater number
<code>Snnn</code> 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
Example
M133 T0 P500

Instruct the machine to wait for the toolhead to reach its target temperature. T is the extruder to wait for. P if present, sets the time limit.

M134: Write PID values to EEPROM

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No see M500 ??? ??? ??? No See M504 ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No Yes ??? 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? Yes
Parameters
<code>Snnn</code> 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 see M301 ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No Debug ??? ???
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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No Yes Yes Yes Yes ??? Yes
Parameters
<code>Snnn</code> Target temperature
<code>Hnnn</code> Heater number1
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). There is an optional R field that sets the bed standby temperature: <code>M140 S65 R40</code>.

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 affected1:

M140 S-273.15

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
No Yes ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes No uses M104 ??? ???
Parameters
<code>Snnn</code> Target temperature
<code>Hnnn</code> Heater number1
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

1This parameter is only available in RepRapFirmware.

M142: Holding Pressure

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? 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.

M143: Maximum heater temperature

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>H</code> Heater number (RepRapFirmware 1.17 and later, default 1 which is normally the first hot end)
<code>S</code> 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M144

Switch the bed to its standby temperature. <code>M140</code> turns it back to its active temperature; no need for any arguments for that use of <code>M140</code>.

M146: Set Chamber Humidity

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Rnnn</code> 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
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>C</code> Flag to treat temperature as degrees Celsius
<code>K</code> Flag to treat temperature as Kelvin
Example
M149 K

It affects the <code>S</code> or <code>R</code> values in the codes <code>M104</code>, <code>M109</code>, <code>M140</code>, <code>M141</code>, <code>M143</code>, <code>M190</code> and <code>G10.</code> The default is <code>M149 C</code>.

M150: Set display color

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 ??? ???
Parameters
<code>Rnnn</code> red
<code>Unnn</code> green
<code>Bnnn</code> blue
Example
M150 R255 U128 B192

Set BlinkM Color via I2C. Range for values: 0-255

M155: Automatically send temperatures

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes: 1.1.0 No ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> enable sending temperatures = 1, disable = 0
Example
M155 S1

Hosts normally monitor printer temperatures by sending <code>M105</code> every x seconds. This not only adds traffic, but also only works while printer is not blocked by waiting commands. So frequency more depends on frequency you can send new commands and creates extra traffic. As a solution, firmware can be told to automatically send temperatures every second. This function is disabled by default for best compatibility with existing hosts. To indicate the availability of this function, <code>M115</code> will add an extra line:

Cap:AUTOREPORT_TEMP:1

so hosts know about the presence of the function.

M160: Number of mixed materials

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M160 S4

This command has been superseded by the tool definition command <code>M563</code> (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
Yes: RC7 Use M567 ??? ??? ??? Yes: 0.92 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> extruder number
<code>Pnnn</code> weight

Set weight for this mixing extruder drive.

M164: Store weights

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes: RC7 No ??? ??? ??? Yes: 0.92 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> virtual extruder number
<code>Pnnn</code> 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
Yes: RC7 No ??? ??? ??? No: No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters <code>A B C D H I</code>
<code>A[factor]</code> Mix factor for extruder stepper 1
<code>B[factor]</code> Mix factor for extruder stepper 2
<code>C[factor]</code> Mix factor for extruder stepper 3
<code>D[factor]</code> Mix factor for extruder stepper 4
<code>H[factor]</code> Mix factor for extruder stepper 5
<code>I[factor]</code> 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
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No Yes Yes See M116 ??? ???
Parameters
<code>Snnn</code> minimum target temperature, waits until heating
<code>Rnnn</code> accurate target temperature, waits until heating and cooling (Marlin)
Example
M190 S60

This will wait until the bed temperature reaches 60 degrees, printing out the temperature of the hot end and the bed every second.

M191: Wait for chamber temperature to reach target temp

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.17 and later ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes No No ??? ???
Example
M191 P60

Set the temperature of the build chamber to 60 °C and wait for the temperature to be reached.

In MK4duo:

Parameters
<code>Snnn</code> minimum target temperature, waits until heating
<code>Rnnn</code> accurate target temperature, waits until heating and cooling (Marlin)
Example
M191 S60

M200: Set filament diameter

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes see M404 ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes No No ??? ???

Without parameters loads default grid, and with specified extension attempts to load the specified grid. If not available will not modify the current grid. If Z was saved with the grid file, it will load the saved Z with the grid.

<code>M200 Dm.mmm</code> sets the filament diameter to m.mmm millimeters. It is used with 'volumetric calibration' and G-code generated for an ideal 1.128mm diameter filament, which has a volume of 1mm^3 per millimeter. The intention is to be able to generate filament-independent g-code. (See Triffid_Hunter's_Calibration_Guide#Optional:_Switch_to_volumetric_E_units and http://wooden-mendel.blogspot.com/2011/09/volumetric-stage-two.html for more information.)

<code>M200 D0<code> or <code>M200 D1.128</code> ; reset E multiplier to 1, since sqrt(1 / pi) * 2 = 1.128

See also Gcode#M119:_Get_Endstop_Status

Question: what does a firmware do with filament diameter? Has this an effect on how much an E command moves the extruder motor? --Traumflug 11:34, 14 October 2012 (UTC) Yes, Marlin uses this to set a 'volumetric_multiplier' by which the E-steps of a move are scaled in the planner. DaveX (talk) 16:44, 12 April 2014 (PDT) Smoothie implements the same thing as Marlin --Arthurwolf (talk) 05:23, 10 November 2014 (PST)

M201: Set max printing acceleration

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes No ??? ???
Parameters
<code>Xnnn</code> Acceleration for X axis
<code>Ynnn</code> Acceleration for Y axis
<code>Znnn</code> Acceleration for Z axis
<code>Ennn</code> Acceleration for extruder drives
Example
M201 X1000 Y1000 Z100 E2000

Sets the acceleration that axes can do in units/second^2 for print moves. For consistency with the rest of G Code movement this should be in units/(minute^2), but that gives really silly numbers and one can get lost in all the zeros. So for this we use seconds.

RepRapFirmware expects these values to be in mm/s².

M202: Set max travel acceleration

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? No No No ??? No ??? ???

Set max travel acceleration in units/s^2 for travel moves (<code>M202 X1000 Y1000</code>). Unused in Marlin!!

M203: Set maximum feedrate

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? No No No ??? No ??? ???
Parameters
<code>Xnnn</code> Maximum feedrate for X axis
<code>Ynnn</code> Maximum feedrate for Y axis
<code>Znnn</code> Maximum feedrate for Z axis
<code>Ennn</code> Maximum feedrate for extruder drives
Example
M203 X6000 Y6000 Z300 E10000

Sets the maximum feedrates that your machine can do in mm/min (Marlin uses mm/sec).

M203 Repetier

Set temperature monitor to <code>Sx</code>.

M204: Set default acceleration

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes 1.18 and later ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No ??? No ??? ???
Parameters (RepRapFimware)
<code>Pnnn</code> Acceleration for printing moves
<code>Tnnn</code> Acceleration for travel moves
Example
M204 P500 T2000

Use <code>M201</code> to set per-axis accelerations and extruder accelerations. RepRapFirmware applies the <code>M204</code> accelerations to the move as a whole, and also applies the limits set by <code>M201</code> to each axis and extruder.

Other firmwares:

S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and <code>M20</code> minimum feedrate

Marlin notes: After Mar11-2015, the <code>M204</code> options have changed in Marlin:

P = Printing moves

R = Retract only (no X, Y, Z) moves

T = Travel (non printing) moves

The command <code>M204 P800 T3000 R9000</code> sets the acceleration for printing movements to 800mm/s^2, for travels to 3000mm/s^2 and for retracts to 9000mm/s^2.

M204 Repetier
Usage
<code>M204 X[Kp] Y[Ki] Z[Kd]</code>

Set PID parameter. Values are 100*real value.

M205: Advanced settings

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Use M566 ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No ??? No ??? ???
Sprinter / Marlin
Minimum travel speed = <code>S[printing]</code> <code>T[travel]<code>
<code>B[min segment time] X[max XY jerk] Z[max Z jerk] E[max E jerk]</code>
Sprinter / Marlin Example
M205 X30 Z5 ; Set X/Y Jerk to 30mm/s, Z jerk to 5mm/s

Smoothieware uses a different algorithm: [1]

<code>X[xy junction deviation] Z[z junction deviation] S[minimum planner speed].
Z junction deviation only applies to z only moves
0 disables junction deviation for Z
-1 uses global junction deviation
Smoothie example
M205 X0.05  ; set X/Y Junction Deviation
M205 Repetier

Output EEPROM settings.

M206: Offset axes

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes No ??? ???
Parameters
<code>Xnnn</code> X axis offset
<code>Ynnn</code> Y axis offset
<code>Znnn</code> Z axis offset
Example
M206 X10.0 Y10.0 Z-0.4

The values specified are added to the endstop position when the axes are referenced. The same can be achieved with a <code>G92</code> right after homing (<code>G28</code>, <code>G161</code>).

With Marlin firmware, this value can be saved to EEPROM using the <code>M500</code> command.

A similar command is <code>G10</code>, aligning these two is subject to discussion.

With Marlin 1.0.0 RC2 a negative value for z lifts(!) your printhead.

M206 in Repetier: Set eeprom value

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

M206 T[type] P[pos] [Sint(long] [Xfloat] Set eeprom value

Example
M206 T3 P39 X19.9

Set Jerk to 19.9

M207: Calibrate z axis by detecting z max length

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? ??? No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M207

After placing the tip of the nozzle in the position you expect to be considered Z=0, issue this command to calibrate the Z axis. It will perform a z axis homing routine and calculate the distance traveled in this process. The result is stored in EEPROM as z_max_length. For using this calibration method the machine must be using a Z MAX endstop.

This procedure is usually more reliable than mechanical adjustments of a Z MIN endstop.

M207: Set retract length

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> positive length to retract, in mm
<code>Rnnn</code> positive or negative additional length to un-retract, in mm (RepRapFirmware only)
<code>Fnnn</code> retraction feedrate, in mm/min
<code>Tnnn</code> feedrate for un-retraction if different from retraction, mm/min (RepRapFirmware 1.16 and later only)
<code>Znnn</code> additional zlift/hop
Example
M207 S4.0 F2400 Z0.075

Sets the retract length used by the <code>G10</code> and <code>G11</code> commands, stays in mm regardless of <code>M200</code> setting

M208: Set axis max travel

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> Whether to set the axis minimum1
<code>Xnnn</code> X axis limit
<code>Ynnn</code> Y axis limit
<code>Znnn</code> Z axis limit
Example
M208 X250 Y210 Z180

The values specified set the software limits for axis travel in the positive direction.

RepRapPro's version of Marlin uses <code>M208</code> this way. Send <code>M503</code> to see the current values. On Marlin, the value can be saved to EEPROM using the <code>M500</code> command.

Notes

1With RepRapFirmware on a Cartesian printer, you can also use this command to specify software limits for axis travel in the negative direction, by adding parameter S1. The axis limits you set are also the positions assumed when an endstop is triggered.

M208 X200 Y200 Z90; set axis maxima
M208 X-5 Y0 Z0 S1 ; set axis minimum

M208: Set unretract length

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes See M207 ??? ??? ??? No Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> positive length surplus to the <code>M207 Snnn</code>, in mm
<code>Fnnn</code> feedrate, in mm/sec

Sets recover=unretract length.

M209: Enable automatic retract

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No
Example
M209 S1

This boolean value S 1=true or 0=false enables automatic retract detect if the slicer did not support <code>G10</code>/<code>G11</code>: every normal extrude-only move will be classified as retract depending on the direction.

M210: Set homing feedrates

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M210 X1000 Y1500

Set the feedrates used for homing to the values specified in mm per minute.

M211: Disable/Enable software endstops

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Use M564 ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

The boolean value S 1=enable or 0=disable controls state of software endstop.

The boolean value X, Y or Z 1=max endstop or 0=min endstop selects which endstop is controlled.

Example
M211 X1 Y1 Z1 S0

Disables X,Y,Z max endstops

Example
M211 X0 S1

Enables X min endstop

Example
M211

Prints current state of software endstops.

M212: Set Bed Level Sensor Offset

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes* Use G31 ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

This G-Code command is known to be available in the newer versions of PrintrBot's branch of Marlin. It may not be available in other firmware.

Example
M212 Z-0.2

Set the Z home to 0.2 mm lower than where the sensor says Z home is. This is extremely useful when working with printers with hard-to-move sensors, like the PrintrBot Metal Plus.

PrintrBot suggests that the user make minor (0.1-0.2) adjustments between attempts and immediately executes <code>M500</code> & <code>M501</code> after setting this.

M218: Set Hotend Offset

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Use G10 ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Sets hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>.

Example
M218 T1 X50 Y0.5

M220: Set speed factor override percentage

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes Yes ??? ???
Parameters
<code>Snnn</code> Speed factor override percentage (0..100 or higher)
Example
M220 S80

Sets the speed factor override percentage.

M221: Set extrude factor override percentage

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes Yes ??? ???
Parameters
<code>Snnn</code> Extrude factor override percentage (0..100 or higher), default 100%
<code>Dnnn</code> Extruder drive number (RepRapFirmware only), default 0
Example
M221 S70
M221 S95 D1

Sets extrude factor override percentage. In the case of RepRapFirmware, sets the extrusion factor percentage for the specified extruder drive only.

M220: Turn off AUX V1.0.5

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

M221: Turn on AUX V1.0.5

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

M222: Set speed of fast XY moves

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

M223: Set speed of fast Z moves

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

M224: Enable extruder during fast moves

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

M225: Disable on extruder during fast moves

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No No No No ??? ???

M226: Gcode Initiated Pause

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No Yes No Yes No No ??? ???
Example
M226

Initiates a pause in the same way as if the pause button is pressed. That is, program execution is stopped and the printer waits for user interaction. This matches the behaviour of <code>M1</code> in the NIST RS274NGC G-code standard and <code>M0</code> in Marlin firmware.

M226: Wait for pin state

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes see M577 ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Pnnn</code> pin number
<code>Snnn</code> pin state
Example
M226 P2 S1

Wait for a pin to be in some state.

M227: Enable Automatic Reverse and Prime

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M227 P1600 S1600

P and S are steps.

"Reverse and Prime" means, the extruder filament is retracted some distance when not in use and pushed forward the same amount before going into use again. This shall help to prevent drooling of the extruder nozzle. Teacup firmware implements this with <code>M101</code>/<code>M103</code>.

M228: Disable Automatic Reverse and Prime

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M228

See also <code>M227</code>.

M229: Enable Automatic Reverse and Prime

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M229 P1.0 S1.0

<code>P</code> and <code>S</code> are extruder screw rotations. See also <code>M227</code>.

M230: Disable / Enable Wait for Temperature Change

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M230 S1

<code>S1</code> Disable wait for temperature change <code>S0</code> Enable wait for temperature change

M231: Set OPS parameter

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
M231 S[OPS_MODE] X[Min_Distance] Y[Retract] Z[Backslash] F[RetractMove]

M232: Read and reset max. advance values

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

M240: Trigger camera

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 ??? ???
Example
M240

Triggers a camera to take a photograph. (Add to your per-layer GCode.)

M240: Start conveyor belt motor / Echo off

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No Debug: Echo off ??? ???
Example
M240

The conveyor belt allows to start mass production of a part with a reprap.

Echoing may be controlled in some firmwares with <code>M111</code>.

M241: Stop conveyor belt motor / echo on

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No Debug: Echo on ??? ???
Example
M241

Echoing may be controlled in some firmwares with <code>M111</code>.

M245: Start cooler

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M245

used to cool parts/heated-bed down after printing for easy remove of the parts after print

M246: Stop cooler

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M246

M250: Set LCD contrast

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
M250 C20

Sets LCD contrast C<contrast value> (value 0..63), if available.

M251: Measure Z steps from homing stop (Delta printers)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Examples
M251 S0 ; Reset
M251 S1 ; Print
M251 S2 ; Store to Z length (also EEPROM if enabled)

(This is a Repetier-Firmware only feature.)

M260: i2c Send Data

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes: 1.1.0 No ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No

Buffer and send data over the i2c bus. Use <code>A</code> to set the address from 0-127. Add up to 32 bytes to the buffer with each <code>B</code>. Send and reset the buffer with <code>S</code>.

Examples
M260 A5 B65 S ; Send 'A' to Address 5 now
M260 A0       ; Set address to 0 (broadcast)
M260 B77  ; M
M260 B97  ; a
M260 B114 ; r
M260 B108 ; l
M260 B105 ; i
M260 B110 ; n
M260 S1   ; Send the current buffer

M261: i2c Request Data

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes: 1.1.0 No ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No

Request data from an i2c slave device. This command simply relays the received data to the host.

Example
M261 A99 B5 ; Request 5 bytes from Address 99

Both <code>M260</code> and <code>M261</code> are commands demonstrating use of the i2c bus (TWIBus class) in Marlin Firmware. Developers and vendors can make Marlin an i2c master device by enabling <code>EXPERIMENTAL_I2CBUS</code>, and Marlin can act as a slave device by setting <code>I2C_SLAVE_ADDRESS</code> from 8-127. This class can be used to divide up processing responsibilities between multiple instances of Marlin running on multiple boards. For example, one board might control a Z axis with 4 independent steppers to create a self-leveling system, or a second board could drive the graphical display while the first board handles printing.

M280: Set servo position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes 1.16 and later ??? ??? ??? Use M340 No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes Yes No ??? ???

Set servo position absolute.

Parameters
<code>Pnnn</code> Servo index
<code>Snnn</code> Angle or microseconds
<code>I1</code> Invert polarity (RepRapFirmware only)
Example
M280 P1 S50

Marlin and RepRapFirmware treat <code>S</code> values below 200 as angles, and 200 or greater as the pulse width in microseconds.

In RepRapFirmware, the servo index is the same as the pin number for the <code>M42</code> command. See https://duet3d.com/wiki/Using_servos_and_controlling_unused_I/O_pins for details.

RepRapFirmware supports the optional I1 parameter, which if present causes the polarity of the servo pulses to be inverted compared to normal for that output pin. The <code>I</code> parameter is not remembered between <code>M280</code> commands (unlike the <code>I</code> parameter in <code>M106</code> commands), so if you need inverted polarity then you must include I1 in every <code>M280</code> command you send.

Duet 0.8.5 M280 P value to Expansion Port Pin Mapping
P Name Expansion Port Pin
Use M307 H# A-1 C-1 D-1 before using these pins
3 PC23_PWML6 21
4 PC22_PWML5 22
5 PC21_PWML4 23

On the Duet 0.6, pin 18 is controlled by heater 2. On the 0.8.5, pin 18 is controlled by heater 6, but is also shared with fan1. In order to use this pin, the fan must be disabled (M106 P1 I-1). See Using servos and controlling unused I/O pins

M290: Baby stepping

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.18 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No
Parameters
<code>Snnn</code> Amount to baby step in mm. Positive values raise the head, negative values lower it.
Example
M290 S0.05

This command tells the printer to apply the specified additional offset to the Z coordinate for all future moves, and to apply the offset to moves that have already been queued if this case be done. Baby stepping is cumulative, for example after <code>M290 S0.1</code> followed by <code>M290 S-0.02</code>, an offset of 0.08mm is used.

M290 with no parameters reports the accumulated baby stepping offset.

The baby stepping offset is reset to zero when the printer is homed or the bed is probed.

M300: Play beep sound

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes No No ??? Yes
Parameters
<code>Snnn</code> frequency in Hz
<code>Pnnn</code> duration in milliseconds
Example
M300 S300 P1000

Play beep sound, use to notify important events like the end of printing. See working example on R2C2 electronics.

If an LCD device is attached to RepRapFirmware, a sound is played via the add-on touch screen control panel. Else the web interface will play a beep sound.

M301: Set PID parameters

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes See M130-M133 ??? ???
Parameters
<code>Hnnn</code> heater number (Smoothie uses 'S', Redeem uses 'E')
<code>Pnnn</code> proportional (Kp)
<code>Innn</code> integral (Ki)
<code>Dnnn</code> derivative (Kd)
Examples
M301 H1 P1 I2 D3 ; Marlin
M301 H1 P1 I2 D3 T0.2 B20 W127 S0.8 ; RepRapFirmware (v1.09 onwards), Duet-dc42
M301 S0 P30 I10 D10 ; Smoothie
M301 E0 P30 I10 D10 ; Redeem (E = Extruder, -1=Bed, 0=E, 1=H, 2=A, 3=B, 4=C, default = 0)

Sets Proportional (P), Integral (I) and Derivative (D) values for hot end. See also PID Tuning.

Marlin

Hot end only; see <code>M304</code> for bed PID. H is the heater number, default 1 (i.e. first extruder heater).

RepRapFirmware (v1.09 onwards)
  • <code>H</code> Is the heater number, and is compulsory. H0 is the bed, H1 is the first hot end, H2 the second etc.
  • <code>P</code> Interprets a negative P term as indicating that bang-bang control should be used instead of PID (not recommended for the hot end, but OK for the bed heater).
  • <code>I</code> Integral value
  • <code>D</code> Derivative value
  • <code>T</code> Is the approximate additional PWM (on a scale of 0 to 255) needed to maintain temperature, per degree C above room temperature. Used to preset the I-accumulator when switching from heater fully on/off to PID.
  • <code>S</code> PWM scaling factor, to allow for variation in heater power and supply voltage. Is designed to allow a correction to be made for a change in heater power and/or power supply voltage without having to change all the other parameters. For example, an S factor of 0.8 means that the final output of the PID controller should be scaled to 0.8 times the standard value, which would compensate for a heater that is 25% more powerful than the standard one or a supply voltage that is 12.5% higher than standard.
  • <code>W</code> Wind-up. Sets the maximum value of I-term, must be high enough to reach 245C for ABS printing.
  • <code>B</code> PID Band. Errors larger than this cause heater to be on or off.

An example using all of these would be:

M301 H1 P20 I0.5 D100 T0.4 S1 W180 B30
Smoothie

<code>S0<code> is 0 for the hotend, and 1 for the bed, other numbers may apply to your configuration, depending on the order in which you declare temperature control modules.

Other implementations

W: Wind-up. Sets the maximum value of I-term, so it does not overwhelm other PID values, and the heater stays on. (Check firmware support - Sprinter, Marlin?)

Example
M301 W125
Teacup

See <code>M130</code>, <code>M131</code>, <code>M132</code>, <code>M133</code> for Teacup's codes for setting the PID parameters.

M302: Allow cold extrudes

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes1 ??? ??? ??? Yes: 0.92 No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Snnn</code> Cold extrude minimum temperature
<code>Pnnn</code> Cold extrude allow state (RepRapFirmware)
Examples (RepRapFirmwre)
M302       ; Report current state
M302 P1    ; Allow cold extrusion
Examples (Others)
M302 S0    ; Allow extrusion at any temperature
M302 S170  ; Allow extrusion above 170

This tells the printer to allow movement of the extruder motor above a certain temperature, or if disabled, to allow extruder movement when the hotend is below a safe printing temperature.

Notes

1RepRapFirmware uses the <code>P[0|1]</code> parameter instead of <code>S[temperature]</code>, and for <code>M302</code> with no parameters it will report the current cold extrusion state.

M303: Run PID tuning

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes 1.15 and later ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No Yes No ??? ???

PID Tuning refers to a control algorithm used in some repraps to tune heating behavior for hot ends and heated beds. This command generates Proportional (Kp), Integral (Ki), and Derivative (Kd) values for the hotend or bed (E-1). Send the appropriate code and wait for the output to update the firmware.

Hot end usage:

M303 S<temperature> C<cycles>

Bed usage (repetier, not sure whether cycles work here):

M303 P1 S<temperature>

Bed usage (others):

M303 E-1 C<cycles> S<temperature>
Example
M303 C8 S175

Smoothie's syntax, where <code>E0</code> is the first temperature control module (usually the hot end) and <code>E1</code> is the second temperature control module (usually the bed):

M303 E0 S190

In RepRapFirmware, this command computes the process model parameters (see <code>M307</code>), which are in turn used to calculate the PID constants. H is the heater number, P is the PWM to use (default 0.5), and S is the maximum allowable temperature (default 225). Tuning is performed asynchronously. Run <code>M303</code> with no parameters to see the current tuning state or the last tuning result.

Example
M303 H1 P0.4 S240 ; tune heater 1 using 40% PWM, quit if temperature exceeds 240C
Notes

In Marlin Firmware you can add the <code>U1</code> parameter to apply the PID results to current settings upon completion.

M304: Set PID parameters - Bed

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? ??? see M301 ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Pnnn</code> proportional (Kp)
<code>Innn</code> integral (Ki)
<code>Dnnn</code> derivative (Kd)
Examples
M304 P1 I2 D3 ; set kP=3, kI=2, kD=3
M304 P1 I2 D3 T0.7 B20 W127 ; RepRapFirmware
M304          ; Report parameters

Sets Proportional, Integral and Derivative values for bed. RepRapFirmware interprets a negative P term as indicating that bang-bang control should be used instead of PID. In RepRapFirmware, this command is identical to <code>M301</code> except that the <code>H</code> parameter (heater number) defaults to zero.

See also PID Tuning.

M304 in RepRapPro version of Marlin: Set thermistor values

In the RepRapPro version of Marlin ( https://github.com/reprappro/Marlin ) <code>M304</code> is used to set thermistor values (as <code>M305</code> is in later firmwares). RRP Marlin calculates temperatures on the fly, rather than using a temperature table. <code>M304</code> Sets the parameters for temperature measurement.

Example
M304 H1 B4200 R4800 T100000

This tells the firmware that for heater 1 (<code>H</code> parameter: 0 = heated bed, H = first extruder), the thermistor beta (<code>B</code> parameter) is 4200, the thermistor series resistance (<code>R</code> parameter) is 4.8Kohms, the thermistor 25C resistance (<code>T</code> parameter) is 100Kohms. All parameters other than H are optional. If only the <code>H</code> parameter is given, the currently-used values are displayed. They are also displayed within the response to <code>M503</code>.

M305: Set thermistor and ADC parameters

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? ??? Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Pnnn</code> Heater number
<code>Tnnn</code> Thermistor resistance at 25oC
<code>Bnnn</code> Beta value, or the reciprocal of the Steinhart-Hart thermistor model B coefficient
<code>Cnnn</code> Steinhart-Hart C coefficient (RepRapFirmware 1.17 and later), default 0
<code>Rnnn</code> Series resistor value
<code>Lnnn</code> ADC low offset
<code>Hnnn</code> ADC high offset
<code>Xnnn</code> Heater ADC channel, or thermocouple or PT100 adapter channel, defaults to the same value as the <code>P</code> parameter
Example
M305 P1 T100000 R1000 B4200

Sets the parameters for temperature measurement. The example above tells the firmware that for heater 1 (<code>P</code> parameter: 0 = heated bed, 1 = first extruder) the thermistor 25C resistance (<code>T</code> parameter) is 100Kohms, the thermistor series resistance (<code>R</code> parameter) is 1Kohms, the thermistor beta (<code>B</code> parameter) is 4200. All parameters other than P are optional. If only the <code>P</code> parameter is given, the existing values are displayed.

RepRapFirmware also supports ADC gain and offset correction and a thermistor selection facility.

Example
M305 P1 T100000 R1000 B4200 H14 L-11 X2

The H correction affects the reading at high ADC input voltages, so it has the greatest effect at low temperatures. The L correction affects the reading at low input voltages, which correspond to high temperatures.

The <code>X</code> parameter tells the firmware to use the thermistor input corresponding to a different heating channel. RepRapFirmware also allow an external SPI thermocouple interface (such as the MAX31855) or PT100 interface (MAX31865) to be configured. Thermocouple channels are numbered from 100 and PT100 channels from 200.

In the above example, the ADC high end correction (<code>H</code> parameter) is 14, the ADC low end correction (<code>L</code> parameter) is -11, and thermistor input #2 is used to measure the temperature of heater #1.

M306: Set home offset calculated from toolhead position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? ??? Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Example
M306 Z0

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 <code>M306</code> command.

This value can be saved to EEPROM using the <code>M500</code> command (as <code>M206</code> value).

Implemented in Smoothieware

M307: Set or report heating process parameters

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.15 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Hn</code> Heater number (0 is usually the bed heater)
<code>Annn</code> gAin, expressed as ultimate temperature rise obtained in degC divided by the PWM fraction. For example, if G=180 then at 50% PWM the ultimate temperature rise would be 90C.
<code>Cnnn</code> dominant time Constant of the heating process in seconds
<code>Dnnn</code> Dead time in seconds
Two additional parameters help control the heating process
<code>Bn</code> selects Bang-bang control instead of PID if non-zero. Default at power-up is 0 for extruder heaters, 1 for the bed heater.
<code>Snnn</code> maximum PWM to be used used with this heater on a scale of 0 to 1. Default 1.0.
Examples
M307 H0 ; report the process parameters for heater 0
M307 H1 A346.2 C140 D5.3 B0 S0.8 ; set process parameters for heater 1, use PID, and limit heater 1 PWM to 80%

Each heater and its corresponding load may be approximated as a first order process with dead time, which is characterised by the gain, time constant and dead time parameters. The model can used to calculate optimum PID parameters (including using different values for the heating or cooling phase and the steady state phase), to better detect heater faults, and to calculate feed-forward terms to better respond to changes in the load. Normally these model parameters are found by auto tuning - see <code>M303</code>.

RepRapFirmware 1.16 and later allow the PID controller for a heater to be disabled by setting the <code>A</code>, <code>C</code>, and <code>D</code> parameters to -1. This frees up the corresponding heater control pin for use as a general purpose I/O pin.

M320: Activate autolevel (Repetier)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Usage
<code>M320</code>
<code>M320 S1</code>
Parameters
<code>Snnn</code> if greater than 0, activate and store persistently in EEPROM
Examples
M320    ; temporarily activate auto leveling
M320 S1 ; permanently activate auto leveling

Parameter <code>Snnn</code> is optional.

(Repetier only)

M321: Deactivate autolevel (Repetier)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Usage
<code>M321</code>
<code>M321 S1</code>
Parameters
<code>Snnn</code> if greater than 0, deactivate and store persistently in EEPROM
Examples
M321    ; temporarily deactivate auto leveling
M321 S1 ; permanently deactivate auto leveling

Parameter <code>Snnn</code> is optional.

(Repetier only)

M322: Reset autolevel matrix (Repetier)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Usage
<code>M322</code>
<code>M322 S1</code>
Parameters
<code>Snnn</code> if greater than 0, also reset the matrix values saved EEPROM
Examples
M322    ; temporarily reset auto level matrix
M322 S1 ; permanently reset auto level matrix

Parameter <code>Snnn</code> is optional.

(Repetier only)

M323: Distortion correction on/off (Repetier)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Usage
<code>M323</code>
<code>M323 Snnn</code>
<code>M323 Snnn Pnnn</code>
Parameters
<code>Snnn</code> 0 (disable correction) or 1 (enable correction)
<code>Pnnn</code> 1 (store correction state persistently in EEPROM)
Examples
M323       ; Show if distortion correction is enabled
M323 S0    ; Disable distortion correction temporarily
M323 S1 P1 ; Enable distortion correction permanently

(Repetier only) Controls distortion correction feature after having set it up using <code>G33.</code>

M340: Control the servos

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

(Repetier only ,Marlin see M280)

M340 P<servoId> S<pulseInUS> / ServoID = 0..3 pulseInUs = 500..2500

Servos are controlled by a pulse width normally between 500 and 2500 with 1500ms in center position. 0 turns servo off.

M350: Set microstepping mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???

Sets microstepping mode.

Warning: Steps per unit remains unchanged; except that in RepRapFirmware the steps/mm will be adjusted automatically.

Usage
<code>M350 Snn Xnn Ynn Znn Enn Bnn</code>
Parameters
Not all parameters need to be used, but at least one should be used. As with other commands, RepRapFirmware reports the current settings if no parameters are used.
<code>Snn</code> Set stepping mode for all drivers (not supported by RepRapFirmware)
<code>Xnn</code> Set stepping mode for the X axis
<code>Ynn</code> Set stepping mode for the Y axis
<code>Znn</code> Set stepping mode for the Z axis
<code>Enn</code> Set stepping mode for Extruder 0 (for RepRapFirmware use <code>Enn:nn:nn</code> etc. for multiple extruders)
<code>Bnn</code> Set stepping mode for Extruder 1 (not supported by RepRapFirmware, see above)
<code>Inn</code> Enable (nn=1) or disable (nn=0) microstep interpolation mode for the specified drivers, if they support it (RepRapFirmware only)
Modes (nn)
1 = full step
2 = half step
4 = quarter step
8 = 1/8 step
16 = 1/16 step
64 = 1/64 step
128 = 1/128 step
256 = 1/256 step
Examples
M350 S16    ; reset all drivers to the default 1/16 micro-stepping - not supported by RepRapFirmware
M350 Z1     ; set the Z-axis' driver to use full steps
M350 E4 B4  ; set both extruders to use quarter steps - Marlin/Repetier
M350 E4:4:4 ; set extruders 0-2 to use quarter steps - RepRapFirmware

M351: Toggle MS1 MS2 pins directly

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 ??? ???
Example
M351

M355: Turn case lights on/off

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes: 0.92.2 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No use M106 ??? ???
Examples
M355 S1 ; Enable lights
M355 S0 ; Disable lights
M355    ; Report status

Every call or change over LCD menu sends a state change for connected hosting software like:

Case lights on
Case lights off
No case lights

M360: Report firmware configuration

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes: 0.92.2 No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Target

This command helps hosting software to detect configuration details, which the user would need to enter otherwise. It should reduce configuration time considerably if supported.

Example
M360
Response
Config:Baudrate:250000
Config:InputBuffer:127
Config:NumExtruder:2
Config:MixingExtruder:0
Config:HeatedBed:0
Config:SDCard:1
Config:Fan:1
Config:LCD:1
Config:SoftwarePowerSwitch:1
Config:XHomeDir:-1
Config:YHomeDir:-1
Config:ZHomeDir:-1
Config:SupportG10G11:1
Config:SupportLocalFilamentchange:1
Config:CaseLights:0
Config:ZProbe:1
Config:Autolevel:0
Config:EEPROM:1
Config:PrintlineCache:24
Config:JerkXY:30.00
Config:JerkZ:0.30
Config:RetractionLength:3.00
Config:RetractionLongLength:13.00
Config:RetractionSpeed:40.00
Config:RetractionZLift:0.00
Config:RetractionUndoExtraLength:0.00
Config:RetractionUndoExtraLongLength:0.00
Config:RetractionUndoSpeed:0.00
Config:XMin:0.00
Config:YMin:0.00
Config:ZMin:0.00
Config:XMax:250.00
Config:YMax:150.00
Config:ZMax:90.00
Config:XSize:250.00
Config:YSize:150.00
Config:ZSize:90.00
Config:XPrintAccel:250.00
Config:YPrintAccel:250.00
Config:ZPrintAccel:100.00
Config:XTravelAccel:250.00
Config:YTravelAccel:250.00
Config:ZTravelAccel:100.00
Config:PrinterType:Cartesian
Config:MaxBedTemp:120
Config:Extr.1:Jerk:50.00
Config:Extr.1:MaxSpeed:100.00
Config:Extr.1:Acceleration:10000.00
Config:Extr.1:Diameter:0.00
Config:Extr.1:MaxTemp:220
Config:Extr.2:Jerk:50.00
Config:Extr.2:MaxSpeed:100.00
Config:Extr.2:Acceleration:10000.00
Config:Extr.2:Diameter:0.00
Config:Extr.2:MaxTemp:220

SCARA calibration codes (Morgan)

In order to ease calibration of Reprap Morgan, the following M-codes are used to set the machine up

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Partial No ??? ??? ??? No Yes ??? Partial
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

M360: Move to Theta 0 degree position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Experimental No ??? ??? ??? No Yes ??? Experimental
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

The arms move into a position where the Theta steering arm is parallel to the top platform edge. The user then calibrates the position by moving the arms with the jog buttons in software like pronterface until it is perfectly parallel. Using <code>M114</code> will then display the calibration offset that can then be programmed into the unit using <code>M206</code> (Home offset) X represents Theta.

Smoothieware: <code>M360 P0</code> will take the current position as parallel to the platform edge, and store the offset in the homing trim offset (M666) No further user interaction is needed.

M361: Move to Theta 90 degree position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Experimental No ??? ??? ??? No Yes ??? Experimental
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Theta move to 90 degrees with platform edge. User calibrates by using jog arms to place exactly 90 degrees. Steps per degree can then be read out by using <code>M114</code>, and programmed using <code>M92</code>. X represents Theta. Program Y (Psi) to the same value initially. Remember to repeat <code>M360</code> after adjusting steps per degree.

Smoothieware: <code>M360 P0</code> will accept the current position as 90deg to platform edge. New steps per angle is calculated and entered into memory (M92) No further user interaction is required, except to redo <code>M360</code>.

M362: Move to Psi 0 degree position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Experimental No ??? ??? ??? No Yes ??? Experimental
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Arms move to Psi 0 degree. Check only after other Theta calibrations

M363: Move to Psi 90 degree position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Experimental No ??? ??? ??? No Yes ??? Experimental
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Arms move to Psi 90 degree. Check only after other Theta calibrations

M364: Move to Psi + Theta 90 degree position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Experimental No ??? ??? ??? No Yes ??? Experimental
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Move arms to form a 90 degree angle between the inner and outer Psi arms. Calibrate by moving until angle is exactly 90 degree. Read out with <code>M114</code>, and calibrate value into Home offset <code>M206</code>. Psi is represented by Y.

Smoothieware: <code>M364 P0</code> will accept the current position as 90deg between arms. The offset is stored as a trim offset (M666) and no further user interaction is required except to save all changes via <code>M500</code>.

M365: SCARA scaling factor

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Experimental No ??? ??? ??? No Yes ??? Experimental
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Adjust X Y and Z scaling by entering the factor. 100% scaling (default) is represented by 1

M366: SCARA convert trim

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Executing this command translates the calculated trim values of the SCARA calibration to real home offsets. This prevents the home and trim movement after calibration.

M370: Morgan manual bed level - clear map

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Use M557 ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???

Clear the map and prepare for calibration

Usage
<code>M370</code>
<code>M370 X[divisions] Y[divisions]</code>

Without parameters is defaults to <code>X5 Y5</code> (25 calibration points) When specifying parameters, uneven numbers are recommended.

M371: Move to next calibration position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

Move to the next position for calibration. User moves the bed towards the hotend until it just touches

M372: Record calibration value, and move to next position

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

The position of the bed is recorded and the machine moves to the next position. Repeat until all positions programmed

M373: End bed level calibration mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

End calibration mode and enable z correction matrix. Does not save current matrix

M374: Save calibration grid

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.17 and later ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

Saves the calibration grid.

Parameters
<code>extension</code> (Smoothieware only) Extension of the grid file
<code>Pfilename</code> (RepRapFirmware only) Name of the file to save to
<code>Z</code> (Smoothieware only) Also save the <code>M206</code> Z homing offset into the grid file
Usage (Smoothieware)
M374
M374 <file extension> Z
Usage (RepRapFirmware)
M374
M374 PMyAlternateHeightMap.csv

In Smoothieware, without parameters this saves the grid into the default grid file that gets loaded at boot. The optional parameter specifies the extension of the grid file - useful for special grid files such as for a special print surface like a removable print plate. Addition of Z will additionally save the <code>M206 Z</code> homing offset into the grid file.

In RepRapFirmware, this saves the grid parameters and height map into the specified file, or the default file <code>heightmap.csv</code> if no filename was specified. To load the height map automatically at startup, use command <code>M375</code> in the config.g file.

M375: Display matrix / Load Matrix

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.17 and later ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

Displays the bed level calibration matrix (Marlin), or loads the grid matrix file (Smoothieware and RepRapFirmware)

Parameters
<code>extension</code> (Smoothieware only)
<code>Pfilename</code> (RepRapFirmware only)
Usage
M375
M375 [file extension] ; (Smoothieware only)
M375 PMyAlternateHeightMap.csv ; (RepRapFirmware only)

Without parameters loads default grid, and with specified extension or specified filename attempts to load the specified grid. If not available will not modify the current grid. In Smoothieware, if Z was saved with the grid file, it will load the saved Z with the grid.

M376: Set bed compensation taper

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.17 and later ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Hnnn</code> Height (mm) over which to taper off the bed compensation
Example
M376 H10

This command specifies that bed compensation should be tapered off over the specified height, so that no bed compensation is applied at and above that height. If H is zero or negative then no tapering is applied, so compensation is performed throughout the entire print.

If the firmware does not adjust the extrusion amount to compensate for the changing layer height while tapering is being applied, you will get under- or over-extrusion. Using a large taper height will reduce this effect. For example, if the taper height is 50 times the largest bed height error, then under- or over-extrusion will be limited to 2%.

M380: Activate solenoid

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? ??? No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M380

Activates solenoid on active extruder.

M381: Disable all solenoids

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? ??? No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M381

M400: Wait for current moves to finish

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No Yes ??? use G4 ??? ???
Example
M400

Finishes all current moves and and thus clears the buffer. That's identical to <code>G4 P0</code>.

M401: Lower z-probe

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes 1.17 and later ??? ??? ??? ??? No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M401

Lower z-probe if present. In RepRapFirmware this runs macro file sys/deployprobe.g.

M402: Raise z-probe

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes 1.17 and later ??? ??? ??? ??? No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M402

Raise z-probe if present. In RepRapFirmware this runs macro file sys/retractprobe.g.

M404: Filament width and nozzle diameter

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Nnnn</code> Filament width (in mm)
<code>Dnnn</code> Nozzle diameter (in mm)1
Examples
M404 N1.75
M404 N3.0 D1.0

Enter the nominal filament width (3mm, 1.75mm) or will display nominal filament width without parameters.

Notes

1While Marlin only accepts the 'N' parameter, RepRapFirmware further allows to specify the nozzle diameter (in mm) via the 'D 'parameter. This value is used to properly detect the first layer height when files are parsed or a new print is being started.

M405: Filament Sensor on

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 ??? ???
Example
M405

Turn on Filament Sensor extrusion control. Optional D<delay in cm> to set delay in centimeters between sensor and extruder.

M406: Filament Sensor 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 ??? ???
Example
M406

Turn off Filament Sensor extrusion control.

M407: Display filament diameter

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M407

Displays measured filament diameter. In RepRapFirmware, <code>M407</code> does the same as <code>M404</code>.

M408: Report JSON-style response

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Snnn</code> Response type
<code>Rnnn</code> Response sequence number
Example
M408 S0

Report a JSON-style response by specifying the desired type using the 'S' parameter.

The following response types are supported:

  • Type 0 is a short-form response, similar to the response used by older versions of the web interface.
  • Type 1 is like type 0 except that static values are also included.
  • Type 2 is similar to the response provided by the web server for Duet Web Control.
  • Type 3 is an extended version of type 2 which includes some additional parameters that aren't expected to change very frequently.
  • Type 4 is an extended version of type 2 which may be used to poll for current printer statistics.
  • Type 5 reports the current machine configuration.

Here is an example of a typical type 0 response:

{"status":"I","heaters":[25.0,29.0,28.3],"active":[-273.1,0.0,0.0],"standby":[-273.1,0.0,0.0],"hstat":[0,2,1],"pos":[-11.00,0.00,0.00],"extr":[0.0,0.0],
 "sfactor":100.00, "efactor":[100.00,100.00],"tool":1,"probe":"535","fanPercent":[75.0,0.0],"fanRPM":0,"homed":[0,0,0],"fraction_printed":0.572}

The response is set as a single line with a newline character at the end. The meaning of the fields is:

status:  I=idle, P=printing from SD card, S=stopped (i.e. needs a reset), C=running config file (i.e starting up), A=paused, D=pausing, R=resuming from a pause, B=busy (e.g. running a macro), F=performing firmware update
heaters: current heater temperatures, numbered as per the machine (typically, heater 0 is the bed)
active:  active temperatures of the heaters
standby: standby temperatures of the heaters
hstat:   status of the heaters, 0=off, 1=standby, 2=active, 3=heater fault. Heater 0 is normally the bed heater, heaters 1, 2.. are the extruder heaters.
pos:     the X, Y and Z (and U, V, W if present) axis positions of the current tool (if a tool is selected), or of the print head reference point if no tool is selected
extr:    the positions of the extruders
sfactor: the current speed factor (see <code>M220</code> command)
efactor: the current extrusion factors (see <code>M221</code> command), one value per extruder
tool:    the selected tool number. A negative number typically means no tool selected.
probe:   the Z-probe reading
fanPercent: the speeds of the controllable fans, in percent of maximum
fanRPM:  the print cooling fan RPM
homed:   the homed status of the X, Y and Z axes (and U, V, W if they exist), or towers on a delta. 0=axis has not been homed so position is not reliable, 1=axis has been homed so position is reliable.
fraction_printed: the fraction of the file currently being printed that has been read and at least partially processed.
message: the message to be displayed on the screen (only present if there is a message to display)
timesLeft: an array of the estimated remaining print times (in seconds) calculated by different methods. These are currently based on the proportion of the file read,
           the proportion of the total filament consumed, and the proportion of the total layers already printed. Only present if a print from SD card is in progress.
seq:     the sequence number of the most recent non-trivial G-code response or error message. Only present if the <code>R</code> parameter was provided and the current sequence number is greater than that.
resp:    the most recent non-trivial G-code response or error message. Only present if the <code>R</code> parameter was provided and the current sequence number is greater.

The type 1 response comprises these fields plus some additional ones that do not generally change and therefore do not need to be fetched as often. The extra fields include:

myName:  the name of the printer
firmwareName: the name of the firmware, e.g. "RepRapFirmware", "Smoothieware" or "Repetier"
geometry: one of "cartesian", "delta", "corexy, "corexz" etc.
axes:    the number of axes
volumes: the number of SD card slots available
numTools:   the number of available tools numbered contiguously starting from 0

The fields may be in any order in the response. Other implementations may omit fields and/or add additional fields.

For a more detailed comparison of type 2 - 5, see RepRap_Firmware_Status_responses.

PanelDue currently uses only <code>M408 S0</code> and <code>M408 S1</code>.

M420: Set RGB Colors as PWM (MachineKit)

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes ??? No ??? ???

Usage: <code>M420 R[Red PWM (0-255)] E[Green PWM (0-255)] B[Blue PWM (0-255)]

Example
M420 R255 E255 B255

Set the color of your RGB LEDs that are connected to PWM-enabled pins. Note, the Green color is controlled by the <code>E</code> value instead of the G value due to the G code being a primary code that cannot be overridden.

In Marlin <code>M420</code> is Enable/Disable Mesh Leveling (with current values) S1=enable S0=disable

M420: Leveling On/Off/Fade (Marlin)

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 ??? ???

Enable/Disable Bed Leveling (using the current stored grid or mesh).

Usage
<code>M420 S[bool] Z[float]</code>
Examples
M420 S1  ; Enable compensation using current grid/mesh
M420 Z10 ; Gradually reduce compensation until Z=10

Marlin 1.1.0 adds the <code>Z</code> parameter to set the "fade" height. This requires the <code>ENABLE_LEVELING_FADE_HEIGHT</code> option.

When the <code>Z</code> fade height value is set non-zero, bed compensation will gradually reduce up to the given height, and cease completely above that height.

M421: Set a Mesh Bed Leveling Z coordinate

Set a single Z coordinate in the Mesh or Bilinear Leveling grid. Requires <code>MESH_BED_LEVELING</code> or <code>AUTO_BED_LEVELING_BILINEAR</code>.

Usage
<code>M421 X[index] Y[index] Z[float]</code>

M450: Report Printer Mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Usage
<code>M450</code>
Example
> M450
> PrinterMode:FFF

Printers can be used for different task by exchanging the toolhead. Depending on the tool, a different behavior of some commands can be expected. This command reports the current working mode. Possible answers are:

PrinterMode:FFF
PrinterMode:Laser
PrinterMode:CNC

M451: Select FFF Printer Mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Usage
<code>M451</code>
Example
> M451
> PrinterMode:FFF

Switches to FFF mode for filament printing.

M452: Select Laser Printer Mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Usage
<code>M452</code>
Example
> M452
> PrinterMode:Laser

Switches to laser mode. This mode enables handling of a laser pin and makes sure that the laser is only activated during <code>G1</code> moves if laser was enabled or E is increasing. <code>G0</code> moves should never enable the laser. <code>M3</code>/<code>M5</code> can be used to enable/disable the laser for moves.

M453: Select CNC Printer Mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Usage
<code>M453</code>
Example
> M453
> PrinterMode:CNC

Switches to CNC mode. In this mode <code>M3</code>/<code>M4</code>/<code>M5</code> control the pins defined for the milling device.

M460: Define temperature range for thermistor-controlled fan

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Usage
<code>M460 X[minTemp] Y[maxTemp]</code>
Example
M460 X50 Y60

If the firmware has a thermistor controlled fan defined, you can set at which temperature the fan starts and from which temperature on it should run with maximum speed.

M500: Store parameters in EEPROM

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No ??? No ??? ???
Example
M500

Save current parameters to EEPROM.

In Redeem any parameters set through G/M-codes which is different than what is read from the config files, are stored back to the local config. For instance setting stepper current and microstepping through <code>M906</code> and <code>M907</code> followed by <code>M500</code> will update /etc/redeem/local.cfg.

M501: Read parameters from EEPROM

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No ??? No ??? ???
Parameters
<code>Snnn</code> Enable auto-save (only RepRapFirmware)
Example
M501

Set the active parameters to those stored in the EEPROM. This is useful to revert parameters after experimenting with them.

RepRapFirmware versions prior to 1.17 allows "S1" to be passed, which forces parameters to be automatically saved to EEPROM when they are changed.

In RepRapFirmware 1.17 and later, the parameters are saved in file sys/config-override.g on the SD card.

M502: Revert to the default "factory settings."

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No ??? No ??? ???
Example
M502

This command resets all tunable parameters to their default values, as set in the firmware. This doesn't reset any parameters stored in the EEPROM, so it must be followed with <code>M500</code> if you want to do that.

M503: Print settings

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? ??? ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? Yes No No No ??? No ??? ???
Example
M503

This command asks the firmware to reply with the current print settings stored in EEPROM. The reply output includes the G-Code commands to produce each setting. For example, the Steps Per Unit values are displayed as an <code>M92</code> command.

RepRapFirmware outputs the content of the configuration file, but note that it may be truncated if it is too long.

M530: Enable printing mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M530 S1 L270

This command tells the firmware that a print has started (<code>S1</code>) or ended (<code>S0</code>). The <code>L</code> parameter sets the number of layers. <code>L0</code> denotes unknown layer count. This enables the firmware to switch into a special print display mode to show print progress. Firmware should indicate the presence of this feature by responding to <code>M115</code> with an additional line:

Cap:PROGRESS:1

M531: Set print name

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M531 Demo Model

Sets the name of the currently printed object. Should follow <code>M530 S1</code> for correct display.

M532: Set print progress

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? Yes ??? ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M532 X23.7 L56

Sets the print progress (X = 0..100) and currently printed layer (L). Should be send every 0.1% progress change on every layer change.

M540: Enable/Disable "Stop SD Print on Endstop Hit"

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 ??? ???
Parameters
<code>Snnn</code> state, S1=enable, S0=disable
Example
M540 S1

M540: Set MAC address

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> The MAC address
Examples
M540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xED
M540 PDE:AD:BE:EF:CA:FE

Sets the MAC address of the RepRap. This should be done before any other network commands. The MAC address is six one-byte hexadecimal numbers separated by colons. The 0x prefix is optional in later firmware revisions.

All devices running on the same network shall all have different MAC addresses. For your printers, changing the last digit is sufficient.

M550: Set Name

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Machine name
Example
M550 PGodzilla

Sets the name of the RepRap to (in this case) Godzilla. The name can be any string of printable characters except ';', which still means start comment.

M551: Set Password

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Password
Example
M551 Pmy-very-secret-word

On machines that need a password to activate them, set that password. The code 'P' is not part of the password. Note that as this is sent in clear it does not (nor is it intended to) offer a very high level of security. But on machines that are (say) on a network, it prevents idle messing about by the unauthorised. The password can contain any printable characters except ';', which still means start comment.

Note for RepRapFirmware: If the specified password differs from the default one (i.e. reprap), the user will be asked to enter it when a connection is established via HTTP or Telnet. For FTP, the password must always be passed explicitly.

M552: Set IP address, enable/disable network interface

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> IP address, 0.0.0.0 means acquire an IP address using DHCP
<code>Snnn</code> (optional) 0 = disable networking, 1 = enable networking as a client, 2 = enable networking as an access point (WiFi-enabled electronics only)
<code>Rnnn</code> (optional, RepRapFirmware 1.17 and earlier only) HTTP port, default 80
Example
M552 P192.168.1.14

Sets the IP address of the machine to (in this case) 192.168.1.14. If the <code>S</code> parameter is not present then the enable/disable state of the network interface is not changed.

In RepRapFirmware 1.18 and later the HTTP port address is set using the <code>M586</code> command, so the <code>R</code> parameter of this command is no longer supported.

M552 with no parameters reports the current network state and IP address.

M553: Set Netmask

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Net mask
Example
M553 P255.255.255.0

Sets the network mask of the RepRap machine to (in this case) 255.255.255.0. A restart may be required before the new network mask is used. If no 'P' field is specified, this echoes the existing network mask configured.

Recent RepRapFirmware versions allow the IP configuration to be changed without a restart.

M554: Set Gateway

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Gateway
Example
M554 P192.168.1.1

Sets the Gateway IP address of the RepRap machine to (in this case) 192.168.1.1. A restart may be required before the new gateway IP address is used. If no 'P' field is specified, this echoes the existing Gateway IP address configured.

Recent RepRapFirmware versions allow the IP configuration to be changed without a restart.

M555: Set compatibility

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Emulation type
Example
M555 P1

For firmware that can do it, the firmware is set to a mode where its input and (especially) output behaves exactly like other established firmware. The value of the 'P' argument is:

P value Firmware
0 Native (i.e. whatever the firmware actually is)
1 RepRap_Firmware
2 Marlin
3 Teacup
4 Sprinter
5 Repetier

M556: Axis compensation

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Snnn</code> Height of the measured distances
<code>Xnnn</code> Deviation in X direction
<code>Ynnn</code> Deviation in Y direction
<code>Znnn</code> Deviation in Z direction
Example
M556 S100 X0.7 Y-0.2 Z0.6
Image denoting how to determine the S parameter for Gcode M556

Though with care and adjustment a RepRap can be set up with its axes at right-angles to each other within the accuracy of the machine, who wants to bother with care and adjustment when the problem can be solved by software? This tells software the tangents of the angles between the axes of the machine obtained by printing then measuring a test part. The <code>S</code> parameter (100 here) is the length of a triangle along each axis in mm. The X, Y and Z figures are the number of millimeters of the short side of the triangle that represents how out of true a pair of axes is. The X figure is the error between X and Y, the Y figure is the error between Y and Z, and the Z figure is the error between X and Z. Positive values indicate that the angle between the axis pair is obtuse, negative acute.

M557: Set Z probe point or define probing grid

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters to define <code>G32</code> probe points (Cartesian/CoreXY printers only, deprecated in RepRapFirmware)
<code>Pnnn</code> Probe point number
<code>Xnnn</code> X coordinate
<code>Ynnn</code> Y coordinate
Example
M557 P1 X30 Y40.5
Parameters to define <code>G29</code> probe grid (all values in mm)
<code>Xaaa:bbb</code> Minimum and maximum X coordinates to probe
<code>Yaaa:bbb</code> Minimum and maximum Y coordinates to probe
<code>R</code> Radius to probe
<code>S</code> Probe point spacing
Examples
M557 X0:200 Y0:220 S20
M557 R150 S15

Set the points at which the bed will be probed to compensate for its plane being slightly out of horizontal.

The first form defines the points for for <code>G32</code> bed probing. The <code>P</code> value is the index of the point (indices start at 0) and the <code>X</code> and <code>Y</code> values are the position to move extruder 0 to to probe the bed. An implementation should allow a minimum of three points (P0, P1 and P2). This just records the point coordinates; it does not actually do the probing. See G32. Defining the probe points in this way is deprecated in RepRapFirmware, you should define them in a bed.g file instead.

The second form defines the grid for <code>G29</code> bed probing. For Cartesian printers, specify minimum and maximum <code>X</code> and <code>Y</code> values to probe and the probing interval. For Delta printers, specify the probing radius. If you define both, the probing area will be the intersection of the rectangular area and the circle. There is a firmware-dependent maximum number of probe points supported, which may be as low as 100.

M558: Set Z probe type

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Z probe type
<code>Xnnn</code> If nonzero, use probe for homing X axis
<code>Ynnn</code> If nonzero, use probe for homing Y axis
<code>Znnn</code> If nonzero, use probe for homing Z axis
<code>Fnnn</code> Feed rate (i.e. probing speed, mm/min)
<code>Hnnn</code> Dive height (mm)
<code>Innn</code> Invert (I1) or do not invert (I0) the Z probe reading (RepRapFirmware 1.16 and later)
<code>Rnnn</code> Z probe recovery time after triggering, default zero (seconds) (RepRapFirmware 1.17 and later)1
<code>Tnnn</code> Travel speed to and between probe points (mm/min)
<code>Snnn</code> Extra parameter for experimentation
Example
M558 P1 X0 Y0 Z1 F500 T5000 H3

A Z probe may be a switch, an IR proximity sensor, or some other device. This selects which to use. P0 indicates that no Z probe is present. P1 gives an unmodulated IR probe, or any other probe type that emulates an unmodulated IR probe (probe output is an analog signal that rises with decreasing nozzle height above the bed). If there is a control signal to the probe, it is driven high when the probe type is P1. P2 specifies a modulated IR probe, where the modulation is commanded directly by the main board firmware using the control signal to the probe. P3 selects an alternative Z probe by driving the control signal to the probe low. P4 selects a switch for bed probing (on the Duet, this must be connected to the E0 endstop pins). P5 (from RepRapFirmware 1.14) selects a switch (normally closed) for bed probing between In and Gnd pins of the Z-probe connector (Duet 0.8.5 and Duet WiFi). P6 is as P4 but the switch is connected to and alternative connector (on the Duet series, the E1 endstop connector).

The <code>X</code>, <code>Y</code> and <code>Z</code> parameters specify whether each axis uses the Z probe for homing or not. If the parameter is nonzero, the Z probe is used for homing that axis. If the parameter is zero, the endstop switch for that axis is used for homing instead. See also <code>G31</code> and <code>G32</code>.

Notes

1This parameter used to specify the Z probe channel in RepRapFirmware, but it has been superceded by the functionality of "M115 Px". With older firmware versions and a Duet 0.7/0.85, this parameter should be 1.

M559: Upload configuration file

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M559

If the RepRap supports it, this uploads a file that is run on re-boot to configure the machine. This file usually is a special G Code file. After sending <code>M559</code>, the file should be sent, ending with an <code>M29</code> (q.v.).

M560: Upload web page file

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M560
For RepRaps that have web support and that can be driven by a web browser, this uploads the file that is the control page for the RepRap. After sending <code>M560</code> the file (usually an HTML file) should be sent, terminated by the string
<!-- **EoF** -->
. Clearly that string cannot exist in the body of the file, but can be put on the end to facilitate this process. This should not be too serious a restriction...


M561: Set Identity Transform

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???
Example
M561

This cancels any bed-plane fitting as the result of probing (or anything else) and returns the machine to moving in the user's coordinate system.

M562: Reset temperature fault

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???
Parameters
<code>Pnnn</code> Heater number
Example
M562 P2

Reset a temperature fault on heater/sensor 2. If the RepRap has switched off and locked a heater because it has detected a fault, this will reset the fault condition and allow you to use the heater again. Obviously to be used with caution. If the fault persists it will lock out again after you have issued this command. P0 is the bed; P1 the first extruder, and so on.

M563: Define or remove a tool

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Tool number
<code>Dnnn</code> Extruder drive(s)
<code>Hnnn</code> Heater(s)
<code>Fnnn</code> Fan(s) to map fan 0 to (RepRapFirmware 1.16 and later)
<code>Xnnn</code> Axis or axes to map X movement to (RepRapFirmware 1.16 and later)
Examples
M563 P0 D0:2:3 H1:3         ; create a tool using extruder drives 0, 2 and 3 and heaters 1 and 3
M563 P1 D1 H2 X3            ; create a tool using extruder drive 1 and heater 2 with X movement mapped to the U axis
M563 P2 D0:1 H1:2 X0:3 F0:2 ; create a tool using extruder drives 0 and 1, heaters 1 and 2,
                            ; with X movement mapped to both X and U axes and fan 0 mapped to fan 0 and fan 2

Tools are usually (though not necessarily) extruders. The 'P' field specifies the tool number. Tool numbers can have any positive integer value and 0. The 'D' field specifies the drive(s) used by the tool - in the first example drives 0, 2 and 3. Drive 0 is the first drive in the machine after the movement drives (usually X, Y and Z). If there is no 'D' field the tool has no drives. The 'H' field specifies the tool's heaters - in the first example heaters 1 and 3. Heater 0 is usually the hot bed (if any) so the first extruder heater is usually 1. If there is no H field the tool has no heaters.

Tools are driven using multiple values in the 'E' field of <code>G1</code> commands, each controlling the corresponding drive in the 'D' field above, as follows:

G1 X90.6 Y13.8 E2.24:2.24:15.89
G1 X70.6 E0:0:42.4

The first line moves straight to the point (90.6, 13.8) extruding a total of 2.24mm of filament from both drives 0 and 2 and 15.98mm of filament from drive 3. The second line moves back 20mm in X extruding 42.4mm of filament from drive 3.

Alternatively, if the slicer does not support generating <code>G1</code> commands with multiple values for the extrusion amount, the <code>M567</code> command can be used to define a tool mix ratio.

Normally an <code>M563</code> command is immediately followed by a <code>G10</code> command to set the tool's offsets and temperatures.

It is permissible for different tools to share some (or all) of their drives and heaters. So, for example, you can define two tools with identical hardware, but that just operate at different temperatures.

The X mapping option is used to create tools on machines with multiple independent X carriages. The additional carriages are set up as axes U, V etc. (see <code>M584</code>) and the X mapping option in <code>M563</code> defines which carriage or carriages are used.

If you use the <code>M563</code> command with a <code>P</code> value for a tool that has already been defined, that tool is redefined using the new values you provide.

RepRapFirmware supports an additional form of the <code>M563</code> command. The command:

M563 S1

means add 1 (the value of the <code>S</code> parameter) to all tool numbers found in the remainder of the current input stream (e.g. the current file if the command is read from a file on the SD card), or until a new <code>M563</code> command of this form is executed. The purpose of this is to provide compatibility between systems in which tool numbers start at 1, and programs such as slic3r that assume tools are numbered from zero.

Recent versions of RepRapFirmware allow the deletion of existing tools if <code>M563</code> is called in this way:

M563 P1 D-1 H-1

M564: Limit axes

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Snnn</code> Limit movement within axis boundaries
Example
M564 S0

Allow moves outside the print volume, or not. If the <code>S</code> parameter is 0, then you can send G codes to drive the RepRap outside its normal working volume, and it will attempt to do so. User beware... If you set the <code>S</code> parameter to 1 then the RepRap will not think outside the box. The default behaviour is S = 1.

M565: Set Z probe offset

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No see G31 ??? ??? ??? No Yes ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Example
M565 X3 Y4.5 Z-2.37

Set the offset from the extruder tip to the probe position. The <code>X</code>, <code>Y</code>, and <code>Z</code> values are the delta between the extruder and the actual trigger position of the probe. If the probe trigger point is below the extruder (typical) the Z offset will be negative. This just records the point offset; it does not actually do the probing. See <code>G32</code>.

M566: Set allowable instantaneous speed change

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Xnnn</code> Maximum instantaneous speed change of the X axis (mm/min)
<code>Ynnn</code> Maximum instantaneous speed change of the Y axis
<code>Znnn</code> Maximum instantaneous speed change of the Z axis
<code>Ennn</code> Maximum instantaneous speed change of the extruder drives
Example
M566 X20 Y20 Z2 E10

Sets the maximum allowable speed change (sometimes called 'jerk speed') of each motor when changing direction.

The model files and gcode files used by repraps generally render circles and other curves shapes as a sequence of straight line segments. If the motors were not allowed any instantaneous speed change, they would have to come to a stop at the junction between each pair of line segments. By allowing a certain amount of instantaneous speed change, printing speed can be maintained when the angle between the two line segments is small enough.

If you set these <code>X</code> and <code>Y</code> values too low, then the printer will be slow at printing curves. If they are too high then the printer may be noisy when cornering and you may suffer ringing and other print artefacts, or even missed steps.

On very old versions of RepRapFirmware (prior to 1.09), these were also the minimum speeds of each axis.

M567: Set tool mix ratios

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Tool number
<code>Ennn</code> Mix ratios
Example
M567 P2 E0.1:0.2:0.1:0.6

This example sets the mix ratio for tool 2 (the <code>P</code> value). When mixing is then turned on (see <code>M568</code>), only single <code>E</code> values need to be sent on a <code>G1</code> command (any extra <code>E</code> values will be ignored, but are not illegal):

G1 X20 E1.3

This will move to X=20 extruding a total length of filament of 1.3mm. The first drive of tool 2 will extrude 0.1*1.3mm, the second 0.2*1.3mm and so on. The ratios don't have to add up to 1.0 - the calculation done is as just described. But it is best if they do.

See also <code>M568</code>.

M568: Turn off/on tool mix ratios

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Tool number
<code>Snnn</code> Whether mix ratios should be activated
Example
M568 P2 S0

Turn on/off automatic mix ratios for tool 2. If the <code>S</code> parameter is 0 mixing is turned off; if it is non-zero it is turned on.

After turning off command G1 instructions must send as many <code>E</code> values as the tool has drives:

G1 X20 E0.2:0.4:0.166:0.3

The off state is the default.

M569: Set axis direction and enable values

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Motor driver number
<code>Snnn</code> Direction of movement of the motor(s) attached to this driver: 0 = backwards, 1 = forwards
<code>Rnnn</code> Driver enable polarity: 0 = active low, 1 = active high (default 0)
<code>Tnnn</code> Minimum driver step pulse width and interval in microseconds1
Example
M569 P0 S1

Set the control value for the drive specified by P that sends it forwards to the given value in the S field. After sending the example, sending a 1 to X (drive 0) will make it go forwards, sending a 0 will make it go backwards. Obviously to be used with extreme caution...

Notes

1RepRapFirmware 1.14 and later support the <code>T</code> parameter, to allow the step pulse width and interval to be lengthened for those drivers that need it. If no <code>T</code> parameter is given, then the step pulse width and interval are guaranteed to be suitable for the on-board drivers. Currently, RepRapFirmware only remembers the highest <code>T</code> parameter seen in any M569 command, and applies that value to all drivers for which any nonzero <code>T</code> parameter was specified.

Some versions of RepRapFirmware prior to 1.14 also provide <code>X</code>, <code>Y</code>, <code>Z</code> and <code>E</code> parameters to allow the mapping from axes and extruders to stepper driver numbers to be changed. From 1.14 onward, this functionality is provided by M584 instead.

M570: Configure heater fault detection

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters for RepRapFirmware 1.14 and earlier
<code>Snnn</code> Heater timeout (in seconds)
Example
M570 S120

After a heater has been switched on, wait 120 seconds for it to get close to the set temperature. If it takes longer than this, raise a heater fault.

Parameters for RepRapFirmware 1.15e and later
<code>Hnnn</code> Heater number
<code>Pnnn</code> Time in seconds for which a temperature anomaly must persist on this heater before raising a heater fault (default 5 seconds)
<code>Tnnn</code> Permitted temperature excursion from the setpoint for this heater (default 10C)
Example
M570 H1 P4 T15

Warning! Heating fault detection is provided to reduce the risk of starting a fire if a dangerous fault occurs, for example if the heater cartridge or thermistor falls out of the heater block. You should not increase the detection time or permitted temperature excursion without good reason, because doing so will reduce the protection.

M571: Set output on extrude

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Snnn</code> Output value
<code>Fnnn</code> Output PWM frequency (RepRapFirmware 1.17 and later)
<code>Pnnn</code> Logical pin number (RepRapFirmware 1.17 and later), defaults to the FAN0 output until <code>M571</code> with a <code>P</code> parameter has been seen
Example
M571 P3 F200
M571 S0.5

This turns the controlled pin output on whenever extrusion is being done, and turns it off when the extrusion is finished. The output could control a fan or a stirrer or anything else that needs to work just when extrusion is happening. It also can be used to control a laser beam. The <code>S</code> parameter sets the value of the PWM to the output. 0.0 is off; 1.0 is fully on.

In RepRapFirmware 1.17 and later you can use the <code>P</code> parameter to change the pin used and you can also set the PWM frequency. Pin numbers are the same as in the M42 and <code>M280</code> commands. The pin you specify must not be in use for anything else, so if it is normally used as a heater you must disable the heater first using <code>M307</code>, or if it is used for a fan you must disable the fan using M106 with the I-1 parameter.

M572: Set or report extruder pressure advance

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No dc42, ch, dn ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Dnnn</code> Extruder number
<code>Snnn</code> Pressure advance amount (in seconds)
Example
M572 D0 S0.1

This sets the pressure advance coefficient (<code>S</code> parameter) for the specified extruder (<code>D</code> parameter). Supported by RepRapFirmware-dc42, -ch and -dn.

Pressure advance causes the extruder drive position to be advanced or retarded during printing moves by an additional amount proportional to the rate of extrusion. At the end of a move when the extrusion rate is decreasing, this may result in the extruder drive moving backwards (i.e. retracting). Therefore, if you enable this feature, you may need to reduce the amount of retraction you use in your slicing program to avoid over-retraction.

With Bowden extruders, an <code>S</code> value between 0.1 and 0.2 usually gives the best print quality.

Older versions of RepRapFirmware used the <code>P</code> parameter to specify the drive number, instead of using D to specify the extruder number.

M573: Report heater PWM

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Heater number
Example
M573 P1

This gives a running average (usually taken over about five seconds) of the PWM to the heater specified by the P field. If you know the voltage of the supply and the resistance of the heater this allows you to work out the power going to the heater. Scale: 0 to 1.

M574: Set endstop configuration

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Xnnn</code> Switch type for X axis
<code>Ynnn</code> Switch type for Y axis
<code>Znnn</code> Switch type for Z axis
<code>E</code> Select extruder endstops to define active high or low (RepRapFirmware 1.16 and earlier only)
<code>Snnn</code> Logic level
Example
M574 X1 Y2 Z0 S1  ; X endstop at low end, Y endstop at high end, no Z endstop, all active high

This defines the type of endstop switch or opto sensor that the printer has for each axis: 0 = none, 1 = low end, 2 = high end. The optional <code>S</code> parameter defines whether the endstop input is active high (S1, the default) or low (S0). A normally-closed endstop switch wired in the usual way produces an active high output (S1).

This is intended for use with boards that provide a single endstop input for each axis that may be used for either a high or a low end endstop, such as the Duet. On delta printers, the <code>XYZ</code> parameters refer to the towers and the endstops should normally all be high end (i.e. at the top of the towers).

In RepRapFirmware 1.16 and earlier, the M574 command with <code>E</code> parameter is used to specify whether a Z probe connected to the E0 endstop input produces an active high (S1) or active low (S0) output. In RepRapFirmware 1.17 and later, use the <code>I</code> parameter of the M558 command instead.

M575: Set serial comms parameters

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Serial channel number
<code>Bnnn</code> Baud rate
<code>Snnn</code> Whether checksums should be used
Example
M575 P1 B57600 S1

This sets the communications parameters of the serial comms channel specified by the <code>P</code> parameter. <code>P0</code> specifies the main serial interface (typically a USB port, or serial-over-USB), while <code>P1</code> specifies an auxiliary serial port (for example, the port used to connect a PanelDue). The <code>B</code> parameter is the required baud rate (this parameter is typically ignored if the port is a true USB port). The <code>S</code> parameter is a bitmap of features. The lowest bit, if set, specifies that only commands that include a valid checksum should be accepted from this comms channel.

M577: Wait until endstop is triggered

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Snnn</code> Desired endstop level
<code>Xnnn</code> Select X axis endstop
<code>Ynnn</code> Select Y axis endstop
<code>Znnn</code> Select Z axis endstop
<code>Ennn</code> Select extruder drive endstop
Example
M577 E0 S1

Wait for an endstop switch to be pressed. The example above will wait until the first extruder endstop is triggered.

The following trigger types may be used using the 'S' parameter:

0: Endstop not hit 1: Low endstop hit 2: High endstop hit 3: Near endstop (only Z probe)

M578: Fire inkjet bits

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Pnnn</code> Inkjet head number
<code>Snnn</code> Bit pattern
Example
M578 P3 S5

This fires inkjet head 3 (the P field) using the bit pattern specified by the S field. The example shown would fire bits 101. If the <code>P</code> parameter is ommitted inkjet 0 is assumed.

This is a version of the M700 command used by the Inkshield, but unfortunately M700 is already taken so cannot be used for that in the standard.

M579: Scale Cartesian axes

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Xnnn</code> Scale factor for X axis
<code>Ynnn</code> Scale factor for Y axis
<code>Znnn</code> Scale factor for Z axis
Example
M579 X1.0127 Y0.998

On a Cartesian RepRap you can get prints exactly the right size by tweaking the axis steps/mm using the M92 G Code above. But this does not work so easily for Delta and other RepRaps for which there is cross-talk between the axes. This command allows you to adjust the X, Y, and Z axis scales directly. So, if you print a part for which the Y length should be 100mm and measure it and find that it is 100.3mm long then you set Y0.997 (= 100/100.3).

M580: Select Roland

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Rnnn</code> Whether Roland mode should be activated
<code>Pnnn</code> Initial text to send to the Roland controller
Example
M580 R1 PVS4;!VZ2;!MC1;

This is not really anything to do with RepRap, but it is convenient. The little Roland mills are very widely available in hackerspaces and maker groups, but annoyingly they don't speak G Codes. As all RepRap firmware includes a G-Code interpreter, it is often easy to add functions to convert G Codes to Roland RML language. M580 selects a Roland device for output if the R field is 1, and returns to native mode if the <code>R</code> field is 0. The optional <code>P</code> string is sent to the Roland if <code>R</code> is 1. It is permissible to call this repeatedly with <code>R</code> set to 1 and different strings in the <code>P</code> field to communicate directly with a Roland.

M581: Configure external trigger

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Tnn</code> Logical trigger number to associate the endstop input(s) with, from zero up to a firmware-specific maximum (e.g. 9 for RepRapFirmware)
<code>X, Y, Z, E</code> Selects endstop input(s) to monitor
<code>P</code> Reserved, may be used in future to allow general I/O pins to cause triggers
<code>S</code> Whether trigger occurs on a rising edge of that input (S1, default), falling edge (S0), or ignores that input (S-1). By default, all triggers ignore all inputs.
<code>C</code> Condition: whether to trigger at any time (C0, default) or only when printing a file from SD card (C1)
Example
M581 E1:2 S1 T2 C1   ; invoke trigger 2 when a rising edge is detected on the E1 or E2 endstop input and a file is being printed from SD card

When <code>M581</code> is executed, if the <code>T</code> parameter is present but the other parameters are omitted, the trigger inputs and edge polarities for that trigger number are reported. Otherwise, the specified inputs and their polarities are added to the conditions that cause that trigger. Using <code>S-1</code> with no <code>X</code>, <code>Y</code>, <code>Z</code> or <code>E</code> parameters sets the trigger back to ignoring all inputs.

In RepRapFirmware, trigger number 0 causes an emergency stop as if <code>M112</code> had been received. Trigger number 1 causes the print to be paused as if <code>M25</code> had been received. Any trigger number # greater then 1 causes the macro file <code>sys/trigger#.g</code> to be executed. Polling for further trigger conditions is suspended until the trigger macro file has been completed. RepRapFirmware does not wait for all queued moves to be completed before executing the macro, so you may wish to use the <code>M400</code> command at the start of your macro file. If several triggers are pending, the one with the lowest trigger number takes priority.

M582: Check external trigger

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
T Trigger number to poll
Example
M582 T2 ; check levels of inputs that give rise to trigger #2

Triggers set up by the M581 command are normally activated only when the specified inputs change state. This command provides a way of causing the trigger to be executed if the input is at a certain level. For each of the inputs associated with the trigger, the trigger condition will be checked as if the input had just changed from the opposite state to the current state.

For example, if you use M581 to support an out-of-filament sensor, then M582 allows you to check for out-of-filament just before starting a print.

M583: Wait for pin

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No {soon} ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Pnnn</code> Pin number
<code>Sn</code> State to wait for (0 or 1) or analog tolerance
<code>Rnnn</code> Analog value to wait for (between 0.0 and 1.0)
Example
M583 P5 S0 ; Wait for Pin 5 to become 0

This allows you, for example, to turn on a DC motor (see the <code>M42</code> command) then wait until a switch connected to Pin <code>Pnnn</code> gives the value <code>Sn</code>.

If the <code>R</code> field is present, then the system waits until the value on analog <code>Pnnn</code> is reached. In this case the <code>S</code> value is used as a tolerance, so <code>M583 P8 R0.7 S0.01</code> would wait until the analog value on Pin 8 was between 0.69 and 0.71.

M584: Set drive mapping

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Version 1.14 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Xnnn</code> Driver number(s) for X motor(s)
<code>Ynnn</code> Driver number(s) for Y motor(s)
<code>Znnn</code> Driver number(s) for Z motor(s)
<code>U,V,Wnnn</code> Driver number(s) for additional axes <code>U</code>, <code>V</code>, and <code>W</code> (RepRapFirmware 1.16 and later)
<code>Ennn</code> Driver number(s) for E motor(s)
<code>Snnn</code> Special functions (to be defined)
Example
M584 X0 Y1 Z2:3 E4:5:6 ; Driver 0 controls the X motor, 1 controls Y, 2 and 3 control Z motors, 4 and 5 control E motors

Assigning a drive using <code>M584</code> does not remove its old assignment. Therefore, if you assign a drive that defaults to being an extruder drive, you should also assign the extruder drives explicitly as in the above example. Failure to do so may result in unexpected behaviour.

You can use <code>M584</code> to create additional axes - for example, to represent additional carriages on a machine with multiple independent X carriages. You should not create axis <code>W</code> unless you also create axis <code>V</code>, and you should not create axis <code>V</code> unless you also create axis <code>U</code>.

On the Duet WiFi and Duet Ethernet, if you configure multiple drivers for an axis, either all of them must be TMC2660 drivers on the Duet or a Duet expansion board, or none of them must be. This is to facilitate dynamic microstepping and other features of the TMC2660.

M585: Probe Tool

In machines with a tool probe this probes the currently selected tool against it and corrects the offsets set by the G10 command (q.v.).

Parameter must be only one of
<code>Xnnn</code>
<code>Y-nnn</code>
<code>Znnn</code>

Where the absolute value of <code>nnn</code> is the radius of the tool plus the radius of the probe in that direction. So <code>M585 X1.5</code> will set the X offset of a 1mm diameter tool against a 2mm diameter probe, etc. If the value of <code>nnn</code> is positive the tool is moved in the positive direction towards the probe until it touches. If it is negative, the tool moves the other way.

So the process should be:

Set the values as closely as known in the <code>G10</code> command.
Move to a position slightly offset from the probe then execute <code>M585</code>s in X, Y and Z in the tool selection macro to set them precisely.

After this, the <code>G10</code> command on its own can be used to report the values.

M586: Configure network protocols

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.18 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Pnn</code> Protocol: 0 = HTTP or HTTPS, 1 = FTP or SFTP, 2 = Telnet or SSH (which of the two choices depends on the <code>T</code> parameter)
<code>Snn</code> 0 = disable this protocol, 1 = enable this protocol
<code>Rnn</code> TCP port number to use for the specified protocol. Ignored unless S = 1. If this parameter is not provided then the default port for that protocol and TLS setting is used.
<code>Tnn</code> 0 = don't use TLS, 1 = use TLS. Ignored unless <code>S</code> = 1. If this parameter is not provided, then TLS will be used if the firmware supports it and a security certificate has been configured. If <code>T1</code> is given but the firmware does not support TLS or no certificate is available, then the protocol will not be enabled and an error message will be returned.

M586 with no <code>S</code> parameter reports the current support for the available protocols.

RepRapFirmware 1.18 and later enable only HTTP (or HTTPS if supported) protocol by default. If you wish to enable FTP and/or Telnet, enable them using this command once or twice in config.g.

M587: Store WiFi host network in list, or list stored networks

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.19 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Sccc</code> Network SSID
<code>Pccc</code> Network password
<code>Inn.nn.nn.nn</code> (optional) IP address to use when connected to this network. If zero or not specified then an IP address will be acquired via DHCP.
<code>Jnn.nn.nn.nn</code> (optional) Gateway IP address to use when connected to this network.
<code>Knn.nn.nn.nn</code> (optional) Netmask to use when connected to this network

If a password or SSID includes space or semicolon characters then it must be enclosed in double quotation marks. For security, do not use this command in the config.g file, or if you do then remove it after running it once so that the network password is not visible in the file.

<code>M587</code> with no parameters lists all stored SSIDs, but not the stored passwords.

M588: Forget WiFi host network

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.19 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Sccc</code> SSID to remove from the networks list

The specified SSID will be removed from the networks list and the associated password cleared out of EEPROM. If the SSID is given as * then all stored networks will be forgotten.

M589: Configure access point parameters

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.19 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? No
Parameters
<code>Sccc</code> The SSID that the WiFi interface should use when it is commanded to run as an access point
<code>Pccc</code> The WiFi password
<code>Inn.nn.nn.nn</code> The IP address to use

Note: WPA2 security will be used by default.

M590: Report current tool type and index

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

Report the current tool type, which may be "Extruder," "Picker," "Laser," "Foam Cutter," "Milling," or any others implemented by the machine. Also report the tool index, such as "0x01" for the second extruder.

Example
> M590
> echo: Extruder 0x00

M600: Set line cross section

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No Yes ??? No ??? ???
Example
M600 P0.061

Sets the cross section for a line to extrude in velocity extrusion mode. When the extruder is enabled and movement is executed the amount of extruded filament will be calculated to match the specified line cross section.

M600: Filament change pause

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Not needed, use macro files ??? ??? ??? ??? Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

Pause for filament change.

Parameters
<code>X[pos]</code>
<code>Y[pos]</code>
<code>Z[relative lift]</code>
<code>E[initial retract</code>
<code>L[later retract distance for removal]</code>
Example
M600

In SmoothieWare:

The variable "after_suspend_gcode" is run after <code>M600</code>.

For example:

after_suspend_gcode G91_G0E-5_G0Z10_G90_G0X-50Y-50 # gcode to run after suspend, retract then get head out of way

M605: Set dual x-carriage movement mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Use M563 ??? ??? ??? ??? No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

Set Dual X-Carriage movement mode.

Parameters
<code>S[mode]</code> Mode (see below)
<code>X[duplication x-offset]</code> Optional X offset for Mode 2
<code>R[duplication temp offset]</code> Optional temperature difference for Mode 2
Example
M605 S1 ; Set mode to auto-park

<code>M605 S0</code>: Full control mode. The slicer has full control over x-carriage movement <code>M605 S1</code>: Auto-park mode. The inactive head will auto park/unpark without slicer involvement <code>M605 S2 [Xnnn] [Rmmm]</code>: Duplication mode. The second extruder will duplicate the first with nnn millimeters x-offset and an optional differential hotend temperature of <code>mmm</code> degrees. E.g., with "<code>M605 S2 X100 R2</code>" the second extruder will duplicate the first with a spacing of 100mm in the x direction and 2 degrees hotter.

M665: Set delta configuration

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Lnnn</code> Diagonal rod length
<code>Rnnn</code> Delta radius
<code>Snnn</code> Segments per second1
<code>Bnnn</code> Safe probing radius2,3
<code>Hnnn</code> Delta height defined as nozzle height above the bed when homed after allowing for endstop corrections 2
<code>Xnnn</code> X tower position correction2,4
<code>Ynnn</code> Y tower position correction2,4
<code>Znnn</code> Z tower position correction2,4
Examples
M665 L250 R160 S200 ; (Marlin)
M665 L250 R160 B80 H240 X0 Y0 Z0 ; (RepRapFirmware and Marlin 1.1.0)

Set the delta calibration variables. (See the discussion page for notes on this implementation.)

Notes

1Only supported on Marlin.

2Only supported in RepRapFirmware and Marlin 1.1.0.

3 In Marlin 1.1.0 sets the radius on which the probe points are taken for the delta auto calibration routine G33 as well as for the manual LCD calibration menu.

4X, Y and Z tower angular offsets from the ideal (i.e. equilateral triangle) positions, in degrees, measured anti-clockwise looking down on the printer. In Marlin 1.1.0 X,Y and Z tower angular offsets will be rotated so the Z tower angular offset is zero.

M666: Set delta endstop adjustment

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Xnnn</code> X axis endstop adjustment
<code>Ynnn</code> Y axis endstop adjustment
<code>Znnn</code> Z axis endstop adjustment
<code>Annn</code> X bed tilt in percent1
<code>Bnnn</code> Y bed tilt in percent1
Example
M666 X-0.1 Y+0.2 Z0

Sets delta endstops adjustments.

In RepRapFirmware and Repetier, positive endstop adjustments move the head closer to the bed when it is near the corresponding tower. In Marlin and Smoothieware, negative endstop corrections move the head closer to the bed when it is near the corresponding tower.

In Marlin, only negative endstop corrections are allowed. From version 1.1.0 onward positive endstops are allowed to be entered but the endstops will be normalized to zero or negative and the residue will be subtracted from the delta height defined in M665.

In Repetier the endstop corrections are expressed in motor steps. In other firmwares they are expressed in mm.

1RepRapFirmware 1.16 and later.

M667: Select CoreXY mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Snnn</code> CoreXY mode
<code>Xnnn</code> X axis scale factor
<code>Ynnn</code> Y axis scale factor
<code>Znnn</code> Z axis scale factor
Example
M667 S1

<code>M667 S0</code> selects Cartesian mode (unless the printer is configured as a delta using the <code>M665</code> command). Forward motion of the X motor moves the head in the +X direction. Similarly for the Y motor and Y axis, and the Z motor and Z axis. This is the default state of the firmware on power up.

<code>M667 S1</code> selects CoreXY mode. Forward movement of the X motor moves the head in the +X and +Y directions. Forward movement of the Y motor moves the head in the -X and +Y directions.

<code>M667 S2</code> selects CoreXZ mode. Forward movement of the X motor moves the head in the +X and +Z directions. Forward movement of the Z motor moves the head in the -X and +Z directions.

<code>M667 S3</code> selects CoreYZ mode. Forward movement of the Y motor moves the head in the +Y and +Z directions. Forward movement of the Z motor moves the head in the -Y and +Z directions.

Additional parameters X, Y and Z may be given to specify factors to scale the motor movements by for the corresponding axes. For example, to specify a CoreXZ machine in which the Z axis moves 1/3 of the distance of the X axis for the same motor movement, use M667 S2 Z3. The default scaling factor after power up is 1.0 for all axes.

To change the motor directions, see the M569 command.

M668: Set Z-offset compensations polynomial

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No dc42-cmm ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

Polynomial compensation is an experimental method to compensate for geometric distortion of a delta machine Z-plane. After the bed is compensated with the set of G30 points, there remains error. This method fits a 6th degree polynomial with independent origins for each order to the residual error data (using a simulated annealing technique on the host). The polynomial is communicated and controlled through <code>M668</code>. Because the polynomial takes many floating point operations to compute each point, the firmware builds a grid of values, and used bi-linear interpolation to adjust the actual Z-axis offset error estimate.

For the polynomial used, 40 parameters are specified. The <code>I</code> parameter allows the coefficients to be loaded a few at a time, which limits the size of the G-code string. The index starts with 1, not with 0.

<code>M668 Ix S[list of values]</code> sets the polynomial parameters starting at index x, if index present and != 0.

<code>M668 R</code> recomputes the grid based on the current parameters.

<code>M668 P[0|1]</code> turns off or on the polynomial compensation.

Typical usage
M668 I1 S4.882E-17:0.0
M668 I3 ...
...
M668 R P1

Which sets the list, computes the interpolation grid, and then enables compensation.

M669: Set SCARA mode and arm parameters

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.19 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
Pnnn Proximal arm length (mm)
Dnnn Distal arm length (mm)
Annn:nnn Proximal arm joint movement minimum and maximum angles, in degrees antoclockwise seen from above relative to the X axis
Bnnn:nnn Proximal-to-distal arm joint movement minimum and maximum angles, in degrees anticlockwise seen from above relative to both arms in line
Cnnn Proximal-to-distal crosstalk factor. Indicates how much the proximal motor affects the proximal-to-distal arm angle. For example, a factor of zero means that movement of the proximal arm motor does not affect the proximal-to-distal arm angle; and a factor of -1.0 means that the when the proximal motor changes the proximal joint angle, the angle of the distal joint changes in the opposite direction so that the distal arm maintains its angle relative to the X axis.
Snnn Segments per second if smooth XY motion is approximated by means of segmentation
Lnnn Minimum segment length (mm) if smooth XY motion is approximated by means of segmentation
Examples
M669 P300 D250 A-100:100 B-130:130 S200 

Sets the firmware in SCARA mode with the specified arm parameters. The minimum and maximum arm angles are also the arm angles assumed by the firmware when the homing switches are triggered. The P, D, A and B parameters are mandatory. The F parameter defaults to zero, and the segmentation parameters default to firmware-dependent values.

M700: Level plate

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
bq No ??? ??? ??? No No ??? bq
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Example
M700

Script to adjust the plate level.

M701: Load filament

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
bq No ??? ??? ??? No No ??? bq
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

1 only in bq-Marlin Firmware

Example
M701

M702: Unload filament

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
bq No ??? ??? ??? No No ??? bq
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

1 only in bq-Marlin Firmware

Example
M702

M703: Get Board Type

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
bq No ??? ??? ??? No No ??? bq
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

1 only in bq-Marlin Firmware

Example
M703

M710: Erase the EEPROM and reset the board

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
bq see M999 ??? ??? ??? No No ??? bq
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

1 only in bq-Marlin Firmware

Example
M710

M750: Enable 3D scanner extension

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No coming soon ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Example
M750

This code may be used as an OEM extension to enable scanner functionality in the firmware. After a regular start of RepRapFirmware, the 3D scan extension is disabled by default, but if additional scanner components are attached, this code may be used to enable certain OEM functions.

M751: Register 3D scanner extension over USB

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No coming soon ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Example
M751

When a 3D scanner board is attached to the USB port, this code is used to turn on communication between the 3D printing and the scanner board. If the USB connection is removed while the 3D scanner configuration is active, the firmware will disable it again and restore the default communication parameters.

M752: Start 3D scan

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No coming soon ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Parameters
<code>Snnn</code>: Length/degrees of the scan
<code>Pnnn</code>: Filename for the scan
Example
M752 S300 Pmyscan

Instruct the attached 3D scanner to initiate a new 3D scan and to upload it to the board's SD card (i.e. in the "scans" directory). Before the SCAN command is sent to the scanner, the macro file "scan_pre.g" is executed and when the scan has finished, the macro file "scan_post.g" is run. Be aware that both files must exist to avoid error messages.

M753: Cancel current 3D scanner action

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No coming soon ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Example
M753

Instruct the attached 3D scanner to cancel the current operation. Cancelling uploads is not supported.

M754: Calibrate 3D scanner

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No coming soon ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Example
M754

Calibrates the attached 3D scanner. Before the calibration is performed by the external scanner, "calibrate_pre.g" is run and when it is complete, "calibrate_post.g" is executed.

M755: Set alignment mode for 3D scanner

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No coming soon ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Parameters
<code>Pnnn</code> Whether to turn on (> 0) or off (<= 0) the alignment feature
Examples
M755 P1
M755 P0

Sends the ALIGN ON/OFF command the attached 3D scanner. Some devices turn on a laser when this command is received. If the 'P' parameter is missing, equal to, or less than 0, the alignment feature is turned off. Depending on whether the alignment is turned on or off, either align_on.g or align_off.g is executed before the ALIGN command is sent to the scanner.

M756: Shutdown 3D scanner

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No coming soon ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Example
M756

Sends the SHUTDOWN command the attached 3D scanner.

M800: Fire start print procedure

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
bq No ??? ??? ??? No No ??? bq
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

1 only in bq-Marlin Firmware

Example
M800

M801: Fire end print procedure

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
bq No ??? ??? ??? No No ??? bq
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

1 only in bq-Marlin Firmware

Example
M801

M851: Set Z-Probe Offset

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Use G31 ??? ??? ??? ??? ??? ??? Use M666 P
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? ??? ??? ??? ??? ??? ??? ???

Sets the Z-probe Z offset. This offset is used to determine the actual Z position of the nozzle when using a probe to home Z with G28. This value may also be used by G29 to apply correction to the Z position.

This value represents the distance from nozzle to the bed surface at the point where the probe is triggered. This value will be negative for typical switch probes, inductive probes, and setups where the nozzle makes a circuit with a raised metal contact. This setting will be greater than zero on machines where the nozzle itself is used as the probe, pressing down on the bed to press a switch. (This is a common setup on delta machines.)

This setting is saved in the EEPROM by M500 and restored by <code>M501</code>. The default (as reset by M502) is set by the Z_PROBE_OFFSET_FROM_EXTRUDER setting in Configuration.h.

Note that in Marlin 1.1.0 and up <code>M851</code> sets the value literally as given, while Marlin 1.0.2 negates the absolute value.

The examples below will set the Z-probe Z offset to -4mm (below the nozzle):

M851 in Marlin 1.0.2
M851 Z4 ; Set the Z probe offset to -4
M851 in Marlin 1.1.0
M851 Z-4 ; Set the Z probe offset to -4

M900 Set Linear Advance Scaling Factors

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
1.1.0 No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No

Sets the advance extrusion factors for Linear Advance. If any of the <code>R</code>, <code>W</code>, <code>H</code>, or <code>D</code> parameters are set to zero the ratio will be computed dynamically during printing.

Parameters
<code>K[factor]</code> Advance K factor
<code>R[ratio]</code> Set ratio directly (overrides WH/D)
<code>W[width]</code> <code>H[height]</code> <code>D[diam]</code> Set ratio from WH/D
Examples
M900 K0.7 W0.4 H0.1 D1.75 ; Set K and WH/D ratio
M900 R0.025   ; Set the WH/D ratio directly
M900 R0 ; Set to "auto ratio"

Requires enabling the <code>LIN_ADVANCE</code> feature in Marlin 1.1.

M905: Set local date and time

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No 1.16 and later ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
No No No No No No No ??? No
Parameters
<code>Pnnn</code> Current date in the format YYYY-MM-DD
<code>Snnn</code> Current time in the format HH:MM:SS
Example
M905 P2016-10-26 S00:23:12

Updates the machine's local date and time or reports them if no parameters are specified. The time should be specified in 24-hours format as in "13:45" instead of 1:45PM.

M906: Set motor currents

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No M907? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???
Parameters
<code>Xnnn</code> X drive motor current
<code>Ynnn</code> Y drive motor current
<code>Znnn</code> Z drive motor current
<code>Ennn</code> E drive(s) motor current(s)
<code>Innn</code> Motor current idle factor (0..100)1
<code>H1</code> Set/Get Motor currents used for the downward Z-probe homing movement 2
Example
M906 X300 Y500 Z200 E350:350

Sets the currents to send to the stepper motors for each axis. The values are in milliamps.

Notes

1RepRapFirmware supports an additional <code>I</code> parameter. This is the percentage of normal that the motor currents should be reduced to when the printer becomes idle but the motors have not been switched off. The default value is 30%.

2RepRapFirmware, DC42 version, cmm sub-version supports "H1", which sets the XYZ motor currents used during Z-probing temporarily to different (typically lower) value. If "H1" is specified, the homing current is set, otherwise it operates normally. The homing current should be specified after the main current is set. The actual motor current is not changed until the next Z-probe operation. Lower motor currents reduce vibration during Z-probe motions.

M907: Set digital trimpot motor

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Use M906 ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???

Set digital trimpot motor current using axis codes (<code>X</code>, <code>Y</code>, <code>Z</code>, <code>E</code>, <code>B</code>, <code>S</code>). In Repetier, it sets the current in Percent. In Redeem, it sets the current in Amps (whereas <code>M906</code> uses milliamps).

M908: Control digital trimpot directly

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes No ??? ??? ??? Yes: 0.92 No ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???

M908 P<pin> S<current>

M909: Set microstepping

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Use M350 Use M350 ??? ??? ??? Use M350 No ??? Use M350
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???
Example
M909 X3 Y5 Z2 E3

Set the microstepping value for each of the steppers. In Redeem this is implemented as powers of 2 so…

M909 X2 ; set microstepping on X-axis to 2^2 = 4
M909 Y3 ; set microstepping on Y-axis to 2^3 = 8 etc.

M910: Set decay mode

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No Yes No ??? ???
Example
M910 X3 Y5 Z2 E3

Set the decay mode for each stepper controller The decay mode controls how the current is reduced and recycled by the H-bridge in the stepper motor controller. It varies how the implementations are done in silicone between controllers. Typically you have an on phase where the current flows in the target current, then an off phase where the current is reversed and then a slow decay phase where the current is recycled.

M911: Set power monitor threshold voltages

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Pnnn</code> Power monitor channel, default 0
<code>Snnn</code> Undervoltage threshold
<code>Tnnn</code> Overvoltage threshold
Example
M911 P0 S20 T27.5

Set the minimum supply voltage for which correct operation of the printer mechanics is guaranteed and stepper motor positions are guaranteed to be held for all enabled drivers, and/or the maximum safe voltage above which sensitive parts of the machine should be shut down. <code>M911</code> with no parameters or with just the <code>P</code> parameter reports the current thresholds.

M912: Set electronics temperature monitor adjustment

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>Pnnn</code> Temperature monitor channel, default 0
<code>Snnn</code> Value to be added to the temperature reading in degC
Example
M912 P0 S10.5

Many microcontrollers used to control 3D printers have built-in temperature monitors, but they normally need to be calibrated for temperature reading offset. The <code>S</code> parameter specifies the value that should be added to the raw temperature reading to provide a more accurate result.

M913: Set motor percentage of normal current

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? ???
Parameters
<code>X, Y, Z, E</code> Percentage of normal current to use for the specified axis or extruder motor(s)
Example
M913 X50 Y50 Z50 ; set X Y Z motors to 50% of their normal current
M913 E30:30 ; set extruders 0 and 1 to 30% of their normal current

This allows motor currents to be set to a specified percentage of their normal values as set by <code>M906</code>. It can be used (for example) to reduce motor current during course homing, to make homing quieter or to reduce the risk of damage to endstops, and to reduce current while loading filament to guard against the possibility of feeding too much filament. Use <code>M913</code> again with the appropriate parameters set to 100 to restore the normal currents.

M928: Start SD logging

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 ??? ???
Example
M928 filename.g

Stop SD logging with <code>M29</code>.

M997: Perform in-application firmware update

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No No No ??? No
Parameters
<code>Snnn</code> Firmware module number(s), default 0
Example
M997 S0:1 - update firmware modules 0 and 1

This command triggers a firmware update if the necessary files are present on the SD card. In RepRapFirmware on the Duet series, module numbers are as follows:

0 - main firmware, filename sys/RepRapFirmware.bin (Duet) or sys/DuetWiFiFirmware (Duet WiFi). File sys/iap.bin (Duet) or sys/iap4e.bin (Duet WiFi) must also be present.

1 - web server firmware, filename sys/DuetWiFiServer.bin

2 - web server file system, filename sys/DuetWebControl.bin

3 - put the WiFi module into bootloader mode, so that firmware can be uploaded directly via its serial port

M998: Request resend of line

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No Yes ??? ??? ??? No No ??? ???
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
<code>Pnnn</code> Line number
Example
M998 P34

Request a resend of line 34. In some implementations the input-handling code overwrites the incoming G Code with this when it detects, for example, a checksum error. Then it leaves it up to the GCode interpreter to request the resend.

M999: Restart after being stopped by error

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? No Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No No No No ??? No ??? ???
Parameters
This command can be used without any additional parameters.
<code>Pnnn</code> Reset flags1
Example
M999

Restarts the firmware using a software reset.

Notes

1The dc42 fork of RepRapFirmware not only resets the board but also puts the board into firmware upload mode if parameter PERASE is present.

Other commands

G: List all G-codes

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? ??? ??? ??? Yes ??? ??? ???
Example
G

This lists all implemeted G-codes in the firmware with description and sends it back to the host.
(Note: this has been implemented in Redeem, and so is only a proposal.)

M: List all M-codes

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
No No ??? ??? ??? ??? ??? ??? No
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? ??? ??? ??? ??? Yes ??? ??? ???
Example
M

This lists all implemeted M-codes in the firmware with description and sends it back to the host.
(Note: this has been implemented in Redeem, and so is only a proposition)

T: Select Tool

Support Marlin RepRapFirmware Klipper Prusa Buddy Repetier Smoothie Druid MK4duo
Yes Yes ??? ??? ??? Yes Yes ??? Yes
grbl Sprinter BFB FiveD Machinekit Redeem Teacup Yaskawa MakerBot
??? No ??? Yes ??? Yes Yes ??? ???
Parameters
This command can be used without any additional parameters.
<code>Pnnn</code>: Bitmap of all the macros to be run (only RRF 1.17b or later)
Tool number
Example
T1

Select tool (or in older implementations extruder) number 1 to build with.

The sequence followed is:

  1. Set the current tool to its standby temperatures specified by <code>G10</code> (see above),
  2. Set the new tool to its operating temperatures specified by <code>G10</code> and wait for all temperatures to stabilise,
  3. Apply any X, Y, Z offset for the new tool specified by <code>G10</code>,
  4. Use the new tool.

Selecting a non-existent tool (100, say) just does Step 1 above1. That is to say it leaves all tools in their standby state. You can, of course, use the <code>G10</code> command beforehand to set that standby temperature to anything you like.

Note that you may wish to move to a parking position before executing a T command in order to allow the new extruder to reach temperature while not in contact with the print. It is acceptable for the firmware to apply a small offset [by convention (-1mm x tool-number) in Y] to the current position when the above sequence is entered to allow temperature changes to take effect just away from the parking position. Any such offset must, of course, be undone when the procedure finishes.

If the Z value changes in the offsets and the tool moves up, then the Z move is made before the X and Y moves. If Z moves down, X and Y are done first.

Some implementations (e.g. RepRapFirmware) allow you to specify tool-change G Code macros2. There are normally three specified (any of which can contain no commands if desired) that execute in this order:

  1. Actions to do with the old tool before it is released - macro name: <code>tfreeN.g</code> where N is the tool number;
  2. (Old tool is released);
  3. Actions to do with the new tool before it is selected - macro name: <code>tpreN.g</code> where N is the tool number;
  4. (New tool is selected); and
  5. Actions to do with the new tool after it is selected - macro name: <code>tpostN.g</code> where N is the tool number.

With such implementations there is no wait for temperature stabilisation. That can be achieved by an <code>M116</code> in any of the macros, of course. However be aware that recent RepRapFirmware versions does NOT run any tool change macros if the axes are not homed.

After a reset tools will not start heating until they are selected. You can either put them all at their standby temperature by selecting them in turn, or leave them off so they only come on if/when you first use them. The <code>M0</code>, <code>M1</code>, and <code>M112</code> commands turn them all off. You can, of course, turn them all off with the <code>M1</code> command, then turn some back on again. Don't forget also to turn on the heated bed (if any) if you use that trick.

Tool numbering may start at 0 or 1, depending on the implementation. Some implementations (those that use the <code>M563</code> command to define tools) allow the user to specify tool numbers, so with them you can have tools 17, 99 and 203 if you want. Negative numbers are not allowed.

Notes

1 For RepRapFirmware, selecting a non-existent tool also removes any X/Y/Z offset applied for the old tool.

2 Under special circumstances, the execution of those macro files may not be desired. RepRapFirmware 1.17b or later supports an optional <code>P</code> parameter to specify which macros shall be run. If it is abscent then all of the macros above will be run, else you can pass a bitmap of all the macros to be executed. The bitmap of this value consists of tfree=1, tpre=2 and tpost=4.

Proposed EEPROM configuration codes

BRIEFLY: each RepRap has a number of physical parameters that should be persistent, but easily configurable, such as extrusion steps/mm, various max values, etc. Those parameters are currently hardcoded in the firmware, so that a user has to modify, recompile and re-flash the firmware for any adjustments. These configs can be stored in MCU's EEPROM and modified via some M-codes. Please see the detailed proposal at M-codes for EEPROM config. (This is proposed by --AlexRa on 11-March-2011. There is currently no working implementation of the proposed commands).

Marlin uses codes <code>M500</code>-<code>M503</code> to manipulate EEPROM values.

Sprinter has implemented the following commands to manipulate EEPROM Commit message.

Teacup uses codes <code>M130</code>-<code>M136</code> to set, read, and save some parameters.

Replies from the RepRap machine to the host computer

All communication is in printable ASCII characters. Messages sent back to the host computer are terminated by a newline and look like this:

xx [line number to resend] [T:93.2 B:22.9] [C: X:9.2 Y:125.4 Z:3.7 E:1902.5] [Some debugging or other information may be here]

<code>xx</code> can be one of:

<code>ok</code>

<code>rs</code>

<code>!!</code>

<code>ok</code> means that no error has been detected.

<code>rs</code> means resend, and is followed by the line number to resend.

<code>!!</code> means that a hardware fault has been detected. The RepRap machine will shut down immediately after it has sent this message.

The T: and B: values are the temperature of the currently-selected extruder and the bed respectively, and are only sent in response to <code>M105</code>. If such temperatures don't exist (for example for an extruder that works at room temperature and doesn't have a sensor) then a value below absolute zero (-273oC) is returned.

C: means that coordinates follow. Those are the X: Y: etc values. These are only sent in response to <code>M114</code> and <code>M117</code>.

The RepRap machine may also send lines that look like this:

// This is some debugging or other information on a line on its own. It may be sent at any time.

Such lines will always be preceded by //.

On the latest version of Pronterface and Octoprint (1.2.0+) a special comment of the form:

// action:command

is allowed to be sent from the firmware, the command can currently be pause, resume or disconnect which will execute those commands on the host. As this is also a comment other hosts will just ignore these commands.

The most common response is simply:

<code>ok</code>

When the machine boots up it sends the string

<code>start</code>

once to the host before sending anything else. This should not be replaced or augmented by version numbers and the like. <code>M115</code> (see above) requests those.

All this means that every line sent by RepRap to the host computer except the start line has a two-character prefix (one of <code>ok</code>, <code>rs</code>, <code>!!</code> or <code>//</code>). The machine should never send a line without such a prefix.


Exceptions:

1. Marlin 1.0.0 Gen6 Firmware does not follow the two character rule. 'rs' is actually 'Resend' and '!!' is 'Error'. Example Lines:

  • Error: Line Number is not current line + 1. Last Line: 7
  • Resend: 8
  • Writing to File: print.gco
  • Done saving file.
  • File opened:print.gco Size:22992
  • File selected

When in the code base did this change take place and what other firmwares are affected?

2. The dc42 fork of RepRapFirmware responds to some commands with a reply string in JSON format, terminated by a newline. This allows later firmware revisions to include additional information without confusing clients (e.g. PanelDue) that do not expect it, and to make responses self-describing so that the client will not be confused if responses are delayed or lost. The commands affected are:

  • <code>M105 S2</code>
  • <code>M105 S3</code>
  • <code>M20 S2</code>
  • <code>M36</code>
  • <code>M408</code>

Proposal for sending multiple lines of G-code

So far, this is a proposal, open for discussion.

Problem to solve

When using Marlin firmware or emulating Marlin, each line of G-code sent from the host to the controller is answered with an <code>ok</code> before the next line can be sent without locking communications up. This slows down communication and limits the number of commands that can be sent per second to the printer controller, as the USB stack on the host and the serial interface driver on the Arduino add their own latencies (up to 10 milliseconds). This is not a problem for other controller electronics using native USB such as the Duet, because the standard serial-over-USB drivers provide flow control, so the host software can be configured so as not to wait for the <code>ok</code>.

For more details on this proposal, some suggested solutions and comments, please see GCODE_buffer_multiline_proposal

Alternatives to G-code

Main article: Firmware/Alternative#alternatives to G-code

Several people have suggested using STEP-NC or some other control language; or perhaps designing a completely new control language.