o 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) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> (PRINT, o) (DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"REFERENCING"}]) M64 P4 ; Move Motor FWD M66 P4 L1 Q20 ; wait for rising edge on home index o100 if [#5399 LT 0] M65 P4 ; stop motor (abort, Failed to home carousel) o100 endif #3990 = 1 M65 P4 ; Stop motor #3989 = 1 (DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{}]) # = 12 o110 if [EXISTS[#<_ini[atc]pockets>]] # = #<_ini[atc]pockets> o110 endif #1 = 0 o120 while [#1 LT #] #1 = [#1+1] #2 = #[4000+#1] (DEBUG, EVAL[vcp.getWidget{"dynatc"}.store_tool{#1, #2}]) o120 endwhile M61 Q#3991 G43 H#3991 (PRINT, o endsub) o endsub [1] M2