This page gives RepRapFirmware’s M-codes from M104 to
M304 that set temperatures, wait for them, drive fans and tune heaters,
from the Duet3D G-code dictionary as read on 3 December 2026. Version numbers are
RepRapFirmware (RRF) versions. Other job codes are on
RepRapFirmware jobs, files and
power.
M104 and M109: tool temperature
| Code | Parameters | Effect |
|---|---|---|
M104 | S temperature, T tool number (optional) | Set the tool’s active and standby temperatures and carry on without waiting. With no T and no active tool, the lowest numbered tool (0 or above) is used. A tool that was off is also put on standby, so it heats up |
M109 | S temperature, waited for only while heating; or R, waited for while heating or cooling; T tool number (optional) | Set the temperature and wait until within 1.5 °C of it. It always selects a tool: the one in T, else, if none is selected, the lowest numbered one |
Both are deprecated in RRF but widely written by slicers, so they remain supported.
G10 or M568 give separate active and standby
temperatures; M109 corresponds to that followed by M116.
M109 does not wait for temperatures below 40 °C, which may never be
reached; to wait for cooling, give 41 or more.
M104 S220 T1 ; tool 1, do not wait
M109 S215 ; current tool, wait
M105, M108 and M116: read, cancel and wait
M105 (no parameters) reports the current and target temperatures in
degrees Celsius of all active heaters. M409 gives status as JSON.
M108 (no parameters) breaks out of the wait of M109,
M116, M190 or M191, and the job carries
on. It has to come from an input channel that the waiting command is not blocking.
Used carelessly, it can start printing without extrusion (with cold extrusion
prevention, M302) or jam a cold nozzle (without it).
M116 parameter | Meaning |
|---|---|
| none | Wait for all bed, chamber and tool heaters. From 3.5.0 only the tool heaters of the selected tool of the selected motion system; from 3.7.0 the tools of the calling motion system and those no motion system is using, plus bed and chamber |
P | Tool number. From 3.7.0 a list such as P0:1, and P without a value means all tools |
H | Heater number or list, such as H0:1 |
C | Chamber number or list; C alone means all chamber heaters |
S | Tolerance in °C, default 1.5 (2.02 and 1.23 and later) |
M116 too ignores targets below 40 °C.
M140, M144 and M190: heated bed
| Code | Parameters | Effect |
|---|---|---|
M140 | P bed slot, default 0 (1.20 and later); H heater number, or from 3.7 a colon separated list controlled together; S active temperature; R standby temperature | Assign heaters to a bed slot (H-1 removes them), or set temperatures without waiting. A target of −273 or less switches the heater off (in 3.3 and earlier it had to be below −273) |
M144 | P bed slot (1.20 and later); S0 standby (default), S1 active | Switch the bed between its two temperatures |
M190 | S temperature, waited for while heating; R temperature, waited for while heating or cooling; P bed slot (1.20 and later) | Set the bed temperature and wait. Targets below 40 °C are not waited for |
In RRF 3, M140 with H (other than H-1)
belongs in config.g, after the M950 that creates the
heater and before any M143 for it.
M140 H0 ; slot 0 uses heater 0
M140 S65 R40 ; active 65, standby 40
M140 S-273.1 ; off
M141 and M191: chamber
| Code | Parameters | Effect |
|---|---|---|
M141 | P chamber slot, default 0 (2.03 and later); H heater number, from 3.7 optionally a list such as H3:4; S active and R standby temperature | Assign a chamber heater, or set the temperature without waiting |
M191 | S (waits while heating) or R (heating or cooling); P chamber slot, default 0 (1.20 and later) | Set the chamber temperature and wait |
The ordering rule of M140 applies to M141 H too. From 3.7
a chamber heater has its own default model (30 seconds dead time) and a default
limit of 100 °C; earlier it took the bed defaults, with a limit of 125 °C. How many
bed and chamber heaters exist depends on board and version.
M143: temperature monitors
| Parameter | 3.01 and later |
|---|---|
H | Heater to monitor, default 1 (normally the first hot end) |
S | Temperature limit |
P | Monitor number, default 0; most builds have three per heater |
T | Sensor watched; by default the one controlling the heater (M308) |
A | Action: 0 heater fault (default), 1 switch off for good, 2 switch off temporarily, 3 shut down the printer |
C | Condition: 0 too high (default), 1 too low, −1 monitor disabled |
By default monitor 0 raises a heater fault when the limit is passed and monitors 1 and 2 are off.
M143 H1 P0 S275 A2 ; heater 1 off temporarily above 275
M143 H1 P1 S285 A0 ; fault above 285
| Parameter | 3.0 and earlier |
|---|---|
H | Real heater to turn off on an anomaly, default 1 |
S | Temperature limit |
P | Protection instance, default the H number; extra instances are numbered from 100 (100 to 107 on Duet 2 WiFi and Ethernet) (1.20 and later) |
X | Heater, possibly virtual, whose sensor is watched; default H (1.20 and later) |
A | 0 fault (default), 1 off for good, 2 off temporarily (1.20 and later) |
C | 0 too high (default), 1 too low (1.20 and later) |
In those versions an M143 for a bed or chamber heater comes after the
M140 or M141 that declares it.
| Version | Default maximum temperature |
|---|---|
| Before 1.13 | 300 °C for all heaters |
| 1.13 | 262 °C for all heaters |
| 1.17 | 262 °C extruders, 125 °C bed |
| 3.01 and later | 285 °C tool, 125 °C bed; chamber 100 °C from 3.7, 125 °C before |
In 1.26.1 with A0, PS_ON is triggered once a fault has
lasted for the time set by M570 S.
M106 and M107: fans
M106 parameter | Meaning |
|---|---|
P | Fan number, default 0. In RRF 3 the number given with M950; in RRF 2 it relates to the fan pin on the board |
S | Speed, 0.0 to 1.0, or above 1.0 up to 255; 0 is off |
L | Minimum speed; a lower non-zero request is raised to it |
X | Maximum speed (2.02 and later in RRF 2). Requests are scaled into it, then raised to L: with X128, S255 gives 128 and S128 gives 64 |
B | Blip: seconds at full power when starting from standstill, default 0.1 |
H | Thermostatic mode watching these sensors, colon separated (heaters in RRF 2); H-1 ends it |
T | Trigger temperature, or Toff:full for proportional control between the two (1.19 and later) |
R | Restore a speed: R1 the one at the pause, R2 the one last remembered (see below) |
C"name" | Name the fan (2.01 and later) |
F, I, A | RRF 2 only: PWM frequency in Hz (default 250; ignored on DueX2 and DueX5 fan outputs); I1 invert, I0 normal, I-1 disable the fan and free the pin for M42 (1.16 and later); A logical pin (2.02 and later). RRF 3 sets these in M950 |
Swith no other parameter sets the print cooling fans of the current tool (M563 F), or fan 0 with no active tool.- At a pause the current tool’s cooling fan speed is kept in restore point 1, at a
tool change in restore point 2 (fan 0 with no tool).
M106 R1inresume.gbrings back the first;M106 R2in atpostfile passes the speed between tools. - A thermostatic fan is on when any listed sensor is at or above
T. From 3.4 it ignoresSand runs atX(default 1.0); up to 3.3 it runs atS. - A fan watching a stepper driver temperature flag delays the over-temperature warning for those drivers for a few seconds. In RRF 2, from 1.19, virtual heaters (100 and up) can be watched.
- A Duet 2 tacho input on
PB6used by RRF 2 has to be declared inM950in RRF 3.
M950 F2 C"out6" Q100 ; fan 2 on out6, 100 Hz
M106 P2 H10:11 T40:70 ; follows sensors 10 and 11
M106 P1 T45 H1:2 X0.7 ; 70% at 45 and above (3.4 and later)
M107 turns off the current tool’s print cooling fans. It is
deprecated; use M106 S0.
M302: cold extrusion
| Parameter | Meaning |
|---|---|
P | P1 allows cold extrusion |
S | Minimum temperature to extrude, default 160 °C (2.02 and later) |
R | Minimum temperature to retract, default 90 °C (2.02 and later) |
Without parameters the state is reported. The protection needs a tool heater with a
sensor; a tool defined without a heater, as in
M563 P0 S"Pump" D0 F0, is not protected.
M301, M304 and M135: PID values
| Code | Parameters | Effect |
|---|---|---|
M301 | H heater (default 1), P, I, D | Set, or with H alone report, the PID constants, given multiplied by 255 as older firmwares expect |
M304 | H (default 0), P, I, D | As M301, for the bed |
M135 | S milliseconds | PID sample interval, 2.02 and earlier only; fixed at 250 ms from 2.03 |
M301 and M304 are deprecated and dropped from 3.7. The
firmware derives PID values from the heater model (M307, or its default
model); overriding them stops it using different values for different heating phases,
so it is not recommended. In RRF 3, M301 comes after the
M950 that creates the heater. In 1.19 and earlier,
M500 saved the overridden values.
M303: heater tuning
| Parameter | Meaning |
|---|---|
H | Heater; may be left out from 3.2 if T is given |
T | Tool whose primary heater is tuned (3.2 and later) |
S | Target temperature, at least 20 °C above ambient and below the heater’s limit |
P | Power, 0 to 1 (normally 1); default the maximum from M307 S |
A | Ambient temperature, for a heater that has not cooled down (3.2 and later) |
Y | Cycle hysteresis, 1 to 20 °C, default 5 (3.3 and later); lower is quicker for slow beds if readings are free of noise |
F | Print cooling fan power during tuning, only with T: default 0.7 in 3.4.0 to 3.6.x, 0.8 from 3.7.0 (3.3 and later) |
Q | 3.5 and later: Q0 (default) shows the resulting M307 values and a hint to save them, Q1 is quiet, for macros that save |
Tuning computes the heater model from which PID constants follow, and overshoots the
target. It runs in the background: M303 without parameters reports its
state or last result.
M303 H1 P1 S240 ; heater 1 at full power, 240 degrees
M303 T0 S205 ; tool 0's main heater
Sources
- G-code dictionary – Duet3D’s documentation of RepRapFirmware’s commands, published under a Creative Commons attribution share-alike licence; this page is written in our own words