Skip to content

GCodes supported

Technik Gegg edited this page May 24, 2019 · 5 revisions

GCodes supported

To control the SMuFF from within your PC or 3D printer, you can use standard GCodes. The SMuFF can handle a subset of the GCodes which usually drive a 3D printer. As soon a you connect your PC to the USB port of the i3 mini controller and fire up a terminal program (i.e. the Serial Monitor from the Arduino IDE) you'll get a "start" response as a signal the SMuFF is ready to process your commands.

Selecting tools happens by using the Tx GCode category (whereas counting starts at 0):

T2

Will select the 3rd tool/filament on the SMuFF.

There's an exception though: In contrast to the standard GCode, you can add the parameter S0 to unload the current filament before selecting the tool and S1 to load the filament after selecting the tool.

To retrieve the list of GCodes supported, simply type the first letter of the GCode category followed by [ENTER], i.e.:

M<ENTER>

will respond with:

M18	-	Motors off
M84	-	Motors off
M20	-	List SD-Card
M42	-	Set pin state
M106	-	Fan on
M107	-	Fan off
M114	-	Report current positions
M115	-	Report version
M117	-	Display message
M119	-	Report endstop status
M120	-	Enable endstops
M121	-	Disable endstops
M122	-	Report Diagnostics
M201	-	Set max acceleration
M203	-	Set max feedrate
M206	-	Set offsets
M250	-	LCD contrast
M300	-	Beep
M500	-	Save settings
M503	-	Report settings
M700	-	Load filament
M701	-	Unload filament
M999	-	Reset
M2000	-	Text to decimal
M2001	-	Decimal to text
ok

whereas

G<ENTER>

will respond with:

G0	-	Move
G1	-	Move
G4	-	Dwell
G12	-	Wipe filament
G28	-	Home
G90	-	Absolute positioning
G91	-	Relative positioning
ok

To use GCodes, you have to follow the standard specifications, which means, GCode commands must be written in capital letters. Lower case letter will not be recognized. All the GCode commands function according to the standard. Have a look at the RepRap wiki: RepRap GCode.

Differences to standard GCode

Though, some of the GCodes differ slightly from the standard and have been adopted for the SMuFF for convenience reasons. These are:

G0
G12
M119
M2000
M2001

G0 for example moves the axis given to the according tool position, i.e. G0 Y3 lets the Revolver move into position for tool 3. Only X and Y axes can be addressed by G0.

G12 is being used to control a wiper servo. The hardware wiring is described in the Wiring Page of this Wiki. This GCode accepts a list of parameters which are:

  • Sn the speed in ms for moving the servo back and forth (default: n = 200)
  • In the minimum position in degrees of the servo while wiping (default: n = 20)
  • Jn the maximum position in degrees of the servo while wiping (default: n = 45)
  • Pn the resting position in degrees of the servo (default: n = 100)
  • Rn the number of repeats or movements between min. and max. position (default: n = 0)

So, in order to use wiping, simply send at least a G12 R10 command.

M119 does not only report the endstop status, it can also be utilized to set the status of the Feeder endstop (Z) internally, which is needed in case you have set the ExternalControl parameter to true in the configuration file.

M2000 and M2001 are additional GCodes for the SMuFF which can't be found in the standard GCode. They will convert text into a decimal string or vice versa. This feature is used on the Duet3D controller board for the communication with I2C/TWI devices, which I will cover in a separate section.

The SMuFF GCode parser also eliminates all spaces while parsing. If you, for example, want to send a User Message (M117), you have to replace all spaces with an underscore character (_). Those will be then converted back to spaces by the SMuFF. Hence, you don't necessarily have to put spaces into your commands - means "T0 S1" will result in the same behavior as "T0S1".

Prusa MMU2 emulation mode

In this mode, the GCode interpreter will in addition recognize the following commands:

  • S Init command (S0-S3)
  • P Get FINDA status (P0)
  • C Push filament into extruder (C0)
  • L Load filament (Lx)
  • U Unload filament (U0)
  • E Eject filament (Ex)
  • K Cut filament (no function) (Kx)
  • X Reset (X0)
  • F Set filament type (no function) (F0)
  • R Recover from Eject (no function) (R0)
  • W Wait for user to press button (W0)

The "no function" in the description above means: There's no function executed but the SMuFF will respond with "ok".

The commands shown here, are taken from the Prusa MMU-Control source code, function process_commands.