G Code Reference - Mrnt/OctoPrint-FlashForge GitHub Wiki
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).
G1 E<pos> F<rate> X<pos> Y<pos> Z<pos>
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
G1 X10 Y20 Z30 E1.0 F3000
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 |
Tells the machine to pause for a certain amount of time.
G4 P<ms>
Dwell time in ms
G4 S<s>
Dwell time in s
G4 S10
Pause for 10 seconds
G28 X Y Z
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
Set absolute position mode. All coordinates from now on are absolute relative to the origin of the machine.
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.
G91
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 |
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.
G92 E<pos> X<pos> Y<pos> Z<pos>
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
G92 X15
Will make the X coordinate for the current printer position be 15, but leave all the other axes unchanged.
Instruct the machine to home the specified axes to their minimum position. Does not appear to be implemented on on all firmware.
G161 X Y Z F<speed>
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
G161 X Y F3300
Instruct the machine to home the specified axes to their maximum position. Does not appear to be implemented on on all firmware.
G162 X Y Z F<speed>
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
G162 X Y F3300
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.
M6 T<extruder> S<time>
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.
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.
M7 S<time>
S<time>
Optional. Max time in seconds to wait for target temperature to be reached. Default is 600s.
Used to re-enable power to the stepper motors after a M18
has been issued.
M17 X Y Z A B E
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
Typically used at the end of a print to turn off power to the stepper motors, allowing the print head to be moved manually.
M18 X Y Z A B E
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
Does not appear to be implemented, just returns OK
.
Does not appear to be implemented, just returns OK
.
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.
M23 0:/user/<filename>
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.
M23 0:/user/my_widget.gx
Resumes printing from current SD card file after printer has been paused using M25
.
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.
Cancels printing a file from the printer's SD card.
Gets progress of printing a file from the printer's SD card file in the form of bytes processed/total bytes in file
.
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 | ? | ? |
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.
M28 <file size in bytes> 0:/user/<file name>
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
Set extruder temperature. Returns immediately - ie does not block further commands while waiting for the extruder to reach temperature.
M104 S<temp> T<extruder>
S<temp>
Temperature in degrees Celsius to set the extruder to.
T<extruder>
Extruder number T0
for right extruder, T1
for left extruder.
M104 S220 T0
Unbuffered, synchronous command
Returns list of actual and target temperatures for extruder(s) and bed (if heater installed).
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
or M106 S<speed>
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
.
Turns cooling fan off.
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.
M108 T<extruder>
T<extruder>
Extruder number 0 or 1.
M108 T0
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.
M109 T<mode>
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.
M109 T1
Unbuffered, synchronous command
Stop printer and empty buffer.
Unbuffered, synchronous command
Gets current position of the print head
X:10 Y:10 Z:10 A:5 B:0
ok
Where A is the left extruder and B is the right extruder
Unbuffered, synchronous command
Gets name of printer, firmware version, etc
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.
On Finder v1 this momentarily moves the platform leveling sensor (microswitch) down to the sensing position.
Example: Dremel only?
(0:not triggered; 1:triggered)
ok
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.
Example: Dremel only?
(0 to 8)
ok
M118 X15.00 Y15.00 Z0.30 T0
Unbuffered, synchronous command
Query the current status of the machine, including endstops and move mode.
Example:
Endstop:
X-max: 0 Y-max: 0 Z-min: 1
MachineStatus: READY
MoveMode: READY
ok
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 |
Loads the offset of the current home position from the EEPROM and waits for the buffer to empty.
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.
M132 X Y Z A
Set hotbed temperature. Returns immediately - ie does not block further commands while waiting for the hotbed to reach temperature.
M140 S<temp>
S<temp>
Temperature in degrees Celsius to set the extruder to.
M140 S70
Control the color and brightness of the enclosure lights using RGB values.
M146 r<red> g<green> b<blue>
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)
M146 r0 g0 b0
Turn lights off
M146 r0 g0 b255
Turn lights blue
M148 S<music>
S<music>
Where music is a value between 1 and 8
M148 S1
M150 R100
M152 R100
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.
M400
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 |
Initiate conversation with printer.
M601 S<interface>
S<interface>
Where interface is 0 for USB, 1 for ethernet
M601 S0
Connect and use USB
End control and connection with printer.
M602
Change the name of the printer that appears in response to the M115
command and also the hostname on the network (?)
M610 "New_Printer_Name"
Not sure what this does
Not sure what this does
M612 X<xpos> Y<ypos>
One or more of the parameters should be present:
X<xpos>
New value for X position.
Y<ypos>
New value for Y position.
Gets current machine extruder distance. Not sure what this is?
X: 25 Y: 15
ok
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
Example
X:159.996 Y:74.9949 Z:0
ok
M900 T<value>
T<value>
Where value is a value between 0 and 5
M900 T1
M901
Example:
v1.1 20150709
ok
Current to use for each stepper motor.
M907 X<xcurr> Y<ycurr> Z<zcurr> A<acurr> B<bcurr>
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.
M907 X100 Y100 Z60 A100