M2 / (Alert, ) doesn't finish movement

More
05 Apr 2022 15:34 - 06 Apr 2022 08:20 #239347 by moh
Hi,
I've made a macro (sub) which checks if tools are broken, by measuring height on a toolsetter.

After measuring and calculating tool length, i run a G0 motion command to retract the tool, and then an IF statement where I check if the tool length is wrong. If it is wrong I end the program using M2 or (Alert, Message) .

However the G0 retract motion is not executed. I feel like the M2 and (Alert, ) commands don't wait for the motion command to finish.
Is this expected behavior, and is there anything i can do to ensure the motion commands finishes before ending the program?


o<tool_check> sub

; Move to probe position
o301 if [EXISTS[#<_ini[TOOL_PROBE_POSITION]X>] EQ 0]
(ABORT, Missing <_ini[TOOL_PROBE_POSITION]X> in ini file)
M2
o301 endif
g53 g0 X #<_ini[TOOL_PROBE_POSITION]X>
g53 g0 Z #<_ini[TOOL_PROBE_POSITION]Z>

; Cancel current offsets
G59 ; Switch to G59 coordinate system (used for tool probing)
G49 ; Cancel tool length compensation

; Probe Tool
M64 P #<_ini[PINS]ENABLE_TOOLSETTER>
G91
G38.2 F500 Z-115 ; Probe along Z
#<tool_length_offset> = [#5063 - #<_ini[TOOL_PROBE_POSITION]REFZ>] ; Tool length offset = ref-z - probe-z (#5063)
G90
M65 P #<_ini[PINS]ENABLE_TOOLSETTER>

; Move Clear
G53 G0 Z0 

; Return offsets
G54 ; Switch to G54 coordinate system
G43

; Evaluate tool length
o302 if [ [ [#5403 - #<tool_length_offset>] LT -0.1] or [ [#5403 - #<tool_length_offset>] GT 0.1] ]
(print, Tool length: #<tool_length_offset> != Tool table: #5403)
(ABORT, Measured tool length does not match tool table)
m2 ; Not neede when using ABORT
o302 endif
(print, Tool length: #<tool_length_offset> == Tool table: #5403)

o<tool_check> endsub
M2
Last edit: 06 Apr 2022 08:20 by moh.

Please Log in or Create an account to join the conversation.

More
05 Apr 2022 15:50 #239350 by andypugh
This might not be the problem, but should:
; Move Clear
G0 Z0

be
; Move Clear
G53 G0 Z0

Please Log in or Create an account to join the conversation.

More
06 Apr 2022 08:20 #239421 by moh
It's actually already like that, its just in a sub command, and i copied it wrong to the forum.
I fixed the first post to show this.

Please Log in or Create an account to join the conversation.

More
06 Apr 2022 09:37 #239429 by MaHa
Did you try already to retract from the toolsetter before turning it off with M65?

Please Log in or Create an account to join the conversation.

Time to create page: 0.062 seconds
Powered by Kunena Forum