Someone who understands why the step below doesn't alarm.
Have tried to replace P5 to P6 but no difference.
Tried L0 to L4 no alarm.
The sequence passes the step for the message "Checking MagPos 02" appear.
Code:
o<toolchange> sub
; only unload the tool if there is a tool in the spindle
; This assumes that the carousel is already aligned correctly.
; It is important to unload the tool before shutting down the machine.
o900 IF [#<tool_in_spindle> EQ 0]
(MSG, Dual orient)
M19 R180 P1
M19 R0 P1
o900 ENDIF
(MSG, orienting)
M3 S1 ;slow down spindle before orient
G4 P3 ;dwell
M19 R0 ;align the spindle
o100 IF [#<tool_in_spindle> GT 0] ;If there is a tool in the spindle then unload
(MSG, MovingToLowerTC-Pos 01)
G53 G0 Z-88.6
(MSG, Checking MagPos 02)
M66 P5 L3 Q2 ; Check if mag pos is empty change to L0?
o103 if [#5399 EQ -1]
(MSG, Tool in Magazine! 03)
o103 endif
(MSG, Moving arm 04)
M64 P2 ; move arm in
(MSG, Waiting for arm 05)
M66 P2 L3 Q5 ; wait for arm-in = true
o104 if [#5399 EQ -1]
(abort, failed to move arm in 06)
o104 endif
G4 P1
(MSG, Starting pump 07)
M64 P3 ;Start Pump "release tool"
G4 P1.5
(MSG, Spindle air on 08)
M64 P5 ;Spindle air on
(MSG, Wating for toolrelease signal 09)
M66 P3 L3 Q2 ; wait for tool-released = true
o105 if [#5399 EQ -1]
(abort, failed to release tool 10)
o105 endif
(MSG, Air off 12)
M65 P5 ;Turn off Spindle Air
o100 ENDIF
(MSG, Moving up 13)
G53 G0 Z7
(MSG, Pump off 11)
M65 P3 ;Turn off Pump
o200 IF [#<selected_tool> GT 0]
(MSG, Unlock car 14)
M64 P1 ; unlock carousel
(MSG, Wait for unlock 15)
M66 P1 L4 Q2 ; wait for unlock "LOW signal"
o106 if [#5399 EQ -1]
(abort, failed to unlock carousel 16)
o106 endif
(MSG, starting car 17)
M68 E0 Q#<selected_pocket> ; Start "hal file" set the carousel to move to the right pocket
M64 P0 ; start carousel
G4 P2
(MSG, waiting for car 18)
M66 P0 L3 Q20 ; wait for carousel finished
o107 if [#5399 EQ -1]
(abort, failed to align carousel 19)
o107 endif
(MSG, stopping car 20)
M65 P0 ;stop carousel
(MSG, locking car 21)
M65 P1 ;lock carousel
(MSG, waiting for lock 22)
;G4 P5
M66 P1 L3 Q5 ;wait for locked=true
o108 if [#5399 EQ -1]
(Abort, failed to lock carousel 23)
o108 endif
(MSG, move arm in if not already 24)
M64 P2 ; move arm in (might already be in)
(MSG, waiting for arm 25)
M66 P2 L3 Q5 ; wait for arm-in = true
o109 if [#5399 EQ -1]
(abort, failed to move arm in 26)
o109 endif
M64 P3 ;OpenDrawbar
M66 P3 L3 Q10 ; wait for tool-released = true
o112 if [#5399 EQ -1]
(abort, Failed to activate drawbar! 27)
o112 endif
(MSG, MovingDownForAirBlast 28)
G53 G0 Z-80 ;prepForAirBlast
(MSG, AirBlast ON 29)
M64 P5 ;Spindle air on
(MSG, moving down 30)
G53 G0 Z-88.6 ;pick up the tool
M65 P3 ;TurnOffPump
(MSG, AirBlast OFF 31)
M65 P5 ;Turn off Spindle Air
o200 ENDIF
(MSG, Turn off Pump;clamp tool 32)
M65 P3 ;Turn off Pump;clamp tool
(MSG, waiting for toolLocked 33)
M66 P3 L4 Q10 ; wait for tool-released = false
O110 if [#5399 EQ -1]
(abort, failed to clamp tool 34)
O110 endif
M65 P4
(MSG, move arm out 35)
M65 P2 ; move arm back out
(MSG, waiting for arm 36)
M66 P4 L3 Q10 ; wait for arm-out = true
O111 if [#5399 EQ -1]
(abort, failed to move arm in 37)
O111 endif
o<toolchange> endsub [1]
M2