Touchplate G code question

i’m using a touchplate at the start of my jobs

My Z axis doesn’t raise a few mm after touching. so I went looking why.

when I was looking in the milling basic doc I noticed there is a difference in the G code between start and toolchange.

the start code says

G92 X0 Y0 ; Set Current position to 0 on the X and Y axes.
M0 Attach probe ; Pause to connect touchplate
G38.2 Z0 ; Probe down to touchplate
G92 Z0.5 ; Set new Z position to thickness of touchplate
G1 Z2 F900 ; Lift off touchplate
M0 Remove probe ; Pause and wait for touchplate removal
M106 ; This will turn on an IOT relay to start a router or vacuum

notice the G1 z2 f900

the toolchange g code says

M107 ; Turn fan 1 off IOT relay
G28 Z ; Raise Z axis
G0 X0 Y0 F2520 ; Drive to tool change side
M00 change tool, probe ; Pause to change tool and attach probe.
G38.2 Z0 ; Probe to touchplate
G92 Z0.5 ; Set Z to touchplate thickness
G00 Z5.0000 F500 ; Lift off touchplate
M00 remove probe ; Pause to remove touchplate
M106 ; Turn fan 1 on IoT relay

notice the G00 Z5.0000 F500 ; Lift off touchplate

Is this deliberate and if so what is the difference?

Personally I would not want a G1 command in a place where I want the spindle off… I would change that to a G0. Though G0 doesn’t guarantee (Or always even imply) the tool being off (Just a “rapid” move which Marlin ignores anyway.) Frankly though it’s weird, it should work to lift the tool. Maybe it’s having trouble with the higher speed (F900 v F500)?

I also tend to want to use a bigger gap. 5mm is good with the touch plate. Trusting the planner is OK, but there’s an M400 command to wait for everything to stop. I like to use this before any offset (G92) operations so that I’m sure that motion has stopped before I set any axes. Therefore I would use it before any G92 commands here. Can’t guarantee that this would make a difference.

But taking all of that into account…

M400 ; Wait for all planned moves to stop
G92 X0 Y0 ; Set Current position to 0 on the X and Y axes.
M0 Attach probe ; Pause to connect touchplate
G38.2 Z0 ; Probe down to touchplate
M400 ; Wait for planned moves to stop
G92 Z0.5 ; Set new Z position to thickness of touchplate
G0 Z5 F500 ; Lift off touchplate
M0 Remove probe ; Pause and wait for touchplate removal
M106 ; This will turn on an IOT relay to start a router or vacuum
2 Likes

Thanks Ill put the 400’s in there

My initial problem was resolved by using G00 instead of the G1.

I think the basic milling document needs to be updated. Don’t know how can do that @vicious1 ?

I’ve been using Ryan’s starter gcode for the Jackpot, which is more up to date.

https://docs.v1e.com/electronics/jackpot/?h=jackpot

1 Like

Does that work on Marlin too?

IIRC he has separate instructions for marlin.

You mean the ones in the basic milling, or others?

I think there’s an error in the basic milling one. As shown above.