Here are some important notes that you must read before jumping to the detailed commands references.
- The Snapmaker 2.0 firmware is based on Marlin v2.0.x. Therefore, its supported G-code commands are mostly the same as the official G-code commands of Marlin. For specifics, please refer to Marlin official documentation.
- This article is based on 2.0 v1.20.2 and later versions. If there are any discrepancies, it is recommended to upgrade the Snapmaker 2.0 firmware to the latest version.
- This article describes the Snapmaker 2.0 G-code commands by dividing them into three sub-commands:
(1) Supported And Verified Commands -- recommended for use.
(2) Supported But Unverified Commands -- not recommended for use.
(3) Incompatible Or Unadapted Commands -- do not use.
- Marking Instructions:
(1) For commands that have both the same name and behavior as those supported by Marlin, the command description will also be almost consistent with Marlin, without any special markings. For example: G4
.
(2) For commands that have the same name as those supported by Marlin but exhibit different behavior, the command description will be marked with 'Modified'. For example: M3/M4(Modified)
.
(3) For commands that are unique to Snapmaker 2.0, the command description will be marked with 'SM2.0'. For example: G1029 (SM2.0)
.
¶ Supported And Verified Commands
The commands described in this section are all normally supported and have been rigorously tested and verified. They are recommended for use.
- The
G0
and G1
commands add a linear move to the queue to be performed after all previous moves are completed. These commands yield control back to the command parser as soon as the move is queued, but they may delay the command parser while awaiting a slot in the queue.
- A linear move traces a straight line from one point to another, ensuring that the specified axes will arrive simultaneously at the given coordinates (by linear interpolation). The speed may change over time following an acceleration curve, according to the acceleration and jerk settings of the given axes.
- A command like
G1 F1000
sets the feedrate for all subsequent moves.
- By convention, most G-code generators use
G0
for non-extrusion movements (those without the E axis) and G1
for moves that include extrusion. This is meant to allow a kinematic system to, optionally, do a more rapid uninterpolated movement requiring much less calculation.
- For Cartesians and Deltas the
G0
(rapid linear movement) command is (and must be) a direct alias for G1
(rapid movement). On SCARA machines G0 does a fast non-linear move. Marlin 2.0 introduces an option to maintain a separate default feedrate for G0
. Note: Slicers tend to override firmware feedrates!
- Coordinates are given in millimeters by default.
- In Relative Mode (
G91
) all coordinates are interpreted as relative, adding onto the previous position.
- In Extruder Relative Mode (
M83
) the E coordinate is interpreted as relative, adding onto the previous E position.
- A single linear move may generate several smaller moves to the planner due to kinematics and bed leveling compensation.
G0 [E<pos>] [F<rate>] [S<power>] [X<pos>] [Y<pos>] [Z<pos>] ...
G1 [E<pos>] [F<rate>] [S<power>] [X<pos>] [Y<pos>] [Z<pos>] ...
- Parameters
- E: An absolute or relative coordinate on the E (extruder) axis (in current units). The E axis describes the position of the filament in terms of input to the extruder feeder.
- F: The maximum movement rate of the movement between the start and end point. The feedrate set here applies to subsequent moves that omit this parameter.
- S: Set the laser power for the move.
- X: An absolute or relative coordinate on the X axis (in current units).
- Y: An absolute or relative coordinate on the Y axis (in current units).
- Z: An absolute or relative coordinate on the Z axis (in current units).
- B: An absolute or relative coordinate on the B axis (in current units).
- The most basic move sets a feedrate and moves the tool to the given position.
G0 X12 ; Move to 12mm on the X axis
G0 F1500 ; Set the feedrate to 1500 mm/min
G0 X90.6 Y13.8 ; Move to 90.6mm on the X axis and 13.8mm on the Y axis
- There are some caveats related with feedrates. Consider the following:
G1 F1500 ; Set the feedrate to 1500 mm/min
G92 E0
G1 X50 Y25.3 E22.4 ; Move while extruding
- In the above example the feedrate is set to 1500 mm/min, then the tool is moved 50mm on the X axis and 25.3mm on the Y axis while extruding 22.4mm of filament between the two points.
G1 F1500
G92 E0
G1 X50 Y25.3 E22.4 F3000
- However, in the above example, we set a feedrate of 1500 mm/min on line 1 then do the move described above, accelerating to a feedrate of 3000 mm/min (if possible). The extrusion will accelerate along with the X and Y movement, so everything stays synchronized.
- Dwell pauses the command queue and waits for a period of time.
- If both S and P are included, S takes precedence.
G4
with no arguments is effectively the same as M400
.
G4 [P<time(ms)>] [S<time(sec)>]
- Parameters
- P :Amount of time to dwell.
- S :Amount of time to dwell.
G4 P500 ; Dwell for 1/2 second
- Set units to inches. In this mode, all positions, offsets, rates, accelerations, etc., specified in G-code parameters are interpreted as inches.
G20
G20 ; set units to inches
- Set units to millimeters. In this mode, all positions, offsets, rates, accelerations, etc., specified in G-code parameters are interpreted as millimeters.
G21
G21 ; set units to millimeters
- When you first start up your machine, it has no idea where the toolhead is positioned, so Marlin needs to use a procedure called “homing” to establish a known position. To do this, it moves each axis towards one end of its track until it triggers a switch, commonly called an “endstop”. Marlin knows where the endstops are, so once all the endstops have been triggered, the position is known.
- The
G28
command is used to home one or more axes. The default behavior with no parameters is to home all axes.
- The position is easy to lose when the steppers are turned off, so homing may be required or advised after the machine has been sitting idle for a period of time.
- To prevent collisions, the machine will only home all axes for 3DP scenes.
G28 [O] [X] [Y] [Z]
- Parameters
- O: Flag to skip homing if the position is already trusted.
- X: Flag to home the X axis.
- Y: Flag to home the Y axis.
- Z: Flag to home the Z axis.
- The
G42
command moves the nozzle to the location corresponding to a specific coordinate in the bed leveling mesh. It operates similarly to the G0
and G1
commands except that the provided coordinates are a mesh row and column instead of an absolute or relative position on the bed.
- The
G42
command will determine the bed position that corresponds to the provided mesh row and column and move the nozzle to that position.
- Using
M420 V
, the information of the mesh can be obtained.
G42 [F<rate>] [I<pos>] [J<pos>]
- Parameters
- F: The maximum movement rate of the movement between the start and end point. The feedrate set here applies to subsequent moves that omit this parameter.
- I: The column of the mesh coordinate.
- J: The row of the mesh coordinate.
G53
applies native workspace to the current move. See G54
- G59.3
for workspace coordinate system. In CNC G-code G53
is a modifier. It precedes a movement command (or other modifiers) on the same line. Marlin also accepts G53
on a line by itself as the command to return to the native workspace.
G53
- Rapid linear move to the machine origin in native space.
G53 G0 X0 Y0 Z0
- Rapid linear move to absolute coordinate X20 in native space.
G53 G1 X20
- Use native space
G53
- A workspace is an XYZ offset to the native machine space. All workspaces default to (0,0,0) at start, or with EEPROM support they may be restored from a previous session. See
G53
for native space.
- G92: used to set the current workspace’s offset.
- G54: use coordinate system 1.
- G55: use coordinate system 2.
- G56: use coordinate system 3.
- G57: use coordinate system 4.
- G58: use coordinate system 5.
- G59: use coordinate system 6.
- G59.1: use coordinate system 7.
- G59.2: use coordinate system 8.
- G59.3: use coordinate system 9.
- Between SM2.0 and Luban, as well as between SM2.0's controller and screen, only
G53
and G54
are recommended for use.
G54
G55
G56
G57
G58
G59
G59.1
G59.2
G59.3
- In absolute mode, all coordinates given in G-code are interpreted as positions in the logical coordinate space. This includes the extruder position unless overridden by
M83
.
- Absolute positioning is the default.
G90
G90 ; Set all axes to absolute
- Set relative position mode. In this mode, all coordinates are interpreted as relative to the last position. This includes the extruder position unless overridden by
M82
.
G91
- Set the current position to the values specified, and the software endstops are adjusted to preserve the physical movement limits. Thus, you could use
G92
to set the middle of the bed to (0,0,0) and then run .gcode.
G92 [E<pos>] [X<pos>] [Y<pos>] [Z<pos>]
- Parameters
- E: New extruder position.
- X: New X axis position.
- Y: New Y axis position.
- Z: New Z axis position.
-
Specify that the nozzle’s current X position is 10 and the current extruder position is 90.
G92 X10 E90
-
Specify that the nozzle’s current XYZ position is 0, 0, 0.
G92 X0 Y0 Z0
- Operations related to automatic bed leveling.
- In general, it is recommended that users perform automatic bed leveling through the calibration page on the screen, rather than directly using the
G1029
command.
- In the current version, the operation of directly using the
G1029
command is only applicable to Single Extrusion 3DP.
G1029 [P<numbers>] [A] [S]
- Parameters
- P: Set the number of leveling grid points, which can be set within the range of integers [1, 11].
- A: Enable automatic detection in automatic bed leveling and wait for it to complete.
- S: Save the data of automatic bed leveling.
- For laser toolheads, both
M3
and M4
are used to set the laser power.
M3
is used to set a constant power. That is, in M3
mode, the machine will not change the laser power during motion.
M4
is used to set a variable power. That is, in M4
mode, the machine will dynamically adjust the laser power based on the movement speed of the toolhead during motion, in pursuit of better and smoother laser engraving effects.
- For CNC toolhead, both
M3
and M4
are used to set the CNC spindle speed, and the effects of M3
and M4
are consistent in the current version.
- In the current version, the CNC toolheads include the 50W CNC (also known as the standard CNC) and the 200W CNC.
- For laser toolhead, when the
M3
/M4
command is used without parameters, the laser toolhead will output at the power configured most recently.
- For CNC toolhead, when the
M3
/M4
command is used without parameters, the CNC toolhead will output at the power(or spindle speed) configured most recently.
M3
M3 P80
M4 S255
- Wait for moves to complete, then turn off the spindle/laser power and PWM.
G0
and G28
will also turn the laser off.
M5
- Turn off the spindle or laser.
M5
- These commands pertain to a CNC machine with a liquid cooling system or a laser with air assist.
- Both
M7
and M8
have the same effect, which is used to turn on the coolant/air assist.
M9
is used to turn off the coolant/air assist.
- In the current version, it is only applicable to 20W/40W laser modules.
M7
M8
M9
M8 ; turn on the coolant/air assist
M9 ; turn off the coolant/air assist
- Supported versions
- Main controller: V4.4.0 and later.
- Screen: V1.13.3 and later.
M76
M76
- This command is used to override
G91
and put the E axis into absolute mode independent of the other axes.
G90
and G91
clear this mode.
M82
- Set E to Absolute Positioning.
M82
- This command is used to override G90 and put the E axis into relative mode independent of the other axes.
G90
and G91
clear this mode.
M83
- Set E to Relative Positioning.
M83
- Use
M92
to set the steps-per-unit for one or more axes. This setting affects how many steps will be done for each unit of movement.
- In the current version, the unit on the XYZE axis is set in steps-per-millimeter, and the unit on the AB axis is steps-per-degree.
- These are saved with
M500
and loaded with M501
and reset with M502
.
- Get the current settings using
M92
with no parameters or M503
.
M92 [E] [T] [X] [Y] [Z] [B]
- Parameters
- E: E steps per unit.
- T: Target extruder.
- X: X steps per unit.
- Y: Y steps per unit.
- Z: Z steps per unit.
- B: B steps per unit.
- Set E steps for a new extruder.
M92 E688.4
- Obtain FreeRTOS task information, such as remaining available memory information.
M101
M101
- Set a new target hot end temperature and continue without waiting. The firmware will continue to try to reach and hold the temperature in the background.
- Use
M109
to wait for the hot end to reach the target temperature.
M104 [T] [S]
- Parameters
- T: Hotend index. If omitted, the currently active hotend will be used.
- S: Target temperature.
- Set target temperature for the active hotend.
M104 S185
- Set target temperature for E1.
M104 T1 S205
- Request a temperature report to be sent to the host as soon as possible.
- A better way for hosts to get regular temperature updates is to use
M155
. Hosts then no longer need to run an extra process or use up slots in the command buffer to receive temperatures.
M105 [T<index>]
- Get a temperature report.
M105
- Turn on one of the fans and set its speed. If no fan index is given, the print cooling fan is selected. The fan speed applies to the next block added to the planner, so it will not take effect until previous moves in the planner are done. Under manual control with an idle machine,
M106
will change the fan speed immediately.
M106
with no speed sets the fan to full speed.
- Turn off fans with
M107
.
- In the current version, it is only applicable to 3DP.
M106 [P<index>] [S<speed>]
- Parameters
- P: Fan index.
- S: Speed, from 0 to 255. S255 provides 100% duty cycle; S128 produces 50%.
- Turn on the fan at 200/255 DC
M106 S200
- Turn off one of the fans. If no fan index is given, the print cooling fan.
- Turn on fans with
M106
.
- In the current version, it is only applicable to 3DP.
M107 [P<index>]
M107
¶ M108 - Break and Continue
- Some G-code commands cause Marlin to go into a closed loop, waiting indefinitely for a certain state or event. For example, M109 waits for the target temperature to be reached.
- In the case of
M109
, the M108
command stops waiting for the target temperature and continues processing G-code. This may result in “cold extrude” messages.
M108
M108
- This command optionally sets a new target hot end temperature and waits for the target temperature to be reached before proceeding. If the temperature is set with S then
M109
waits only when heating. If the temperature is set with R then M109
will also wait for the temperature to go down.
- To optimize temperature control performance and ensure the stability of the hot end temperature, two concepts, the temperature window and the temperature residency time, are used in the machine's firmware.
- The temperature window refers to the maximum allowable deviation between the actual temperature of the hot end and the target temperature, measured in ℃, and is specified by the C parameter. For example, C3 represents a maximum allowable deviation of ±3℃. This means that when the actual temperature of the hot end is within ±3℃ of its target temperature, the machine considers the hot end to have reached the target temperature.
- The temperature residency time refers to the duration that the actual temperature of the hot end needs to remain within the configured temperature window, measured in seconds, and is specified by the W parameter. For instance, W1 indicates that when the actual temperature of the hot end remains within its target temperature window for 1 second, the machine considers the actual temperature of the hot end to have reached and stabilized at its target temperature.
- Only when the actual temperature of the hot end falls within the specified temperature window and maintains the specified temperature residency time, the machine considers the hot end to have truly reached the target temperature, thus ending the wait.
- To set the hot end temperature and proceed without waiting, use
M104
.
M109 [T] [S] [R] [C] [W]
- Parameters
- T: Hotend index. If omitted, the currently active hotend will be used.
- S: Target temperature (wait only when heating).
- R: Target temperature (wait for cooling or heating).
- C: the temperature window. If omitted, it is 1.
- W: the temperature residency time. If omitted, it is 3.
- Set target temperature and wait (if heating up).
M109 S180
- Set target temperature, wait even if cooling.
M109 R120
- Set target temperature, temperature window, and temperature residency time for the hot end E1.
M109 T1 S185 C1 W3
- Marlin has several debug bits that can be set, in combination, to help configure, troubleshoot, and debug the firmware. Add up the debug bits you need:
Mask |
Name |
Description |
1 |
ECHO |
Echo all commands sent to the parser. |
2 |
INFO |
Print extra informational messages. |
4 |
ERRORS |
Print extra error messages. |
8 |
DRYRUN |
Don’t extrude, don’t save leveling data, etc. |
16 |
COMMUNICATION |
Not currently used. |
32 |
LEVELING |
Detailed messages for homing, probing, and leveling. (Requires DEBUG_LEVELING_FEATURE.) |
64 |
Reserved |
Reserved for future usage. |
128 |
Reserved |
Reserved for future usage. |
M111 [S]
M111 S38
- Get the “current position” of the active tool. Stepper values are included.
M114
M114
M115
M115
- Send a message to the connected host for display in the host console or to perform a host action.
- The
E
and A
parameters must precede the message.
- Can also send the message to the serial port for hosts to display.
M118 [A1] [E1] [string]
- Parameters
- A1: Prepend
//
to denote a comment or action command. Hosts like OctoPrint can interpret such commands to perform special actions. See your host’s documentation.
- E1: Prepend
echo:
to the message. Some hosts will display echo messages differently when preceded by echo:
.
- string: Message string. If omitted, a blank line will be sent.
M118 E1 Hello World!
M118 A1 action:cancel```
- Use this command to get the current state of all endstops, useful for setup and troubleshooting. Endstops are reported as either “
open
” or “TRIGGERED
”.
- The state of the Z probe and filament runout sensors are also reported with this command.
M119
- Set a new target temperature for the heated bed and continue without waiting. The firmware manages heating in the background.
- Use
M190
to set the bed temperature and pause until the target is reached.
M140 [S<temp>]
- Set target temperature, no waiting
M140 S80
- It can be useful for host software to track temperatures, display and graph them over time, but polling with
M105
is less than optimal. With M155
hosts simply set an interval and Marlin will keep sending data automatically. This method is preferred over polling with M105
.
M155 S<seconds>
- Parameters
- S: Interval in seconds between auto-reports. S0 to disable.
- Report temperatures every 4 seconds
M155 S4
- Stop reporting temperatures
M155 S0
- This command optionally sets a new target temperature for the heated bed and waits for the target temperature to be reached before proceeding. If the temperature is set with S, then it waits only when heating.
- This command may block the command queue. And hosts can break in using
M108
.
- Use
M140
to set the bed temperature and proceed without waiting.
M190 [R<temp>] [S<temp>]
- Parameters
- S: Target temperature (wait only when heating).
- R: Target temperature (wait for cooling or heating).
- Set target bed temperature and wait (if heating).
M190 S80
- Set target bed temperature and wait even if cooling.
M190 R40
- Set the max acceleration for one or more axes (in current units-per-second per-second). The acceleration limit for extruder(s) only applies for print moves where at least one other axis is also in motion.
- To set the acceleration limit for retract / recover in which only the E axis is moving use
M204 R
instead.
- These are saved with
M500
and loaded with M501
and reset with M502
.
- Get the current settings using
M503
.
M201 [E<accel>] [T<index>] [X<accel>] [Y<accel>] [Z<accel>] [B<accel>]
- Parameters
- E: E axis max acceleration.
- T: Target extruder.
- X: X axis max acceleration.
- Y: Y axis max acceleration.
- Z: Z axis max acceleration.
- B: B axis max acceleration.
- Set max acceleration lower so it sounds like a robot:
M201 X50 Y50
- Set the max acceleration for E1 print moves:
M201 E1000 T1
- Set the max feedrate for one or more axes (in current units-per-second).
- The Z-axis maximum speed can be set up to 40mm/s.
- These are saved with
M500
and loaded with M501
and reset with M502
.
- Get the current settings using
M503
.
M203 [E<units/s>] [T<index>] [X<units/s>] [Y<units/s>] [Z<units/s>] [B<units/s>]
- Parameters
- E: E axis max feedrate.
- T: Target extruder.
- X: X axis max feedrate
- Y: Y axis max feedrate.
- Z: Z axis max feedrate.
- B: B axis max feedrate.
- Set max feedrate for XY to 100mm/s:
M203 X100 Y100
- Set the preferred starting acceleration (in units/s/s) for moves of different types.
- These are saved with
M500
and loaded with M501
and reset with M502
.
- Get the current settings using
M503
.
M204 [P<accel>] [R<accel>] [T<accel>]
- Parameters
- P: Printing acceleration. Used for moves that include extrusion (i.e., which employ the current tool).
- R: Retract acceleration. Used for extruder retract / recover moves.
- T: Travel acceleration. Used for moves that include no extrusion.
- Set acceleration for printing moves to 2400mm/s/s.
M204 P2400
- Set various motion settings. See parameters for details.
- The P/L/C parameter requires the version of the main controller to be V4.4.0 or later, and it is generally not recommended to modify it.
- These are saved with
M500
and loaded with M501
and reset with M502
.
- Get the current settings using
M503
.
M205 [B<µs>] [S<units/s>] [T<units/s>] [J<deviation>] [P<units/s>] [L<units/s>] [C<units/s>]
- Parameters
- B: Minimum segment time (µs).
- S: Minimum feedrate for print moves (units/s).
- T: Minimum feedrate for travel moves (units/s).
- J: Junction deviation in Marlin.
- P: Minimum planning feedrate for 3DP toolhead (units/s).
- L: Minimum planning feedrate for Laser toolhead (units/s).
- C: Minimum planning feedrate for CNC toolhead (units/s).
M205 T40 ; Travel feedrate = 40mm/s
- Optionally enable/disable software endstops, then report the current state.With software endstops enabled, moves will be clipped to the physical boundaries from
[XYZ]_MIN_POS
to [XYZ]_MAX_POS
.
M211 [S<flag>]
- Parameters
- S: Software endstops state (S1=enable S0=disable).
M211
M211 S1
- Set speed percentage factor, aka “Feed Rate” which applies to all G-code-based moves in all (X, Y, Z, and E) axes. Report the current speed percentage factor if no parameter is specified.
M220 [S<percent>]
- Set feedrate to 80%.
M220 S80
- Set the flow percentage, which applies to all E moves added to the planner.
M221 [S<percent>] [T<index>]
- Parameters
- S: Flow percentage.
- T: Target extruder.
- Set the flow rate to 150%.
M221 S150
- Set the values that control the PID loop for a hotend.
- These are saved with
M500
, loaded with M501
, and reset with M502
.
- Get the current settings using
M301
with no parameters or M503
.
M301 [E<index>] [D<value>] [I<value>] [P<value>]
- Parameters
- E: Extruder index to set. Default 0.
- D: Derivative value.
- I: Integral value.
- P: Proportional value.
M301
M301 E0 P150.000 I1.000 D30000.000
- Set the minimum extrusion temperature, potentially allowing E movement at temperatures below the melting point of the material.
M302 [P<flag>] [S<temp>]
- Parameters
- P: Flag to allow extrusion at any temperature.
- S: Minimum temperature for safe extrusion.
M302 ; report current cold extrusion state
M302 P0 ; enable cold extrusion checking
M302 P1 ; disable cold extrusion checking
M302 S0 ; always allow extrusion (disable checking)
M302 S170 ; only allow extrusion above 170
M302 S170 P1 ; set min extrude temp to 170 but leave disabled
- This command causes G-code processing to pause and wait in a loop until all moves in the planner are completed.
M400
M400
- Get or set filament runout status and distance. Omit all parameters to get a report of the current stats. When filament sensors are enabled, Marlin will respond to a filament runout by running the configured G-code. When filament runout detection is disabled, Marlin will take no action for filament runout.
M412 [R<bool>] [S<bool>]
- Parameters
- R: Flag to reset the filament runout sensor. Not needed with S.
- S: Flag to enable or disable Filament Runout Detection. If omitted, the current enabled state will be reported.
- Enable (and reset) filament runout detection.
M412 S1
- Disable filament runout detection.
M412 S0
- Report filament runout state.
M412
- Get and/or set bed leveling state.
- In the current version,
M420
only supports the S
and V
parameters. And other parameters available for M420
in official Marlin documentation are not compatible here and should not be used.
M420 [S<bool>] [V<bool>]
- Parameters
- S: Set enabled or disabled.
- V: Verbose, Print the stored mesh / matrix data.
M420 S1
M420 V
- Backlash compensation will add extra steps to one or more segments whenever a motor reverses direction. By default, steps are added to the first segment after a direction change. This gives the best dimensional accuracy but may cause marks to appear in the print. Smoothing spreads the added steps over multiple consecutive segments to prevent blemishes in the print, at the expense of dimensional accuracy. In SM2.0, the default method is used, which means that steps are added to the first segment after a direction change.
- Backlash compensation can be configured at either compile-time or run-time.
MEASURE_BACKLASH_WHEN_PROBING
is not enabled in SM2.0, so the backlash cannot be automatically measured.
- The default backlash on each axis, i.e., BACKLASH_DISTANCE_MM, is 0.
- The default backlash correction, i.e., BACKLASH_CORRECTION, is 0.
M425 [F<value>] [X<linear>] [Y<linear>] [Z<linear>] [B<linear>]
- Parameters
- F: Enable or disables backlash correction, or sets an intermediate fade-out (0.0 = none; 1.0 = 100%)
- X: Set the backlash distance on X (mm; 0 to disable)
- Y: Set the backlash distance on Y (mm; 0 to disable)
- Z: Set the backlash distance on Z (mm; 0 to disable)
- B: Set the backlash distance on B (mm; 0 to disable)
- Save all configurable settings to EEPROM.
M500
M500
- Load all saved settings from EEPROM.
M501
M501
- Reset all configurable settings to their factory defaults. This only changes the settings in memory, not on EEPROM.
- To also reset settings in EEPROM, follow with
M500
.
M502
- Print a concise report of all runtime-configurable settings (in SRAM) to the host console. This command reports the active settings which may or may not be the same as those stored in the EEPROM.
M503 [S]
- Parameters
- S: Detailed output flag. (true if omitted.)
M503
- Validate the contents of the EEPROM.
M504
- Validate EEPROM contents.
M504
- Trigger a filament runout event to pause the print job, allowing for actions such as filament change.
- Using the M600 command is only effective during the extrusion process of the extruder.
M600
M600
- This command sets and/or reports the Linear Advance K factors.
- Setting the K factor to 0 disables Linear Advance.
- See Linear Advance for details on how to determine the K factor and a link to our calibration tool.
M900 [K<kfactor>] [T<index>]
- Parameters
- K: The K factor to set for the specified extruder. Unchanged if omitted. Set this value higher for more flexible filament or a longer filament path.
- T: Target extruder.
¶ M1005 (SM2.0) - Get Basic Info of Controller and Modules
-
Get the basic information of the controller and modules, see the following example for details.
Marlin SM2-4.7.2
Compiled: Jun 3 2024, 17:42:45
PACKAGE: Snapmaker_V4.7.2
Module Ver:
Module 0x00C048D4: v1.14.6
Module 0x00C02468: v1.14.6
Module 0x0002C4DE: v1.14.3
Module 0x00C048D8: v1.14.6
Module 0x00C048E0: v1.14.6
Module 0x00C048F0: v1.14.6
linear_tmc X1 length: 356 mm, lead: 20 mm
linear_tmc Y1 length: 356 mm, lead: 20 mm
linear_tmc Z1 length: 356 mm, lead: 8 mm
linear_tmc Y2 length: 356 mm, lead: 20 mm
linear_tmc Z2 length: 356 mm, lead: 8 mm
kits: quick_change_kit
Machine Size: L
ok
Marlin SM2-4.7.2
: Controller firmware version.
Compiled: Jun 3 2024, 17:42:45
: Controller firmware compilation time.
Module 0x00C048D4: v1.14.6
: Module ID | sequence, module firmware version.
linear_tmc X1 length: 356 mm, lead: 20 mm
: Information related to linear module.
X1
: Axis.
length
: Travel distance.
lead
: lead.
kits: quick_change_kit
: Kits usage.
quick_change_kit
: Quick swap kit, namely, quick change kit.
reinforcement_kit
: Bracing kit, namely, linear reinforcement kit.
Machine Size: L
: Machine Size.
S
: A150。
M
: A250。
L
: A350。
M1005
M1005
- Get detailed information of the toolhead. For different toolheads, the information format may vary. Only key fields are explained here, and see the following example for details.
- 3DP
Tool Head: 3DP
active_probe_sensor: 0
hotend_type: 0: 1, 1: 1
hotend_diameter: 0: 0.40, 1:0.40
Kp: 150.000, Ki: 1.000, Kd: 30000.000
z_compensation: 0: 0.585, 1: 0.397
echo:Hotend offsets: 0.00,0.00,0.000 26.00,0.00,-1.524
ok
Tool Head: 3DP
: Toolhead type - 3DP.
z_compensation: 0: 0.585, 1: 0.397
: Z probe compensation.
- Laser
Tool Head: 20W LASER
Current Status: OFF
Current Power: 0.00
Focus Height: 65
ok
Tool Head: 20W LASER
: Toolhead type - 20W Laser.
Current Status: OFF
: Current status of the laser.
Current Power: 0.00
: Current power of the laser.
- CNC
Tool Head: 200W CNC
rpm: 0, error: 0x0
M_I: 346, M_V: 24.23
M_TEMP: 25.80, PCB_TEMP: 26.90
ctr mode: CNC_CONSTANT_RPM_MODE
run status: STOP
cur_power: 0 target_power: 0
cur_rpm: 0 target_rpm: 0
last error: 0x0
ok
Tool Head: 200W CNC
: Toolhead type - 200W CNC.
cur_rpm: 0 target_rpm: 0
: Current rpm and target rpm.
M1006
M1006
- Set the brightness and on/off status of the enclosure's light.
M1010 S3 P<n>
- Parameters
- P: brightness, from 0 to 100. 0 represents turning off the light, 100 represents turning on the light at maximum brightness.
- Turn off the light.
M1010 S3 P0
- Turn on the light at 50% brightness.
M1010 S3 P50
- Set the speed and switch status of the enclosure's fan.
M1010 S4 P<n>
- Parameters
- P: Speed, from 0 to 100. 0 represents turning off the fan, 100 represents running the fan at full speed.
M1010 S4 P50
- Set the speed gear of the purifier's fan.
- If there is an abnormality in the purifier, it can also be forced to turn on the fan through a force flag.
M1011 F<n> [S<force>]
- Parameters
- F: gear, ranging in {0, 1, 2, 3}, 0 represents turning off the fan, 3 represents turning on the fan at maximum speed gear.
- S: Force flag, 0 represents non-force, non-zero represents force.
- Turn off the fan.
M1011 F0
- Turn on the fan at gear 1.
M1011 F1
- Set the color and brightness of the purifier's light, referencing the RGB color mixing principle.
M1011 [R<n>] [G<n>] [B<n>]
- Parameters
- R: Red component, from 0 to 255.
- G: Green component, from 0 to 255.
- B: Blue component, from 0 to 255.
- Turn off the light.
M1011 R0 G0 B0
- Set the brightness and color of the light with R-50, G-100, B-50.
M1011 R50 G100 B50
- Set the switch status of the branch power supply for the toolhead, that is, set the half power mode.
- In the current version, this is only applicable to 40W laser module.
M2000 L23 P<n>
- Parameters
- P: 0 represents turning off the branch power supply, which means entering the half-power mode, while non-zero represents turning on the branch power supply, which means exiting the half-power mode.
M2000 L23 P1
¶ M2000 L30 (SM2.0) - Set Laser Module Standby Mode
- The laser module enters/exits standby mode.
- In the current version, this is only applicable to 2W infrared laser module.
- In the current version, for the 2W infrared laser module, the so-called standby mode refers to putting some functions of the module into a standby state for hardware protection (rather than energy saving), such as the TEC temperature control function.
M2000 L30 P<n>
- Parameters
- P: Standby mode, 0 represents exiting standby mode, non-zero represents entering standby mode.
M2000 L30 P0
- Set the speed and switch status of the fan for the laser toolhead.
M2002 T2 P<n>
- Paramters
- P: Speed, from 0 to 255. 0 represents turning off the fan, 255 represents running the fan at full speed.
- Run the fan at full speed.
M2002 T2 P255
- Turn off the fan.
M2002 T2 P0
- Set the switch status of the crosshair for the laser toolhead.
- In the current version, this is only applicable to 20W/40W blue laser modules and 2W infrared laser modules.
M2002 T3 P<n>
- Parameters
- P: Switch status, 0 represents turning off, non-zero represents turning on.
- Turn on the crosshair.
M2002 T3 P1
- Switch or select the nozzle.
T0
represents selecting the left nozzle, and T1
represents selecting the right nozzle.
- The machine can only switch nozzles normally after homed.
T0
T1
T0
T1
¶ Supported But Unverified Commands
(1) The commands described in this section, although supported by the code and expected to behave consistently with official Marlin, are not recommended for use due to lack of rigorous validation. If you really need to use them, please refer to the Marlin official documentation for relevant command details.
(2) Snapmaker Luban will not actively use the commands described in this chapter.
¶ Commands
- G2-G3
- G27
- G30
- M17
- M18
- M84
- M110
- M113
- M421
¶ Incompatible Or Unadapted Commands
(1) The commands described in this section have not been adapted for SM2.0 or may be incompatible with other functions. If used, they may cause unexpected issues/exceptions, and it is strongly recommended not to use them. If you use them, you should be responsible for any actual effects or consequences.
(2) In the later versions, code support for these commands may be gradually removed.
¶ Commands
- G29
- G38
- M25
- M31
- M42
- M75
- M77
- M81
- M85
- M112
- M117
- M120
- M121
- M206
- M217
- M218
- M226
- M303
- M401
- M402
- M410
- M413
- M428
- M851
- M999