Initial Tool select, no tpost0.g?
-
Hi *,
Is it possible that the tpree/post0.g is not getting executed when the tool is selected after the start of the firmware?
I have some M118s in my config files and I do not see that the tpost0.g gets executed when I select the tool in my start routine. Is that the case? (It works if I do a T-1 and T0 after a finished test print.
Cheers, Chriss
-
@Chriss put a couple echo commands in them and see if it gets printed in either DWC, PD, the console or log (if you have log enabled).
For example:
echo "tfree0 start"
&echo "tfree0 end"
echo "tpost0 start"
&echo "tpost0 end"
-
That is what I did... well, I used M118 S"" for that and I can see that the tpost0.g did not get executed. :?
Here a example of the start code:
---------------------------------------- start2.g Wait for the bed to reach temp :: Done - Bed is warm now Wait till bed corner has 80% temp :: Done - Bed corner is warm now Stepper current high Set the tool to {global.tool_initial} Done Wait for the tool to reach temp Set Tool first layer temp 1 2 ---------------------------------------- End of start2.g Done printing file Finished printing file 0:/
And this is how it looks when I select the tool manually:
t No tool is selected ok t0 ---------------------------------------- tpre0.g ---------------------------------------- tpre0.g END ---------------------------------------- tpost0.g K1 true K1a K2 ---------------------------------------- purge_lineL.g Some settings L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11 L12 L13 ---------------------------------------- purge_lineL.g END K3 K4 ---------------------------------------- tpost0.g END
I expect the 2nd block after "Set the tool to {global.tool_initial}" in the fist block because of:
; Set the initial tool: M118 S"Set the tool to {global.tool_initial}" T{global.tool_initial} M118 S"Done"
Cheers, Chriss
-
@Chriss Uhm, it would be easier to get what you try to achieve if you posted the content of your toolchange files tbh (if they're not under NDA or something).
They get executed in order no matter what when
Tn
is deployed as long as there aren't any arguments blocking them. -
Well, the setup is a but unusual and it would take a while to explain I guess... So I tried to cut it as sort as possible. Let me know if something is unclear:
Setup: IDEX printer, and it is not clear which toll is the first to use. So the code must be Tool agnostic. Both tools should print a purge line IF it is the first layer.The start.g does nearly doe nothing:
;if global.debug = true ; M118 P3 L1 S"Start.g S" M118 S"---------------------------------------- start.g" M106 P3 S255 ; Turn on LED G28 ; Home G1 Z20 X0 Y70 F5000 ; Move out of the way ;G1 Z15 F5000 ; lift nozzle G29 S1 ; Load the height map ;Prime the extruder ;G92 E0 ;G1 F200 E3 ;G92 E0 ; Tell the extruders to do the purge lines set global.do_purgeL=true set global.do_purgeR=true ;if global.debug = true ; M118 P3 L1 S"Start.g END" M118 S"---------------------------------------- start.g END"
The slicer Start G-Code sets oll the needed variables and startes the start2.g to select the tool etc:
;##################### Start g-Code set global.tool_temp_initial={first_layer_temperature[initial_extruder]} set global.bed_temp_initial=[first_layer_bed_temperature] set global.tool_initial=[initial_extruder] set global.tool0_inital=[first_layer_temperature_0] set global.tool1_inital=[first_layer_temperature_1] set global.tool0_all=[temperature_0] set global.tool1_all=[temperature_1] set global.tool0_standby={filament_toolchange_temp[0]} set global.tool1_standby={filament_toolchange_temp[1]} M98 P"/macros/print_scripts/start2.g" ;##################### End of Start g-Code
The start2.g looks like that:
; ##################### Custom Start G-Code M118 S"---------------------------------------- start2.g" M118 S"Wait for the bed to reach temp" M190 S{global.bed_temp_initial} M118 S":: Done - Bed is warm now" M290 S0 R0 ; Set the babysteps back to zero ; Wait till the corner sensor has reached 80% of the bed M118 S"Wait till bed corner has 80% temp" M98 P"/macros/print_scripts/bed_wait_till_80percent.g" M118 S":: Done - Bed corner is warm now" ; Clean the nozzle ;M118 S"Clean the nozzle" ;M98 P"/macros/print_scripts/nozzle_clean.g" ; Autoz plugin ;M118 S"AutoZ" ;M98 P"/macros/autoz/autoz.g" M118 S"Stepper current high" M98 P"/macros/print_scripts/xy_current_high.g" ; Set the initial tool: M118 S"Set the tool to {global.tool_initial}" T{global.tool_initial} M118 S"Done" M118 S"Wait for the tool to reach temp" M116 P{global.tool_initial} ; set hotend temperature and wait for it to be reached M118 S"Set Tool first layer temp" ;M109 S{global.tool_temp_initial} ; Opsolete M118 S"1" M568 P{global.tool_initial} S{global.tool_temp_initial} A2 ; Tool (P) to Inistial temp (S) and active (A2) M118 S"2" M116 ; Wait for the tool to reach temp set global.do_purgeL=true set global.do_purgeR=true ; From Slicer G21 ; set units to millimeters G90 ; use absolute coordinates M82 ; use absolute distances for extrusion M118 S"---------------------------------------- End of start2.g"
Lets assume that {global.tool_initial} is "0" in our case, I would expect that the "T0" in line 30 would start the tpre1 and tpost1. So this code should be executed:
; tpost0.g ; called after tool 0 has been selected ; G21 ; set units to millimeters G90 ; use absolute coordinates M83 ; use relative distances for extrusion M118 S"---------------------------------------- tpost0.g" M83 ; relative extrusion mode M106 R2 ; restore print cooling fan speed ; Set the tool temeratures based on the layer if move.axes[2].machinePosition < 0.1 M568 P0 S{global.tool0_inital} R{global.tool0_standby} A2 else M568 P0 S{global.tool0_all} R{global.tool0_standby} A2 M116 P0 ; Wait for tool 0 heaters to reach operating temperature M83 ; relative extruder movement G1 E0.5 F3600 ; extrude 0.5mm ; print the purge line when it is the first layer M118 S"K1" echo global.do_purgeL M118 S"K1a" if global.do_purgeL = true M118 S"K2" M98 P"/macros/print_scripts/purge_lineL.g" M118 S"K3" set global.do_purgeL=false M118 S"K4" M118 S"---------------------------------------- tpost0.g END"
But you remember the code from the previous posting? I did not even see the output of "M118 S"---------------------------------------- tpost0.g"" So I guess that the tpost.g did not got executed.
Not even the tpre1.g got executed, that looks like:; tpre0.g ; called before tool 0 is selected M118 S"---------------------------------------- tpre0.g" M118 S"---------------------------------------- tpre0.g END"
Did you got me?
That brought me to the conclusion that the tpre scripts does not get executed somehow after a print start. All of that works when I reselect the T0 after I did a T-1 at my stop.g code. (Or manually obviously.)
Btw: Mini 5+ and 3.5.0-rc.3 (2024-01-24)
Cheers, Chriss
-
is it possible you have a
T0
or evenT0 P0
in your config.g? In that case, callingT0
while tool 0 is active, none of the tool change macros would be executed. -
@oliof
Nope, you see in line 30 of my start2.g that there is a "T{global.tool_initial}" only. Printed the value a while ago with an echo and it was clear that that it contained a "0" only. -
I didnt ask about start.g which is called long after config.g.
Try adding
M118 S"--- tool " ^ global.tool_initial ^ " state: " ^ tools[global.tool_initial].state
in your start2.g just under your first M118 to confirm what the machine thinks is set.
-
Well,
---------------------------------------- homeall.g END Error: Bad command: global.tool_initial ^ " state: " ^ tools[ Error: Bad command: global.tool_initial].state ---------------------------------------- start.g END
But that is a other thing.....
I think that I found at least one problem I should solve first. The T0 get selected for the homing routine. That may have an influence here. I will go through that have a look at this first. It is a bit strange that I did not see that before....
It helps from time to time to just talk about a problem and restart the debugging process....
I will come back as soon as I confirmed that.
Cheers, Chriss
-
Yes, we can close the topic now..... It was my bad! The tool 0 was selected for homez and not deselected anymore. I changed that and it is working as expected now.
Thanks for your support guys!
Cheers, Chriss
-
-