G Code Reference - Mrnt/OctoPrint-FlashForge GitHub Wiki

List of Supported G-Codes

The FlashForge Finder, Dreamer, etc and similar printers by Dremel seem to support a subset of the Marlin firmware G-code command set. The following are the only commands that are known to be supported.

Commands are sent to the printer as ASCII strings and are preceded with a "~" and terminated with a carriage return and line feed character, ie "\r\n". The printer should respond with two or more lines of text, the first line being "CMD XXX Received.\r\n", followed by lines containing any data and lastly a line containing "ok\r\n".

For example:

Computer to printer

~M105\r\n

Printer to computer

CMD M105 Received.\r\n
T0:24 /0 B:0 /0\r\n
ok\r\n

NOTE: Some commands are marked as "unbuffered" - the printer will respond to these commands immediately and they are the only commands that can be sent to the printer while it is printing. Other commands are buffered which means the printer will respond to them later after processing commands in it's current command queue. This will cause communication with OctoPrint to hang. Unbuffered commands are typically commands that fetch the status of the printer (temperature, position, print progress).

G0 / G1 - Move

Usage

G1 E<pos> F<rate> X<pos> Y<pos> Z<pos>

Parameters

E<pos> Optional. The length of filament to feed into the extruder between the start and end point. Units: mm

F<rate> Optional. The maximum rate of the move between the start and end point. The speed set here applies to subsequent moves that omit this parameter.

X<pos> Optional. A coordinate on the X axis. Units: mm

Y<pos> Optional. A coordinate on the Y axis. Units: mm

Z<pos> Optional. A coordinate on the Z axis. Units: mm

Example

G1 X10 Y20 Z30 E1.0 F3000

Compatibility

Which printers support this command and whether it is only supported in a file uploaded to SD card or whether it is supported when sent direct from OctoPrint via the Terminal or when printing a file:

Printer Upload File to SD Card Control/Print Directly From OctoPrint
Creator Max Yes ?
Dreamer Yes ?
Dreamer NX Yes ?
Finder v1 Yes Yes
Finder v2 Yes Yes
Explorer Yes ?
Guider Yes ?
Guider II Yes ?
Guider II S Yes ?
Inventor Yes ?
Inventor II Yes ?
Dremel 3D20 Yes ?
Dremel 3D40 Yes ?
Dremel 3D45 Yes ?
PowerSpec Ultra 3d Yes Yes

G4 - Pause/Dwell

Tells the machine to pause for a certain amount of time.

Usage

G4 P<ms> Dwell time in ms

G4 S<s> Dwell time in s

Example

G4 S10 Pause for 10 seconds

G28 - Auto Home

Usage

G28 X Y Z

Parameters

X Optional. Flag to go back to the X axis origin

Y Optional. Flag to go back to the Y axis origin

Z Optional. Flag to go back to the Z axis origin

G90 - Absolute Positioning

Set absolute position mode. All coordinates from now on are absolute relative to the origin of the machine.

G91 - Relative Positioning

Set relative position mode. In this mode all coordinates are interpreted as relative to the last position.

IMPORTANT: Not all printers appear to support this command or relative positioning.

Usage

G91

Compatibility

Which printers support this command and whether it is only supported in a file uploaded to SD card or whether it is supported when sent direct from OctoPrint via the Terminal or when printing a file:

Printer Upload File to SD Card Control/Print Directly From OctoPrint
Creator Max ? ?
Dreamer ? ?
Dreamer NX ? ?
Finder v1 ? Yes
Finder v2 ? No - does not support relative positioning
Explorer ? ?
Guider ? ?
Guider II ? No - does not support relative positioning
Guider II S ? No - does not support relative positioning
Inventor ? ?
Inventor II ? ?
Dremel 3D20 ? ?
Dremel 3D40 ? ?
Dremel 3D45 ? ?
PowerSpec Ultra 3d ? Yes

G92 - Set Position

Set the current position to the values specified. Does not move the printer but allows the effective coordinates of the printer position to be changed.

Usage

G92 E<pos> X<pos> Y<pos> Z<pos>

Parameters

E<pos> Optional. New extruder position in mm. For dual extruders the active extruder will be affected.

X<pos> Optional. New X axis position

Y<pos> Optional. New Y axis position

Z<pos> Optional. New Z axis position

Example

G92 X15 Will make the X coordinate for the current printer position be 15, but leave all the other axes unchanged.

G161 - Move Axes to Minimum

Instruct the machine to home the specified axes to their minimum position. Does not appear to be implemented on on all firmware.

Usage

G161 X Y Z F<speed>

Parameters

X Optional. Flag to go X axis minimum

Y Optional. Flag to go Y axis minimum

Z Optional. Flag to go Z axis minimum

F<speed> Optional. Speed to move at in mm per minute

Example

G161 X Y F3300

G162 - Move Axes to Maximum

Instruct the machine to home the specified axes to their maximum position. Does not appear to be implemented on on all firmware.

Usage

G162 X Y Z F<speed>

Parameters

X Optional. Flag to go X axis maximum

Y Optional. Flag to go Y axis maximum

Z Optional. Flag to go Z axis maximum

F<speed> Optional. Speed to move at in mm per minute

Example

G162 X Y F3300

M6 - Wait for Extruder

Tells printer to wait for the indicated extruder to reach its target temperature. See M104 for setting extruder temperature. Printer will not return OK or process any other commands until target temperature reached or the wait time is reached.

Usage

M6 T<extruder> S<time>

Parameters

T<extruder> Extruder number T0 for right extruder, T1 for left extruder. S<time> Optional. Max time in seconds to wait for target temperature to be reached. Default is 600s.

M7 - Wait for Platform/Heated Bed

Tells printer to wait for the heated bed to reach its target temperature. See M140 for setting bed temperature. Printer will not return OK or process any other commands until target temperature reached or the wait time is reached.

Usage

M7 S<time>

Parameters

S<time> Optional. Max time in seconds to wait for target temperature to be reached. Default is 600s.

M17 - Enable Steppers

Used to re-enable power to the stepper motors after a M18 has been issued.

Usage

M17 X Y Z A B E

Parameters

X Optional. Flag to enable X axis motor

Y Optional. Flag to enable Y axis motor

Z Optional. Flag to enable Z axis motor

A Optional. Flag to enable extruder 0 motor

B Optional. Flag to enable extruder 1 motor

E Optional. Flag to enable both extruder motors

M18 - Disable Steppers

Typically used at the end of a print to turn off power to the stepper motors, allowing the print head to be moved manually.

Usage

M18 X Y Z A B E

Parameters

X Optional. Flag to disable X axis motor

Y Optional. Flag to disable Y axis motor

Z Optional. Flag to disable Z axis motor

A Optional. Flag to disable extruder 0 motor

B Optional. Flag to disable extruder 1 motor

E Optional. Flag to disable both extruder motors

M20 - List Files on SD Card

Does not appear to be implemented, just returns OK.

M21 - Initialize SD Card

Does not appear to be implemented, just returns OK.

M23 - Print File Stored on SD Card

Select and print the named file which must already be on the printer's SD card.

Note this is different behavior from standard Marlin firmware which uses M23 to select the file on the SD card and must be followed by an M24 command to start the print.

Usage

M23 0:/user/<filename>

Parameters

File path always starts 0:/ to indicate the printer's SD card. user is the default directory where used by FlashPrint when uploading files. Directory must already exist on the card.

Example

M23 0:/user/my_widget.gx

M24 - Resume Printing From SD Card When Printer is Paused

Resumes printing from current SD card file after printer has been paused using M25.

M25 - Pause/Unpause Printing From SD Card

Pauses printing when printing a file from the printer's SD card. Issuing another M25 (should) continue printing. Seems to sometimes cause a problem if issued with M26 - if print is paused, may have to unpause by issuing another M25 before issuing the M26 cancel.

M26 - Cancel Printing From SD Card

Cancels printing a file from the printer's SD card.

M27 - Get SD Card Print Progress

Gets progress of printing a file from the printer's SD card file in the form of bytes processed/total bytes in file.

Compatibility

Which printers support this command:

Printer When printer is idle When printing from SD
Creator Max ? ?
Dreamer ? ?
Dreamer NX ? ?
Finder v1 Yes Yes
Finder v2 Yes Yes
Explorer ? ?
Guider ? ?
Guider II ? ?
Guider II S ? ?
Inventor ? ?
Inventor II ? ?
Dremel 3D20 No - Takes a very long time to respond incorrectly ?
Dremel 3D40 ? ?
Dremel 3D45 ? ?
PowerSpec Ultra 3d ? ?

M28 - Start Upload File to SD Card

Tells printer to start writing a file to its SD card. After this command is issued any data sent to the printer will be saved in the file until the M29 Stop File Write command is sent to the printer.

Usage

M28 <file size in bytes> 0:/user/<file name>

M29 - Stop File Write to SD Card

Tells printer to stop writing a file to its SD card. Used to signal to the printer that the host computer has finished sending the file to the printer. See M28

M104 - Set Extruder Temperature

Set extruder temperature. Returns immediately - ie does not block further commands while waiting for the extruder to reach temperature.

Usage

M104 S<temp> T<extruder>

Parameters

S<temp> Temperature in degrees Celsius to set the extruder to. T<extruder> Extruder number T0 for right extruder, T1 for left extruder.

Example

M104 S220 T0

M105 - Get Extruder, Bed Temperatures

Unbuffered, synchronous command

Returns list of actual and target temperatures for extruder(s) and bed (if heater installed).

Returns

For a single extruder model:

T0:25 /220 B:0 /0
ok

For a dual extruder model with heated bed:

T0:25 /220 T1:25 /220 B:25 /100
ok

M106 - Turn On Cooling Fan

Usage

M106 or M106 S<speed>

Parameters

S<speed> Speed (optional, defaults to 255), from 0 to 255. In reality the fan is either on (speed >0) or off (speed = 0). Note: M106 S0 may not work on some firmware - see M107.

M107 - Turn off Cooling Fan

Turns cooling fan off.

M108 - Select Active Extruder

Set which extruder responds to subsequent G1 commands.

IMPORTANT: Slicers such as Cura use T0, T1 as the command to select the active extruder. FlashForge printers do not appear to recognize the Tx command, so this command should be used in its place.

Usage

M108 T<extruder>

Parameters

T<extruder> Extruder number 0 or 1.

Example

M108 T0

M109 - IDEX Printers: Select Duplicate or Mirror Mode

Some printers such as the FlashForge Creator Pro 2 and Creator 3 support IDEX, ie have two extruders that are able to move independently on the X axis. The two heads can operate independently to simultaneously print two copies of a single model on the left and right halves of the build plate. You would ensure that the first print fits on the right half of build plate and the second print automatically on the left of the platform as a duplicate or a mirror image.

Usage

M109 T<mode>

Parameters

T<mode> 1 - left print will be a mirror image of the original print (which will be printed on the right). 2 - left print will be a duplicate of the original print.

Example

M109 T1

M112 - Emergency Stop

Unbuffered, synchronous command

Stop printer and empty buffer.

M114 - Get Current Position

Unbuffered, synchronous command

Gets current position of the print head

Returns

X:10 Y:10 Z:10 A:5 B:0
ok

Where A is the left extruder and B is the right extruder

M115 - Get Printer Information

Unbuffered, synchronous command

Gets name of printer, firmware version, etc

Returns

Example:

Machine Type: Flashforge Dreamer
Machine Name: My Dreamer Firmware: V1.40 20140520 SN: 2324-0000-0000
X: 230 Y: 150 Z: 140 Tool Count: 2
ok

Where the X, Y, Z values indicate the maximum values for the respective axes.

M116 - Micro Switch Trigger Monitoring?

On Finder v1 this momentarily moves the platform leveling sensor (microswitch) down to the sensing position.

Returns

Example: Dremel only?

​(​0​:​not triggered​;​ 1​:​triggered​)
ok

M117 - Query Buffer Length (Dremel only?)

On Marlin firmware this is used to send messages for display on the printer's own display panel. Sending any kind of text with this command during an SD card print on the Finder v1 causes it to disconnect.

Returns

Example: Dremel only?

(​0 to 8)​
ok

M118 - ? (used at print start)

Example

M118 X15.00 Y15.00 Z0.30 T0

M119 - Get Machine Status

Unbuffered, synchronous command

Query the current status of the machine, including endstops and move mode.

Returns

Example:

Endstop: 
X-max: 0 Y-max: 0 Z-min: 1
MachineStatus: READY
MoveMode: READY
ok

Compatibility

Which printers support this command and whether it is only supported when printing a file uploaded to SD card or whether it is supported when controlling/printing directly from OctoPrint:

Printer When Printing From SD Card When Controlling/Printing Directly From OctoPrint
Creator Max Yes ?
Dreamer Yes ?
Dreamer NX Yes ?
Finder v1 Yes Yes
Finder v2 Yes Yes - but may always return MoveMode: READY
Explorer Yes ?
Guider Yes ?
Guider II Yes Yes - but may always return MoveMode: READY
Guider II S Yes Yes - but may always return MoveMode: READY
Inventor Yes ?
Inventor II Yes ?
Dremel 3D20 Yes ?
Dremel 3D40 Yes ?
Dremel 3D45 Yes ?
PowerSpec Ultra 3d Yes Yes

M132 - Load Offsets From EEPROM?

Loads the offset of the current home position from the EEPROM and waits for the buffer to empty.

Usage

M132 X Y Z A B Where one or more parameter is supplied and represent the value to load - X, Y, Z for the respective axes, A, B for extruder 0 and 1.

Example

M132 X Y Z A

M140 - Set Hotbed Temperature

Set hotbed temperature. Returns immediately - ie does not block further commands while waiting for the hotbed to reach temperature.

Usage

M140 S<temp>

Parameters

S<temp> Temperature in degrees Celsius to set the extruder to.

Example

M140 S70

M146 - Control Enclosure Lights

Control the color and brightness of the enclosure lights using RGB values.

Usage

M146 r<red> g<green> b<blue>

Parameters

r<red> Where red is a value between 0 (no red) and 255 (full red)

g<green> Where green is a value between 0 (no green) and 255 (full green)

b<blue> Where blue is a value between 0 (no blue) and 255 (full blue)

Example

M146 r0 g0 b0  Turn lights off

M146 r0 g0 b255  Turn lights blue

M148 - Play A Piece Of Music (Dremel only?)

Usage

M148 S<music>

Parameters

S<music> Where music is a value between 1 and 8

Example

M148 S1

M150 - Set Fan Speed? Dremel only?

Example

M150 R100

M152 - Set Turbo Fan Speed? Dremel only?

Example

M152 R100

M400 - Wait for Movement to Finish

The printer will block (ie not reply to this command) until any current movement has completed, this will cause OctoPrint to stop sending commands until the printer responds.

NOTE: Certain printers will drop the connection if a command is not received after about 4s, so this command can cause connections to fail under some circumstances (eg homing) with some printers.

Usage

M400

Compatibility

Which printers support this command and whether it is only supported in a file uploaded to SD card or whether it is supported when sent direct from OctoPrint via the Terminal or when printing a file:

Printer Upload File to SD Card Control/Print Directly From OctoPrint
Creator Max Yes ?
Dreamer Yes ?
Dreamer NX Yes ?
Finder v1 Yes Yes
Finder v2 ? No - (printer does not reply)
Explorer Yes ?
Guider Yes ?
Guider II Yes ?
Guider II S Yes ?
Inventor Yes ?
Inventor II Yes ?
Dremel 3D20 Yes ?
Dremel 3D40 Yes ?
Dremel 3D45 Yes ?
PowerSpec Ultra 3d Yes Yes

M601 - Hello Command

Initiate conversation with printer.

Usage

M601 S<interface>

Parameters

S<interface> Where interface is 0 for USB, 1 for ethernet

Example

M601 S0 Connect and use USB

M602 - Disconnect Command

End control and connection with printer.

Usage

M602

M610 - Set Machine Name

Change the name of the printer that appears in response to the M115 command and also the hostname on the network (?)

Usage

M610 "New_Printer_Name"

M611 - Set Machine Extruder

Not sure what this does

M612 - Set Machine Extruder Distance

Not sure what this does

Usage

M612 X<xpos> Y<ypos>

Parameters

One or more of the parameters should be present:

X<xpos> New value for X position.

Y<ypos> New value for Y position.

M650 - Get Machine Extruder Distance

Gets current machine extruder distance. Not sure what this is?

Returns

X: 25 Y: 15
ok

M651 - Get Coordinates of the Home Position

Always returns the coordinates of the "home" position The returned values should be the same as sending the printer to its home position and then requesting the current positions:

G28  ; home all axes
M114 ; get current positions

Returns

Example

X:159.996 Y:74.9949 Z:0
ok

M652 - ? (used by Creator 3, Guider IIs, Adventurer 3, Adventurer Lite at print start)

M900 - Set LED Brightness? (Dremel only?)

Usage

M900 T<value>

Parameters

T<value> Where value is a value between 0 and 5

Example

M900 T1

M901 - Get Version Number? (Dremel only?)

Usage

M901

Returns

Example:

v1.1 20150709
ok

M907 - Set Motor Current

Current to use for each stepper motor.

Usage

M907 X<xcurr> Y<ycurr> Z<zcurr> A<acurr> B<bcurr>

Parameters

One or more of the parameters should be present:

X<xcurr> Current for X axis motor.

Y<ycurr> Current for Y axis motor.

Z<zcurr> Current for Z axis motor.

A<acurr> Current for extruder 0.

B<bcurr> Current for extruder 1.

Example

M907 X100 Y100 Z60 A100

⚠️ **GitHub.com Fallback** ⚠️