Skip to content

Instantly share code, notes, and snippets.

@nraynaud
Created February 19, 2025 15:09
Show Gist options
  • Save nraynaud/ee9696558b54023a878ab510f86a4fa1 to your computer and use it in GitHub Desktop.
Save nraynaud/ee9696558b54023a878ab510f86a4fa1 to your computer and use it in GitHub Desktop.
Duet3D configuration for multi-tool see https://www.thingiverse.com/thing:4010872
; stop.g
; called when a print is cancelled after a pause.
T-1
G1 X100 Y350 F35000
; executed by the firmware on start-up
;
; customized by hand
M80 C"pson"
; General preferences
M111 S0 ; Debugging
G21 ; Work in millimetres
G90 ; Send absolute coordinates...
M83 ; ...but relative extruder moves
M555 P2 ; Set firmware compatibility to look like Marlin
M98 P"configmotors.g"
; PROBE
M98 P"configzprobe.g"
; speed planning
M566 X100 Y100 Z100 E300 W300; Set maximum instantaneous speed changes (mm/min)
M201 X4000 Y2500 Z1500 E2000 W1000 ; Set per axis accelerations (mm/s^2)
M204 P4000 T12000 ; Set global accelerations (mm/s^2)
M203 X35000 Y35000 Z10000 W5000 E10000 ; Set maximum speeds (mm/min)
; TOOL 0 -> HEATER0
M308 S0 P"e0temp" Y"thermistor" T100000 B4388 C7.06e-8 ; tool0 temperature sensor
M950 H0 C"e0heat" T0 ; H0 uses the e0_heat pin and sensor 0
M143 H0 S280 ; Set temperature limit for tool0 to 280C
M570 H0 P30 T15 S1 ; H0 fault detection after 30 sec with 15°C error or 1 minute timeout
M950 F0 C"fan0"; fan0 is tool0 heater cooler
M106 H0 P0 S0 T70:120 L120 ; Set fan0 as thermostatic fan on heater0
M563 P0 D0 H0 S"T0 (0.4mm)"; Define tool0 as using drive E0 and heater0
G10 P0 L1 X0 Y-0 Z0.5 ; Set tool axis offsets
G10 P0 R0 S0 ; Set active and standby temperatures to 0C
; TOOL1 -> HEATER 2
M308 S2 P"duex.e5temp" Y"thermistor" T100000 B4388 C7.06e-8 ; tool1 temperature sensor
M950 H2 C"duex.e5heat" T2 ; tool1 heater
M143 H2 S280 ; Set temperature limit for tool1 to 280C
M950 F2 C"fan1"; fan2 is tool1 part cooling
M950 F3 C"duex.fan5"; fan3 is tool1 heater cooling
M563 P1 D1 H2 F2 S"T1 (0.4mm)"; Define tool1
G10 P1 L1 X-1.8 Y3.75 Z-9 ; Set tool offsets
G10 P1 R0 S0 ; Set active and standby temperatures to 0C
M106 H2 P3 S0 T70:120; Set tool cooling fan
; TOOL2 -> HEATER 3
; https://duet3d.dozuki.com/Wiki/Connecting_thermistors_or_PT1000_temperature_sensors#Section_Configuring_the_firmware
; 5071
;; M308 S3 P"duex.e6temp" Y"thermistor" T100000 B4900 ; tool2 temperature sensor E3D hot end
M308 S3 P"duex.e6temp" Y"thermistor" T100000 B4725 C7.06e-8 ; tool2 temperature sensor E3D hot end
M950 H3 C"duex.e6heat" T3 ; tool2 heater
M143 H3 S280 ; Set temperature limit for tool1 to 280C
M950 F4 C"fan2"; fan4 is tool2 heater cooling
M950 F5 C"duex.fan7"; fan5 is tool2 part cooling
M563 P2 D2 H3 F5 S"T2 (0.6mm)"; Define tool2
G10 P2 X-0.90 Y1.70 Z-3.74 ; Set tool offsets
G10 P2 R0 S0 ; Set active and standby temperatures to 0C
M106 P4 S0 T70:100 H3 L120 ; Set fan
; Tool 3
M563 P3 S"T3 (NO tool)"; Define tool3
; BED -> HEATER 9
M308 S9 P"bedtemp" Y"thermistor" A"bed temp" T100000 B3950 ; configure bed thermistor as sensor 9
M950 H9 C"bedheat" T9 ; configure bed heater H9 to use sensor S9
M143 H9 S120 ; Set temperature limit for heater H9 to 120C
M140 H9; Set H9 as bed heater
; Network
M550 Panycubic ; Set machine name
M552 S1 ; connect the wifi module to the network
M586 P0 S1 ; Enable HTTP
M586 P1 S0 ; Disable FTP
M586 P2 S0 ; Disable Telnet
; Custom settings are not configured
M564 H0 ; allow movement of un homed axes
M207 S3.0 R0.3 F60 T200
global tcSpeed=2000
; Miscellaneous
M501 ; read saved config (PID coefficients)
M584 X0 Y1 Z2:3 E9:8:7 W5 ; drive to axis allocation
M669 K1 X-1:-1:0:0 Y-1:1:0:0 ; CoreXY mode top 2 lines of matrix adapted to motor directions
M208 S1 X0 Y0 Z0 W0 ; Set axes minima
M208 S0 X424 Y340 Z295 W1000 ; Set axes maxima
; Endstops
M574 X1 S1 P"!xstop"
M98 P"configystop.g"
M574 Z1 S1 P"!^zstop+!^e0stop"
M574 W1 S1 P"!duex.e2stop"
; Drives
M569 P0 S0 ; Drive 0 goes backwards
M569 P1 S0 ; Drive 1 goes backwards
M569 P2 S0 ; Drive 2 goes backwards
M569 P3 S1 ; Drive 3 goes forwards
M569 P4 S1 ; Drive 4 goes forwards
M569 P5 S1 ; Drive 5 direction
M569 P6 S1 ; Drive 6 direction
M569 P7 S0 ; Drive 7 direction
M569 P8 S1 ; Drive 8 direction
M569 P9 S1 ; Drive 9 direction
M350 X16 Y16 Z16:16 E16:16:16 I1 S3; Configure microstepping with interpolation
M350 W16 I1 S3; micro-stepping
M92 X320 Y320 Z1600:1600 S64 ; Set steps per mm
M92 E100:100:100 S4; ; Set steps per mm
M92 W10 S1;
M906 X1000 Y1000 Z800 E800:800:1000 I50 ; Set motor currents (mA) and motor idle factor in per cent
M906 W800 I50; current
M84 S10 ; Set idle timeout
M915 XY S10 F1 R2 ; stall detection
M574 S1 Y1 P"!ystop" ; set endstop at min travel
M558 K0 P5 C"!e1stop" H3 F400 A5 ; Set Z probe type to switch, the axes for which it is used and the dive height + speeds
G31 P600 X0 Y0 Z7.10 ; Set Z probe trigger value, offset and trigger height
M574 S1 Y0 C"nil" ; delete Y endstop to free the pin
M558 K0 P5 C"!ystop" F10000 H0 I1 ; use the pin as a probe
G38.5 Y100 K0 ; move until the probe is off
M98 P"configzprobe.g"
M98 P"configystop.g" ; use the pin as an endstop again
; Relative positioning
G91
; Lift Z without endstop protection
G1 H2 Z2 F800
M98 P"exitdanger.g"
G1 X-420 F7000 H1
G1 Y-420 F5000 H1
; Move away from the endstops
G1 X3 Y10 F6000
; Fine home X and Y
G1 X-215 F360 H1
G1 Y-215 F360 H1
; Move away from the endstops
G1 X5 Y5 F2000
M98 P"homez.g"
G1 H1 W200 F20000 ; click anywhere
G1 W10 F20000 ; go away from the endstop
G1 H1 W200 F800 ; come to the endstop
G0 W11; lock tool
; homex.g
; called to home the X axis
;
; generated by RepRapFirmware Configuration Tool on Wed Nov 15 2017 23:36:04 GMT-0700 (MST)
; Lift Z relative to current position
G91 G1 Z2 F6000
G90
M98 P"exitdanger.g"
; Move quickly to X axis endstop and stop there (first pass)
G53 G1 X-415 F8000 H1
; Go back a few mm
G91 G1 X10 F6000
G90
; Move slowly to X axis endstop once more (second pass)
G53 G1 X-415 F500 H1
G53 G1 X2 F1000
; Lower Z again
G91 G1 Z-2 F6000
G90
; homey.g
; called to home the Y axis
;
; generated by RepRapFirmware Configuration Tool on Wed Nov 15 2017 23:36:04 GMT-0700 (MST)
; Lift Z relative to current position
G91
G1 Z2 F6000
G90
M98 P"exitdanger.g"
; Move quickly to Y axis endstop and stop there (first pass)
G53 G1 Y-415 F10000 H1
; Go back a few mm
G53 G1 Y10 F2000
; Move slowly to Y axis endstop once more (second pass)
G53 G1 Y-415 F500 H1
G53 G1 Y5 F10000
; Lower Z again
G91
G1 Z-2 F6000
G90
; Lift Z relatively to current position
G91
G1 Z0.2 F800
; S2 unload mesh map
G29 S2
; Move Z and U down until the switches triggers
G53 G1 H1 Z-405 F1000
; back off a bit
G53 G1 H2 Z1 F500
; Back to absolute positioning
G90
; touch again slowly
G53 G1 H1 Z-405 F150
; lift Z after probing, without endstop protection
G91
G1 H2 Z5 F800
G90
; pause.g
; called when a print from SD card is paused
M83 ; relative extruder moves
G1 E-10 F3600 ; retract 10mm of filament
G91 ; relative positioning
G1 Z5 F360 ; lift Z by 5mm
G90 ; absolute positioning
M98 P"exitdanger.g"
G1 X50 Y300 F35000
G91 ; relative positioning
G0 Z50; lift Z more
; M25 ; pause
M300 S300 P100
M291 P"Stall detected"
M98 P"outdanger.g"
M117 Stall detected
G91 G1 Y150 Z2 F500
G92
G53 G1 H1 X-500 F5000
G53 G1 X3 F5000
G53 G1 H1 X-10 F500
G53 G1 H1 Y-500 F5000
G53 G1 Y3
G53 G1 H1 Y-10 F500
; resume.g
; called before a print from SD card is resumed
G1 R1 Z5 F6000 ; go to 5mm above position of the last print move
G1 R1 ; go back to the last print move
M83 ; relative extruder moves
G1 E10 F3600 ; extrude 10mm of filament
; sleep.g
; called when M1 (Sleep) is being processed
T-1
G28
; removed because of tool changer
; M98 P"probe_and_load_map.g"
; stop.g
; called when M0 (Stop) is run (e.g. when a print from SD card is cancelled)
G53 G0 X0 Y0 W1 F{global.tcSpeed}; open dock
G53 G0 X68 Y0 W4 F{global.tcSpeed}; open dock
G53 G0 X138 Y0 W13.5 F{global.tcSpeed}; open dock
G53 G0 X212.5 Y0 W14.5 F{global.tcSpeed}; open dock
G1 E-20 F{global.tcSpeed}
M98 P"t/beforetool.g"
G91 ; relative positioning
G0 Z2 F{global.tcSpeed}; lift Z
G90 ; absolute positioning
M913 Y200 X200 W200 ; bump Y axis current
M208 Y-80 S1 ; open axis minimum
G0 F50000
G91 ; relative positioning
G0 Z2 F{global.tcSpeed}; lift Z
G90 ; absolute positioning
M913 X200 Y200; bump axis current
M208 Y-80 S1 ; Set axis minimum
G91 G1 W10 ; lock dock in relative mode
G90
M98 P"t/gottodock.g"
G53 G0 Y-60 F{global.tcSpeed}
M913 Y100 X100 W100; restore current
M208 Y0 S1 ; Set axis minimum
G53 G1 Y-4 F{global.tcSpeed} ; get close to the limit
M98 P"exitdanger.g" ; ensure we are out, even with skipped steps
G28 XY ; re-home in case we lost steps
G53 G0 Y-60 F{global.tcSpeed}
G53 G1 Y-65 F{global.tcSpeed}
M703 ; load filament parameters
G0 Z2 R2 F40000; lift higher than the print, with the new offset
G53 G1 Y-60 F{global.tcSpeed}
M913 X100 Y100 W100; axis current
M208 Y0 S1 ; Set axis minimum
G53 G1 Y-4 F{global.tcSpeed} ; get close to the limit
M98 P"exitdanger.g"
G53 G1 H1 F500 Y-10 ; home Y
;G53 G0 X3 F40000
G28 XY ; re-home in case we lost steps
;G0 F35000 X200 Y30
; called when tool 0 is freed
M98 P"t/beforefreeall.g"
G0 F{global.tcSpeed}
M98 P"t0.g"
M98 P"t/freeall.g"
; called when tool 1 is freed
M98 P"t/beforefreeall.g"
G0 F{global.tcSpeed}
M98 P"t1.g"
M98 P"t/freeall.g"
; called when tool 2 is freed
M98 P"t/beforefreeall.g"
G0 F{global.tcSpeed}
M98 P"t2.g"
M98 P"t/freeall.g"
; called when tool 3 is freed
M98 P"t/beforefreeall.g"
G0 F{global.tcSpeed}
M98 P"t3.g"
M98 P"t/freeall.g"
; called after tool 0 has been selected
M98 P"t/postall.g"
G1 E20 F{global.tcSpeed}
; called after tool 1 has been selected
;
M98 P"t/postall.g"
G1 E20 F{global.tcSpeed}
; called after tool 2 has been selected
;
M98 P"t/postall.g"
G1 E20 F{global.tcSpeed}
; called after tool 2 has been selected
;
M98 P"t/postall.g"
G1 E20 F{global.tcSpeed}
M98 P"t/beforetoolmove.g"
G0 F{global.tcSpeed}
;G0 X5
;G28 X
M98 P"t0.g"
M98 P"t/gottodock.g"
M98 P"t/beforetoolmove.g"
G0 F{global.tcSpeed}
M98 P"t1.g"
M98 P"t/gottodock.g"
M98 P"t/beforetoolmove.g"
G0 F{global.tcSpeed}
M98 P"t2.g"
M98 P"t/gottodock.g"
M98 P"t/beforetoolmove.g"
G0 F{global.tcSpeed}
M98 P"t3.g"
M98 P"t/gottodock.g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment