21 lines
973 B
Plaintext
21 lines
973 B
Plaintext
; this loads the provided tool. Syntax: M98 P"mmu/lib/load-tool.g" T<channel number>
|
|
M98 R1 ; allow this macro to be paused.
|
|
if global.mmu_selector_pos == -1 && (!exists(param.H) || param.H != 1)
|
|
abort "Home selector first"
|
|
|
|
if !exists(param.T)
|
|
abort "No Tool selected"
|
|
|
|
if global.mmu_selector_pos == param.T && global.mmu_extruder_loaded ; if we are already on the selected Tool AND the filament is already marked as loaded
|
|
echo {"Filament already loaded into tool " ^ param.T}
|
|
M99 ; End Macro here, equivalent to "return" in Java
|
|
|
|
echo "Switching to T" ^ param.T
|
|
|
|
if global.mmu_extruder_loaded ; if we still have filament loaded, unload first.
|
|
M98 P"mmu/lib/unload.g"
|
|
|
|
if !global.mmu_extruder_loaded ; check if we are unloaded now. Then:
|
|
M98 P"mmu/lib/generated/home.g" ; rehome to prevent compounding drift.
|
|
M98 P"mmu/lib/generated/select.g" S{param.T} ; Move to new position...
|
|
M98 P"mmu/lib/generated/load.g" ; and load filament from the new position. |