Files
probe-basic-sim/configs/atc_sim/macros_sim/m13.ngc
2025-12-14 18:29:18 +01:00

43 lines
1019 B
Plaintext

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>)
(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{}])
#<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{"dynatc"}.store_tool{#1, #2}])
o120 endwhile
M61 Q#3991 G43 H#3991
(PRINT, o<m13> endsub)
o<m13> endsub [1]
M2