o<m13> sub

; Move tool carousel CW until ATC zero
; Parameter #3989 is used to track if the carousel is homed (M13) (volatile)
; Parameter #3990 is used to track the current tool pocket (persistently)
; #<number_of_pockets>: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets>
(PRINT, o<m13>)

#<number_of_pockets> = 12
o110 if [EXISTS[#<_ini[atc]pockets>]]
    #<number_of_pockets> = #<_ini[atc]pockets>
o110 endif

#1 = 0

o120 while [#1 LT #<number_of_pockets>]
    #1 = [#1+1]
    #2 = #[4000+#1]
    (DEBUG, EVAL[vcp.getWidget{"rackatc"}.store_tool{#1, #2}])
o120 endwhile

M61 Q#3991 G43 H#3991

(PRINT, o<m13> endsub)
o<m13> endsub [1]

M2
