I have Kryle VMC 500 B cnc machine and I try to fix ATC-problem.

This is mine M6-macro.
It works to that M24 function and then it alert that caption 1025 tool changer is not retracted

G91 INC
G28 Reference home position
M23 TM REF CHECK
M19 SPINDLE ORIENT
M21 TM RIGHT
M26 TOOL UNCLAMP
G0 POSITIONING
M24 TOOL SELECT
G28 Reference home position
M25 TOOL CLAMP
M22 TM LEFT
M99 Return

I try it to MDI one line at once and when that M24 came I try to pust ATC button manually and same 1025 alert cames to screen.

There is in F153 Last T# tool number
D360 Is for Tool number in spindle
and forward D361 etc. I think there is tool numbers in carousel.

Can anyone help me with this problem?