Auto lift dual extruder Z offset problem
-
Hi,
I have built a dual extruder that can lift the second (support) hotend via solenoids, and that is working fine.
For a explanation see this video and the two pics.
My Z axis positive direction moves down.
https://www.youtube.com/watch?v=fYOE01SzS9Q
!
My problem is the Gcode offsets and the direction of them.
My second extruder sits 2mm lower than the left one when actuated, and 3mm higher than the left one when not.
When i want to actuate the right extruder, i want the Z axis to first go down 5mm, actuate the solenoid, and then go 3mm back up.
herein lies the problem; when i define a T1 Z offset of 2mm like this in my config.g- ; Tools
M563 P0 S"Model" D0 H1 ; Define tool 0
G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C
M563 P1 S"Support" D1 H2 ; Define tool 1
G10 P1 X24.5 Y0 Z2.0 ; Set tool 1 axis offsets
G10 P1 R0 S0 ; Set initial tool 1 active and standby temperatures to 0C
But define my tpre0.g
- M42 P6 S255 ; activates solenoid 0 of heater output 6 to pull tool 1 up
G4 P300 ; dwell 1000 milliseconds
M42 P6 S0 ; deactivates solenoid 0 of heater output 6
G4 P300 ; dwell 1000 milliseconds to disperse residual electricity
tpre1.g
- G91 ; relative positioning
G1 Z5 F6000 S2 ; lower Z relative to current position
G90 ; absolute positioning
M42 P7 S255 ; activates solenoid 1 of heater output 7 to pull tool 1 down
G4 P300 ; dwell 1000 milliseconds
M42 P7 S0 ; deactivates solenoid 1 of heater output 7
;G4 P300 ; dwell 1000 milliseconds to disperse residual electricity
tpost0.g
- M116 P0
G91 ; relative positioning
;G1 Z-7 F6000 ;S2 ; raise Z relative to current position
G90 ; absolute positioningtpost1.g
- M116 P1
G91 ; relative positioning
;G1 Z-3 F6000 ;S2 ; raise Z relative to current position
G90 ; absolute positioningThis is as far as i have gotten.
My problem is that if i-
raise Z by 5mm again in tpost1.g after tool 1 has been selected, it only then applies the 2mm offset after it has moved 5mm back up. So theoretically it first crashes the tool into the bed before applying the tool offset.
-
if i dont apply a Z offset in config.g and only have the X and Y offset, but then raise the Z axis again by 3mm in tpost1.g, it moves right back to the same level as the first extruder after switching.
Maybe someone can help me?
This thread is the closest thing i found to my problem, he also lifts a second extruder above/below the first, unfortunately he did not post his Z offsets in config.g
https://forum.duet3d.com/topic/4414/bi-directional-dc-motor-control/4I basically want this ( in pseudo code)
If i select tool 0 (left tool):-
- M42 P6 S255 to pull tool 1 up (right tool)
- Apply the config.g tool offset to lift Z (by the 2mm) back up to the level for tool 0
if i select tool 1 (right tool)
-
- G91 ; relative positioning
G1 Z5 F6000 ; ; lower Z relative to current position for tool 1 lowering clearance
G90 ; absolute positioning - M42 P7 S255 ; Pull tool 1 down (by 2mm below the left tool)
- G4 P300 ; wait 300ms
- M42 P7 S0 ; turn solenoid off
- G4 P300 ; wait 300ms
- Raise Z again to the level defined in config.g (2mm below the left tool, height for the tool1)
- G91 ; relative positioning
Thanks
Max - ; Tools
-
Ok a different way of describing the problem:
When i first home while having T0 active,
then i activate T1 and it applies the offsets. The problem is, that now since the T1 is below the bed, the Z axis offset should read -2. But since it does not accept that, it writes it as 0 as well.
Now, when i activate T0 again, it applies that 2mm offset and now it reads Z 2, without having moved the bed.
How can I work around that? -
Ok so I think I´ve got it. I tinkered around and it seems that if i do the Z Offset as negative in the config.g file, it works. Which is weird, because the offset should really be positive.
I will post the config.g, as well as the tool change codes tomorrow (if my DWC decides to work again) for future people who have a similar problem to find.Cheers
Max -
Some things that may help you:
- Tool offsets are never applied within tpre#.g
- In firmware 2.02, tool offsets are not applied in tfree#.h or tpost#.g either. In firmware 2.03beta3 they are applied in both of those files.