RepRapFirmware handles multiple extruders through a tool definition mechanism. If you have multiple nozzles, you will normally define one tool for each nozzle. There is nothing to stop you defining several tools that use the same nozzle if you want, or a single tool that uses more than one nozzle.
There are normally three specified tool change macros (any of which can contain no commands if desired) that execute in this order:
If Tn is used to select tool n but that tool is already active, the command does nothing. Otherwise, the sequence followed is:
Important notes:
Example of using conditional Gcode in a tool change macro (this would usually go in tpre#.g):
if (move.axes[0].homed) ; check if X axis is homed
echo "X axis homed, continuing with tool change"
; rest of tool change commands here
else
echo "Tool change FAILED, X not homed!"
Prior to RRF 3.3, the tool change macro files are not run if the printer has not been homed since power up. This allows you to put a T0 command at the end of config.g, which is convenient if you have only one tool.
In RRF 3.3 and later, tool change macro files are run regardless of whether axes have been homed or not, and will run if Tn
is in config.g. You can either put T0 P0
in config.g (to select the tool without running any tool change files), or use conditional GCode to choose which commands are executed.
G1 R2 X0 Y0 Z2; return to 2mm above the previous saved position
G1 R2 Z0 ; drop Z to the saved position
Here is a sample tfree0.g file:
; Put G/M Codes in here to run when Tool 0 is freed
M83 ; relative extruder mode
G1 E-4 F2500 ; retract 4mm
Here is a sample tpre0.g file:
; Put G/M Codes in here to run when Tool 0 is about to be activated
G1 X0 Y0 F6000 ; move the head away from the print
Here is a sample tpost0.g file
; Put G/M Codes in here to run after Tool 0 is activated
M116 P0 ; wait for tool 0 only to reach operating temperature
M83 ; relative extruder mode
G1 E4 F2500 ; undo retraction
You may not need to include the commands to retract and un-retract the filament if your slicer does that for you. As when any macro file is run, the absolute/relative axis and extruder movement states are restored to their original values when the macro file completes.
The tfree1.g, tpre1.g and tpost1.g files would be similar, except that tpost1.g would use command M116 P1. The purpose of the P parameter on the M116 command is to allow you to wait for the new tool to heat up to active temperature without also waiting for the previously-selected tool to cool down to standby temperature.
When starting up you can arrange for both tools to start heating as shown in the following example
G10 P0 S200 R150 ; Set tool 0 active and standby temperatures
G10 P1 S200 R150 ; Set tool 1 active and standby temperatures
T1 P0 ; Select tool 1 to turn it on but don't execute tool change scripts
T0 ; Select tool 0
M116 ; Wait for all temperatures to be reached
This will turn both heaters on, heating tool 0 heater to 200C and tool 1 heater to 150C. This could go in the sys/start.g file, or be generated by the slicer at the beginning of the gcode.