After I installed the homing switches for X and Y on the E3D toolchanger, I finally had a decent starting point to get the tools pickup and parking tuned.
Originally, I used sensorless homing but this caused changing offset values of the X- and Y positions of the machine. So the tools could not be picked up or brought home consistently after a reset.
Now, everything works fine and the X-Y values don’t change anymore after a reset.
What I did was to first make some macros for a one-off setting of the X and Y postion of the 4 Tools for the toolhead’s positioning. If you don’t do this, you have to change all X values manually in 8 macro’s every time you want to change the value of X.
This was done with a number of global variables. After defining these in a macro, they need to be called before using them. In Config.g, I made a reference to run the macro of the globals.g macro so it runs every time you boot the Duet.
In config.g, after the Tool definitions I added the M98 code to start the global definition of the used variables:
M98 P”0:/sys/globals.g” ; Make global variables in this globals.g macro
This macro file looks like this in my case and please be aware that the actual variables will differ per machine, but this may give you a starting point:
global T0_X_dock=-12.3 ; X-Parking position of Tool 0
global T0_Y_dock=225.2 ; Y-Parking position of Tool 0
global T1_X_dock=80 ; X-Parking position of Tool 1
global T1_Y_dock=225.9 ; Y-Parking position of Tool 1
global T2_X_dock=212 ; X-Parking position of Tool 2
global T2_Y_dock=226 ; Y-Parking position of Tool 2
global T3_X_dock=304.7 ; X-Parking position of Tool 3
global T3_Y_dock=225.4 ; Y-Parking position of Tool 3
The tfree 1-3and the tpre 1-3 files will then be like this for T0, and you can make the others by just fulling in T1 , T2 or T3 where it now states T0:
; tfree0.g
; called when tool 0 is freed
G91
G1 Z4 F1000
G90
;Purge nozzle
;M98 P”purge.g”
;Move In
G53 G1 X{global.T0_X_dock} Y150 F50000
G53 G1 X{global.T0_X_dock} Y200 F50000
G53 G1 X{global.T0_X_dock} Y220 F50000
;G53 G1 X{global.T0_X_dock} Y{global.T0_Y_dock} F1000
G53 G1 Y{global.T0_Y_dock} F1000
;Open Coupler
M98 P”Coupler – Unlock.g”
;fan off
M106 S0
;Move Out
G53 G1 {global.T0_X_dock} Y175 F50000
; tpre0.g
; called before tool 0 is selected
;Unlock Coupler
M98 P”Coupler – Unlock.g”
;Move to location
G1 X{global.T0_X_dock} Y200 F50000 ; was X-10.5
;Move in
G1 X{global.T0_X_dock} Y220 F50000
;Collect
;G1 X{global.T0_X_dock} Y229.2 F1000 ;was f2500
G1 Y{global.T0_Y_dock} F1000
;Close Coupler
M98 P”Coupler – Lock.g”
;WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
;if you are using non-standard length hotends ensure the bed is lowered enough BEFORE undocking the tool!
G91
G1 Z10 F1000
G90
;Move Out
G1 X{global.T0_X_dock} Y150 F10000; was 4000
And I made some macros for checking where the toolhead is positioned, right in front of the tools T0-T3:
; fit_T0.g
; called to fit the Tool just in front of the dock
G91
G1 Z4 F1000
G1 Y-10 F2000
G90
G53 G1 X150 Y100 F20000
;Move In
G53 G1 X{global.T0_X_dock} Y150 F10000
G53 G1 X{global.T0_X_dock} Y200 F10000
G53 G1 X{global.T0_X_dock} Y220 F10000
If you want to check wether you made the correct changes to globals.g, be aware that the new values in the globals.g variables macro will only be read when you reboot. [If you want to redefine the values in any other way without rebooting, you will need another type of call function.]