This is a list of currently implemented G-Codes in Prusa Buddy firmware for MINI/MINI+/XL/MK4/MK3.5 printers. The description is available only for Prusa Research-specific G-codes or the ones having a specific implementation. Since, Prusa Buddy firmware uses a fork of Marlin 2 firmware, the generic G-codes should be Marlin-compatible and their description can be found in Marlin documentation or on RepRap Wiki.
Performs the precise homing. (with no MBL, even without the stadard W parameter)
G28 issued without parameters homes the MMU3 as well. (invalidates the homing flags of Selector and Idler. These will perform homing async once it is considered safe, i.e. no filament in the selector)
Parameters:
X, Y, Z: home the individual axes.
C: home Z-axis only
P: just invalidate the selector's homing validity flag
I: just invalidate the idler's homing validity flag
(For iX printers only) A workspace is an XYZ offset to the machine native space. All workspaces default to 0,0,0 at start, or with EEPROM support they may be restored from a previous session. G92 is used to set the current workspace's offset.
G64 - Measure Z-Axis height
Measure the Z length and saves the max_z_pos into EEPROM. Then, it shows the results on the serial line.
Parameters:
D: Additional z offset
Examples:
G64 : Measure the Z length, save the measurement, show results on the serial line.
G64 D0.2 : Execute the G64 command but add extra 0.2 to the measurement.
G65 - Advanced homing/part measurement
(For iX printers only) Homing to any endstop. Supports separate home positions in CNC workspaces(G54-G59.3)(enabled by defining CNC_COORDINATE_SYSTEMS in advanced config) Only supports homing of one axis at a time
Use: G65 [AXIS][ENDSTOP] D[DIRECTION][DISTANCE] [AXIS] Axis to home(X, Y, Z, E) [ENDSTOP] Target endstop number. [DIRECTION] Direction of homing '+' for positive or '-' for negative direction [DISTANCE] Distance to travel. If endstop is not reached within this distance, motion will stop and position will not be updated to endstop position.
M125 - Store current position and move to parking position.
Called on pause (by M25) to prevent material leaking onto the object. On resume (M24) the head will be moved back and the print will resume. When not actively SD printing, M125 simply moves to the park position and waits, resuming with a button click or M108. Without PARK_HEAD_ON_PAUSE, the M125 command does nothing.
Set display LED color and animations. Color input supports RGB and HSV format. LED strips on MK3.5, MK3.9, MK4, MINI, MINI+ and XL machines are not user-configurable from a G-code!
D: duration in milliseconds, iX printer only: set to 0 for infinite duration
T: transition in milliseconds (fade in / fade out) - Fade in is counted toward duration, so if duration is greater than 0 and less than transition, the effect doesn't reach full color intensity. - Fade out is not counted towards the duration.
Enable/Disable Bed Leveling and/or set the Z fade height.
Parameters:
S[bool] Turns leveling on or off
Z[height] Sets the Z fade height (0 or none to disable)
V[bool] Verbose - Print the leveling grid * With AUTO_BED_LEVELING_UBL only:
L[index] Load UBL mesh from index (0 is default)
T[map] 0:Human-readable 1:CSV 2:"LCD" 4:Compact
C Center mesh on the mean of the lowest and highest (With mesh-based leveling only)
M428 - Apply current_position to home_offset
Set home_offset based on the distance between the current_position and the nearest "reference point." If an axis is past center its endstop position is the reference-point. Otherwise it uses 0. This allows the Z offset to be set near the bed when using a max endstop. M428 can't be used more than 2cm away from 0 or an endstop. Use M206 to set these values directly.
S<n>: 0 disable 1 enable With no parameter, shows the state of EMotorStallDetector on the serial line.
M593 - Set parameters for input shapers.
Set parameters for input shapers.
Parameters:
D: Set the input shaper damping ratio. If axes (X, Y, etc.) are not specified, set it for all axes. Default value is 0.1.
F: Set the input shaper frequency. If axes (X, Y, etc.) are not specified, set it for all axes. Default value is 0Hz - It means that the input shaper is disabled.
T[map]: Set the input shaper type, 0:ZV, 1:ZVD, 2:MZV, 3:EI, 4:2HUMP_EI, and 5:3HUMP_EI. Default value is 0:ZV.
R<reduction>: Set the input shaper vibration reduction. This parameter is used just for 3:EI, 4:2HUMP_EI, and 5:3HUMP_EI. Default value is 20.
X<1>: Set the input shaper parameters only for the X axis.
Y<1>: Set the input shaper parameters only for the Y axis.
Z<1>: Set the input shaper parameters only for the Z axis.
A<frequency>: Set the input shaper weight adjust frequency delta.
M<mass>: Set the input shaper weight adjust mass limit.
W<1>: Write current input shaper settings to EEPROM.
U[distance]: Retract distance for removal (manual reload)
L[distance]: Extrude distance for insertion (manual reload)
B[count]: Number of times to beep, -1 for indefinite (if equipped with a buzzer)
T[toolhead]: Select extruder for filament change
A: If automatic spool join is configured for this tool, do that instead, if not, do manual filament change * Default values are used for omitted arguments.
S"Filament": save filament by name, for example S"PLA". RepRap compatible.
W: Preheat - W255: default without preheat - W0: preheat no return no cool down - W1: preheat with cool down option - W2: preheat with return option - W3: preheat with cool down and return options Default values are used for omitted arguments.
W: preheat with options to show additional cooldown and return buttons - W'-1': default without preheat - W0: preheat no return no cool down - W1: preheat with cool down option - W2: preheat with return option - W3: preheat with cool down and return options
Xn: reset where n means: 0 - issue an X0 command via communication into the MMU (soft reset) 1 - toggle the MMU's reset pin 2 - power cycle the MMU (turn off and back on)
Sn: power off/on 0 - turn off MMU's power supply 1 - power up the MMU after being turned off S without any parameter returns 0 or 1 for current state
T: index of MMU unit (in case there are multiple - same principle like M701 Tn)
Printer verifies if the G-code is compatible with the machine.
Common parameters:
Q: get machine value. - query is done during gcode execution (printing)
P: check if supplied value matches machine value - This check is done before starting the print from file. If an incompatible feature is found, the printer shows a corresponding message. This parameter is ignored during print or if supplied via USB CDC
G-code levels refer to different versions or configurations of G-code. The G-code level determines the set of commands and parameters that the printer can understand and execute. The M862.5 command will compare the input value with the G-code level supported by the printer. If the G-code level does not match the input value, a warning or error message may be displayed.
Parameters:
Pnnnn nnnn: Gcode level
Q: Current Gcode level
When run with P<> argument, the check is performed against the input value. When run with Q argument, the current value is shown.
Example messages:
G-code sliced for a different level. Continue?
G-code sliced for a different level. Please re-slice the model again. Print cancelled.
The printer has a list of supported features. Using the M862.6 P[feature], it checks if the list of the required features in the G-code matches the features available on the printer. If an incompatible feature is found, the printer shows a corresponding message.
Allows to redefine which tools use for certain parts of the print. If a part of an object is sliced to be printed with filament 1 - but you wish to print it with filament 2 instead, this G-code helps you achieve so.
Examples:
M863 M P0 L1 : Instead of tool 0, use tool 1 M863 E1/0 : Enable/disable tool remapping M863 R : Reset tool remapping M863 : Report current tool mapping
M864 - Spool join settings
Enables to configure Spool join function, defining which material to use after the one used runs out.
Examples:
M864 J A1 B2 : When tool 1 runs out of filament, continue with tool 2 M864 R : reset any settings M864 : Report current spool join settings
Report TMC stepper driver overtemperature pre-warn flag. This flag is held by the library, persisting until cleared by M912. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
M912 - clear stepper driver overtemperature pre-warn condition flag
Clear TMC stepper driver overtemperature pre-warn flag held by the library. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
Parameters:
X, Y, Z, X1, Y1, Z1, X2, Y2, Z2, Z3 and E[index]: Specifies one or more axes to clear the flag on.
If no axes are specified, clears all.
M914 - Set StallGuard sensitivity
Parameters:
I: Index of a sensitivity value to set.
X, Y, Z: Axis code
* With no parameters, reports the current StallGuard sensitivity.
Examples:
M914 I0 Z200: Set StallGuard sensitivity for the Z-axis to 200:
M914: Print the current StallGuard sensitivity values.
M919 - TMC Config Write
Writes a value to the TMC driver’s register M919
Example:
M919 X I_HOLD_IRUN 1000
M920 - TMC Config Read
Reads a value from the TMC driver’s register M920
Example:
M920 Z SG2
M930 - Set SPI prescaler for xLCD
Set up the prescaler of the LCD perifery SPI. This is used for manipulating communication frequency during HW testing. If value was not set or was set 0, prescaler will set up 0 (frequency will be divided by 1 = unchanged).
Parameters:
[uint16] Prescaler value (0-7) is mapped internally on power of 2.
M931 - Set SPI prescaler for EXT_FLASH
Set up the prescaler of the EXT_FLASH perifery SPI. This is used for manipulating communication frequency during HW testing. If value was not set or was set 0, prescaler will set up 0 (frequency will be divided by 1 = unchanged).
Parameters:
[uint16] Prescaler value (0-7) is mapped internally on power of 2.
M932 - Set SPI prescaler for TMC
Set up the prescaler of the TMC perifery SPI. This is used for manipulating communication frequency during HW testing. If value was not set or was set 0, prescaler will set up 0 (frequency will be divided by 1 = unchanged).
Parameters:
[uint16] Prescaler value (0-7) is mapped internally on power of 2.
B: Expansion board address, default 0 - Currently unused, defined just to be reprap compatible
/: Selected BBF SFN (short file name)
M999 - Reset MCU
Prusa STM32 platform specific. Restarts after being stopped. With R parameter, resets the MCU.
Parameters:
R: reset MCU
Z: Wait for finishing planned moves, save Z coordinate and restore it after reset. - Must be combined with R parameter, doesn't work otherwise. - Z is restored only if USB flash drive is present. This strange requirement is due to coupling with power panic.
M1587 - Wi-Fi credentials
Open Wi-Fi credentials dialog. Similar to M587, but meant to be used internally.
Parameters:
I: Generate ini file
M1600 - Change filament menu
Prusa STM32 platform specific. Non-print filament change. Not meant to be used during print.
Parameters:
T: Extruder number. Required for mixing extruder.
R: Preheat Return option
U: Ask Unload type - `U0` - return if filament unknown (default) - `U1` - ask only if filament unknown - `U2` - always ask
S"Filament": change to filament by name, for example `S"PLA"`
M1601 - Filament stuck detection
Prusa STM32 platform specific
M1700 - Preheat
Prusa STM32 platform specific.
Parameters:
T: Extruder number. Required for mixing extruder. For non-mixing, current extruder if omitted.
W: Preheat - `W0` - preheat no return no cool down - `W1` - preheat with cool down option - `W2` - preheat with return option - `W3` - preheat with cool down and return options - default
S: Set filament
E: Enforce target temperature
M1701 - Autoload
Prusa STM32 platform specific. Not meant to be used during print.
Parameters:
T: Extruder number. Required for mixing extruder. For non-mixing, current extruder if omitted.
Z: Move the Z axis by this distance
L: Extrude distance for insertion (positive value) (manual reload) * Default values are used for omitted arguments.
M1704 - Load test
Triggers the MMU3 Loading test.
T-codes
T Toolchange
Select extruder in case of multi extruder printer (XL). Select filament position 1-5 (T0-T4) in case of MMU3.
Parameters:
F[units/min]: Set the movement feedrate
S1: Don't move the tool in XY after change
M0/1: Use tool mapping or not (default is yes)
Lx: Z Lift settings 0 =- no lift, 1 = lift by max MBL diff, 2 = full lift(default)
Dx 0 = do not return in Z after lift, 1 = normal return
Examples:
T0 : Select filament position 1 on MMU3 / Select Tool 1 on XL.
T1 : Select filament position 2 / Tool 2.
Tx - Select filament
(MMU3) Printer asks user to select a filament position. Then loads the filament from the MMU unit into the extruder wheels only.
Tc - Load to nozzle
(MMU3) Loads the filament tip from the extruder wheels into the nozzle.
Special / Other commands
P0 - Tool park
Park extruder (tool) (XL only) Pn: n index of a tool (zero based, so 0-4 like T0 and T4 for tools 1 and 5)
Parameters:
F[units/min]: Set the movement feedrate
S1: Don't move the tool in XY after change
M0/1: Use tool mapping or not (default is yes)
Lx: Z Lift settings 0 =- no lift, 1 = lift by max MBL diff, 2 = full lift(default)
Dx 0 = do not return in Z after lift, 1 = normal return
Was this article helpful?
This action is available only to registered users. Please log-in.
Question for XL users. I (and others) have created front of bed mounted brushes to clean the nozzle before a print starts. However this triggers collision detection, so in order for the startup GCode to run without the collision crashes we have to disable collison detection.Is there some gcode means of disabling the detection before the cleaning moves and then re-enabling it after the moves are completed so it'll serve it's intended function during the print? I'm thinking maybe something already present in an M500 parameter perhaps, or any other approach?
You might try playing with M916 - but this isn't enabled in normal firmware builds so: 1. You'd need to make sure the XL had TMC2130 drivers. I don't know. 2. The firmware for the buddy boards might not have this at all. 3. You'd have to break the appendix on the board to load a custom firmware build
I would suggest asking via Support for the ability to do this as a feature in a future firmware build.
If you can mount a wiper in front of every tool a simple park tool un park tool will wipe the tool. But if there can be a custom g-code that goes to the front and does a back and forth motion that would be ideal.
5 comments
Hi, do you mean web "anchors"?
1. You'd need to make sure the XL had TMC2130 drivers. I don't know.
2. The firmware for the buddy boards might not have this at all.
3. You'd have to break the appendix on the board to load a custom firmware build
I would suggest asking via Support for the ability to do this as a feature in a future firmware build.