@pfn
I have three macros:
- TFREEMASTER.G invoked by all tfreex.g
- TPREMASTER.G by tprex.g
- TPOSTMASTER.G by tpostx.g
you could enter in tpostmaster:
M98 P "ercf / lib / load-tool.g" T{state.currentTool}
as far as temperatures are concerned, I manage them with 6 global variables:
global ToolF; first layer temperature tool
global ToolC; temperature toolchange
global ToolT; first layer temperature tool
global ToolS; standby temperature
global bedH; first layer bed temperature
global bedB; temperature bed
these variables are set by "/ filaments / <filament-name> /config.g", where I can possibly also insert pressureadvance and more, the template I use is
0:/filaments/ABS/config.g
;-----------------------------------
var firstlayertemp=240
var layertemp=235
var standbytemp=180
var toolchangetemp=234
var firstlayerbed=103
var layerbed=95
;-----------------------------------
set global.toolF=var.firstlayertemp
set global.toolT=var.layertemp
set global.toolS=var.standbytemp
set global.toolC=var.toolchangetemp
if global.isfirstBedHeat && global.setBed
set global.bedH=var.firstlayerbed
set global.bedB=var.layerbed
set global.isfirstBedHeat=false
i don't need load.g and unload.g of the filament
the temperature of the tool and of the bed is set by a macro that I inserted in the start gicode of the slicer and at the tool change. In superslicer I put this:
;Start G-code
M83
set global.slicer=3
set global.layercount=0
{if wipe_tower}set global.slicerwipe=true{endif}{if !wipe_tower}set global.slicerwipe=false{endif};wipetower
T[current_extruder]
M703
M98 P"/sys/DEFAULTS/heatup.g"
M116
;end start
;BEFORE_LAYER_CHANGE
G92 E0.0
{if layer_num>0}set global.layercount=[layer_num]{endif}
;[layer_z]
;AFTER_LAYER_CHANGE
;SET LAYER COUNT
{if layer_num<2}{if layer_num>0}M98 P"/sys/DEFAULTS/heatup.g"{endif}{endif}
;TOOL CHANGE G-CODE
T[next_extruder]
for CURA I have to initialize the global.layercount to -1 in the start and then pass in post processing script:
set global.layercount = {global.layercount + 1}
of course you have to set ALL the temperatures of ALL the materials to 0 in superslicer to let the printer manage everything!
in this way and setting the tools in config.g with:
M584 X0 Y1 Z2:9 E3:3:3:3:3 U4 V8 P5
M563 P0 S"E1 " D0 H1 F2 ; Define tool 0 P=tool number, D=driver number, H=heather, F= fan
M563 P1 S"E2 " D1 H1 F2 ; Define tool 1
M563 P2 S"E3 " D2 H1 F2 ; Define tool 2
M563 P3 S"E4 " D3 H1 F2 ; Define tool 3
M563 P4 S"E5 " D4 H1 F2 ; Define tool 4
;M563 P99 S"SUPPORT" D5 H2 F2 ; Define tool 99
I can have the materials assigned to each tool and with a flag variable that disables the execution of the tool change macros outside of printing I can change the material from the web interface to any tool (obviously not for the one currently loaded, for that I disable the flag to physically perform the unloading and loading).
in start.g the tool actually loaded is always selected.
the slicer only deals with the management of the fans as they are strictly linked to the gcode and the material, I don't think it can be left to the firmware to manage it ...
my only current problem is that when i change filament with ATX off the printer tries to heat the tool and i have a temp fault, i could not understand where i went wrong as the heater should stay off, as soon as i have time i investigate, for now it is a manageable problem.