Skip to content

Instantly share code, notes, and snippets.

@fitzterra
Last active January 27, 2025 17:03
Show Gist options
  • Save fitzterra/0874a5cfc9bb1440baac6448096d15de to your computer and use it in GitHub Desktop.
Save fitzterra/0874a5cfc9bb1440baac6448096d15de to your computer and use it in GitHub Desktop.
GCodes and MCodes for Repetier Firmware

Repetier Firmware G/MCodes

Reason for this gist and notes about it:

  • This is a prettified version of the Repetier-Firmware for AVR supported GCodes and MCodes as extracted from Repetier.ino in the repo.
  • The labels makes it easier for me to get a feel for the group a specific command belongs to, and makes it easy to find commands related to some specific task. This will hopefully make it a bit easier for me to get familiar with the command and possibilities.
    Note that the labels are my interpretation of the group or function a command belongs to, and that all commands are not labeled yet.
  • Some of the command descriptions in Repetier.ino are not always 100% clear, so each command has a link to the description for the command in the RepRap GCode wiki.
    NOTE: This is a best effort link since the RepRap descriptions may not always conform to the Repetier implementation, or Repetier may have commands not included in the RepRap wiki yet. Diffs, patches or comments for changes/fixes are welcome.
  • Not all commands have been checked and verified yet, so feel free to send diffs, patches or comments for changes/fixes.

Implemented Codes

Code Arguments Description Labels RepRap Wiki
G0 Will be converted to G1 - see below. move G0
G1 Coordinated Movement X Y Z E, S1 disables boundary check, S0 enables it move G1
G4 S{secs} / P{millis} Dwell S{seconds} or P{milliseconds} move, pause, dwell G4
G10 [S{1/0}] Retracts filament according to stored setting. 0=Short (default), 1=Long extruder G10
G11 [S{1/0}] Undo retraction according to stored setting. 0=Short (default), 1=Long extruder G11
G20 Units for G0/G1 are inches. setting G20
G21 Units for G0/G1 are mm. setting G21
G28 Home all axis or named axis. move G28
G29 S{0..2} Z-Probe at the 3 defined probe points. S = 1 measure avg. zHeight, S = 2 store avg zHeight probe G29
G30 P{0..3} Single z-probe at current position P = 1 first measurement, P = 2 Last measurement P = 0 or 3 first and last measurement probe G30
G31 Write signal of probe sensor test, probe G31
G32 S{0..2} P{0..1} Autolevel print bed. S = 1 measure zLength, S = 2 Measure and store new zLength probe G32
G90 Use absolute coordinates setting G90
G91 Use relative coordinates setting G91
G92 Set current position to coordinates given - no movement position G92
G131 Set extruder offset position to 0 - needed for calibration with G132 calibration G131
G132 Calibrate endstop positions. Call this, after calling G131 and after centering the extruder holder. calibration G132
G133 Measure steps until max endstops for deltas. Can be used to detect lost steps within tolerances of endstops. calibration G133
G134 Px Sx Zx Calibrate nozzle height difference (need z probe in nozzle!) Px = reference extruder, Sx = only measure extrude x against reference, Zx = add to measured z distance for Sx for correction. calibration [G134]

RepRap M Codes

Code Arguments Description Labels RepRap Wiki
M104 Set extruder target temp extruder, temp M104
M105 Read current temp extruder, temp, bed, info M105
M106 S{speed} P{fan} Fan on speed = 0..255, P = 0 or 1, 0 is default and can be omitted fan M106
M107 P{fan} Fan off, P = 0 or 1, 0 is default and can be omitted fan M107
M109 Wait for extruder current temp to reach target temp. extruder, temp M109
M114 Display current position info M114

Custom M Codes

Code Arguments Description Labels RepRap Wiki
M3 Spindle on, Clockwise or Laser on during G1 moves. spindle, laser M3
M4 Spindle on, Counterclockwise. spindle, laser M4
M5 Spindle off, Laser off. spindle, laser M5
M20 List SD card SDCard, info M20
M21 Init SD card SDCard M21
M22 Release SD card SDCard M22
M23 Select SD file (M23 filename.g) SDCard M23
M24 Start/resume SD print SDCard, print M24
M25 Pause SD print SDCard, print M25
M26 Set SD position in bytes (M26 S12345) SDCard M26
M27 Report SD print status SDCard, print, status, info M27
M28 Start SD write (M28 filename.g) SDCard M28
M29 Stop SD write SDCard M29
M30 {filename} Delete file on sd card SDCard M30
M32 {dirname} create subdirectory SDCard M32
M42 P{pin number} S{value 0..255} Change output of pin P to S. Does not work on most important pins. control M42
M80 Turn on power supply control M80
M81 Turn off power supply control M81
M82 Set E codes absolute (default) setting M82
M83 Set E codes relative while in Absolute Coordinates (G90) mode setting M83
M84 [S{seconds}] Disable steppers until next move, or use S{seconds} to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout. control, move M84
M85 Set inactivity shutdown timer with parameter S{seconds}. To disable set zero (default) control, setting M85
M92 Set axisStepsPerMM - same syntax as G92 setting M92
M99 S{delayInSec} X0 Y0 Z0 Disable motors for S seconds (default 10) for given axis. control M99
M104 S{temp} T{extruder} P1 F1 Set temperature without wait. P1 = wait for moves to finish, F1 = beep when temp. reached first time control, temp, extruder M104
M105 X0 Get temperatures. If X0 is added, the raw analog values are also written. info, temp M105
M112 Emergency kill control M112
M115 Capabilities string M115
M116 Wait for all temperatures in a +/- 1 degree range M116
M117 {message} Write message in status row on lcd M117
M119 Report endstop status status
M140 S{temp} F1 Set bed target temp, F1 makes a beep when temperature is reached the first time temp, bed
M163 S{extruderNum} P{weight} Set weight for this mixing extruder drive M163
M164 S{virtNum} P{0/1} Store weights as virtual extruder S. For P, 0=don't store in eeprom, 1=store in eeprom M164
M190 Wait for bed current temp to reach target temp. M190
M200 T{extruder} D{diameter} Use volumetric extrusion. Set D0 or omit D to disable volumetric extr. Omit T for current extruder. M200
M201 Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000) M201
M202 Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) M202
M203 Set temperture monitor to Sx M203
M204 Set PID parameter X => Kp Y => Ki Z => Kd S{extruder} Default is current extruder. NUM_EXTRUDER=Heated bed M204
M205 Output EEPROM settings M205
M206 Set EEPROM value M206
M207 X{XY jerk} Z{Z Jerk} E{ExtruderJerk} Changes current jerk values, but do not store them in eeprom. M207
M209 S{0/1} Enable/disable autoretraction M209
M220 S{Feedrate multiplier in percent} Increase/decrease given feedrate M220
M221 S{Extrusion flow multiplier in percent} Increase/decrease given flow rate M221
M226 P{pin} S{state 0/1} Wait for pin getting state S. Add X0 to init as input without pullup and X1 for input with pullup. M226
M231 S{OPS_MODE} X{Min_Distance} Y{Retract} Z{Backlash} F{ReatrctMove} Set OPS parameter M231
M232 Read and reset max. advance values M232
M233 X{AdvanceK} Y{AdvanceL} Set temporary advance K-value to X and linear term advanceL to Y [M233]
M251 Measure Z steps from homing stop (Delta printers). S0 - Reset, S1 - Print, S2 - Store to Z length (also EEPROM if enabled) M251
M280 S{mode} Set ditto printing mode. mode: 0 = off, 1 = 1 extra extruder, 2 = 2 extra extruder, 3 = 3 extra extruders M280
M281 [X0] Test if watchdog is running and working. Use M281 X0 to disable watchdog on AVR boards. Sometimes needed for boards with old bootloaders to allow reflashing. watchdog, test [M281]
M300 S{Frequency} P{DurationMillis} play frequency M300
M302 S{0 or 1} allow cold extrusion. Without S parameter it will allow. S1 will disallow. M302
M303 P{extruder/bed} S{printTemerature} X0 R{Repetitions} Autodetect pid values. Use P{NUM_EXTRUDER} for heated bed. X0 saves result in EEPROM. R is number of cycles. M303
M320 S{0/1} Activate autolevel, S1 stores it in eeprom M320
M321 S{0/1} Deactivate autolevel, S1 stores it in eeprom M321
M322 Reset autolevel matrix M322
M323 S0/S1 enable disable distortion correction P0 = not permanent, P1 = permanent = default M323
M340 P{servoId} S{pulseInUS} R{autoOffIn ms} servoID = 0..3, Servos are controlled by a pulse with normally between 500 and 2500 with 1500ms in center position. 0 turns servo off. R allows automatic disabling after a while. M340
M350 S{mstepsAll} X{mstepsX} Y{mstepsY} Z{mstepsZ} E{mstepsE0} P{mstespE1} Set microstepping on RAMBO board M350
M355 S{0/1} Turn case light on/off, no S = report status M355
M360 show configuration M360
M400 Wait until move buffers empty. M400
M401 Store x, y and z position. M401
M402 Go to stored position. If X, Y or Z is specified, only these coordinates are used. F changes feedrate fo rthat move. M402
M450 Reports printer mode M450
M451 Set printer mode to FFF M451
M452 Set printer mode to laser M452
M453 Set printer mode to CNC M453
M460 X{minTemp} Y{maxTemp} Set temperature range for thermistor controlled fan M460
M500 Store settings to EEPROM M500
M501 Load settings from EEPROM M501
M502 Reset settings to the one in configuration.h. Does not store values in EEPROM! M502
M513 Clear all jam marker. [M513]
M600 Change filament M600
M601 S{1/0} Pause extruders. Paused extrudes disable heaters and motor. Unpausing reheats extruder to old temp. [M601]
M602 S{1/0} P{1/0} Debug jam control (S) Disable jam control (P). If enabled it will log signal changes and will not trigger jam errors! [M602]
M908 P{address} S{value} Set stepper current for digipot (RAMBO board) M908
M999 Continue from fatal error. M999 S1 will create a fatal error for testing. M999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment