@phaedrux
Sorry for the delay, I've been preparing a simplified version of the config, that results in the same problem.
The problem comes when stablishing the Z offset of the tool. We have 3 diffent vertical axis (Z,U,V), but we always map the current tool to Z (see free1.g and post0.g).
The are other things that we need to work on when changing a tool, but the problem we need to solve is that when stablishing a tool Z offset. the system allow negative coordinates...
The firmware version is 3.4.beta2, each tool is driven by a 1LC, base board is a 6HD and 1XD for each servo axis.
config.g
; customPrinter firmware config file
; executed on start-up
;
;
;################################ GENERAL SETTINGS ################################
M586 P0 S1 ; enable HTTP
M586 P1 S1 ; enable FTP
M586 P2 S1 ; enable Telnet
G90 ; send absolute coordinates...
M83 ; ...but relative extruder moves
M550 P"M3dimaker2" ; set printer name
G4 S3 ; wait for expansion boards to start
M669 K0 S100 ; cartesian kinematics and segments per second
;######################### AXIS BOARD DRIVERS DECLARATIONS #########################
M569 P40.0 S1 ; physical drive 40 goes forwards X
M569 P41.0 S0 ; physical drive 41 goes forwards Y1
M569 P42.0 S0 ; physical drive 42 goes forwards Y2
M569 P43.0 S0 ; physical drive 43 goes backwards Z1 (Z)
M569 P44.0 S0 ; physical drive 44 goes backwards Z2 (U)
M569 P45.0 S0 ; physical drive 45 goes backwards Z3 (V)
M569 P20.0 S1 ; physical drive 20 goes forwards E0
M569 P21.0 S1 ; physical drive 21 goes forwards E1
M569 P22.0 S1 ; physical drive 22 goes forwards E2
; ############################## DRIVER PARAMETERS SETTINGS ##############################
; Axis configuration
M584 X40.0 Y41.0:42.0 Z43.0 U44.0 V45.0 ; axis drive mapping
M350 X1 Y1 V1 Z1 U1 V1 I1 ; configure axis microstepping with interpolation
M92 X150.53 Y150.53 Z100.12 U100.12 V100.12 ; axis steps per mm
M566 X900.00 Y900.00 Z500.00 U500.0 V500.0 ; set maximum instantaneous speed changes (mm/min)
M203 X18000.00 Y18000.00 Z12000.00 U12000.00 V12000.00 ; set maximum speeds (mm/min)
M201 X500.00 Y500.00 Z500.00 U500.00 V500.00 ; set accelerations (mm/s^2)
; Extruders configuration
M584 E20.0:21.0:22.0 ; extruders drive mapping
M350 E16:16:16 I1 ; configure extruders microstepping with interpolation
M92 E409.00:42.00:420.00; extruders steps per mm
M566 E120.00:120.00:120.00 ; set maximum instantaneous speed changes (mm/min)
M203 E1200.00:1200.00:1200.00 ; set maximum speeds (mm/min)
M201 E250.00:250.00:250.00 ; set accelerations (mm/s^2)
M906 E1000:1000:1000 I30 ; set motor currents (mA) and timeout time
;################################# Z PROBE 0 CONFIG #################################
M950 S0 C"out4" ; create servo pin 0 for solenoid on Out4
M558 P8 C"io3.in" H1 R6.5 F1200 T3000 ; set Z probe type and the dive height + speeds
G31 X0 Y0 Z5 ; set Z probe trigger value, offset and trigger height
;################################ TOOL Z PROBE CONFIG ################################
; Tool offset pin declaration here
; This probe will measure each tool offset
M558 K1 P8 C"io1.in" H1 R6.5 F1000 T2000; declare probe 1 as type 8
G31 K1 P1000 X0 Y-120 Z-1.3 ; When probe 1 value = 1000, actual position as X0, Y-120, Z-1.3
; #################################### MESH GRID ####################################
M557 X-100:100 Y-125:125 S20 ; define mesh grid
M84 S30 ; Disable motor idle current reduction
;################################## AXIS LIMITS ##################################
M208 X-200:200 Y-125:125 Z0:100 U0:100 V0:100 ; set axis minima and maxima
;M208 X-200:200 Y-125:125
;M208 Z0 U0 V0 S1
;################################# AXIS ENDSTOPS #################################
M574 X1 S1 P"!40.io0.in" ; configure active-high endstop for low end on X via pin 40.io0.in
M574 Y1 S1 P"!41.io0.in" ; configure active-high endstop for low end on Y via pin 41.io0.in
M574 Z1 S2 ; configure Z-probe endstop for low end on Z
M574 U2 S1 P"!44.io0.in" ; configure active-high endstop for high end on U via pin 44.io0.in
M574 V2 S1 P"!45.io0.in" ; configure active-high endstop for high end on V via pin 45.io0.in
;######################### PRINTER HEATERS DECLARATIONS #########################
; FDM heater
M308 S2 P"20.temp0" Y"thermistor" T100000 B4725 C7.06e-8
M950 H2 C"20.out0" T2
M307 H2 B0 R2.131 C224.9 D4.61 S1.00 V23.6
M143 H2 S280
; GEL heater
M308 S3 P"21.temp0" Y"thermistor" T100000 B4725 C7.06e-8
M950 H3 C"21.out0" T3
M307 H3 B0 R0.511 C181.9 D6.18 S1.00 V23.8
M143 H3 S140
; POWDER heater
M308 S4 P"22.temp0" Y"thermistor" T100000 B4725 C7.06e-8
M950 H4 C"22.out0" T4
M307 H4 B0 R1.622 C246.4 D5.15 S1.00 V23.9
M143 H4 S175
; Bed heater
M308 S0 P"temp1" Y"thermistor" T100000 B4725 C7.06e-8
M950 H0 C"out1" T0
M307 H0 B0 R0.419 C401.2 D2.65 S1.00 V0
M140 H0
M143 H0 S100
; Syringe preheater
M308 S1 P"temp0" Y"thermistor" T100000 B4725 C7.06e-8
M950 H1 C"out0" T1
M307 H1 B0 R0.302 C822.1 D3.84 S1.00 V24.0
M141 H1
M143 H1 S130
;########################## PRINTER FANS DECLARATIONS ##########################
; No fans yet
;######################### PRINTER TOOL DECLARATIONS ##########################
; FDM TOOL
M563 P0 S"FDM" D0 H2 F0
G10 P0 X-52 Y-58 ; set x,y offsets
G10 P0 R0 S0 ; set standby temperatures
; GEL TOOL
M563 P1 S"GEL" D1 H3 F0
G10 P1 X0 Y0 ; set x,y offsets
G10 P1 R0 S0 ; set standby temperatures
M591 D1 P1 C"21.io0.in" S1 ; filament monitor for GEL printhead, enable to call filament-error.g when pin detected
; POWDER TOOL
M563 P2 S"POWDER" D2 H4 F0
G10 P2 X0 Y0 ; set x,y offsets
G10 P2 R0 S0 ; set standby temperatures
T-1 ; Unselect tool
toolZOffset.g
;
; param.A -> tool N
T{param.A} ; select the tool
G90; absolute positioning
G1 X0 Y-120 F1000 ; go to swith position
M400 ; wait
; move Z until switch triggered
; https://duet3d.dozuki.com/Wiki/Gcode#Section_G30_Single_Z_Probe
G30 K1 S-2 ; Probe 1. When triggered, set Z offset of the current tool.
echo "Actual position - ", {move.axes[2].machinePosition}
G92 Z-0.3
G1 H4 Z100 F800; lift after probing
G1 X0 Y0 F2000; go to X0 Y0
free1.g
G91 ; relative positioning
G1 Z105 F2000 ; lift U
G90 ; absolute positioning
M400 ; wait movement
G60 S2 ; store coordinate in restore point 2
M584 Z43.0; remap Z to original axis
post1.g
M584 Z44.0 ; remap U drive to Z axis