Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Initial Tool select, no tpost0.g?

    Scheduled Pinned Locked Moved Solved
    General Discussion
    3
    10
    270
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Chrissundefined
      Chriss
      last edited by

      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

      Exerqtorundefined 1 Reply Last reply Reply Quote 0
      • Exerqtorundefined
        Exerqtor @Chriss
        last edited by Exerqtor

        @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"

        Chrissundefined 1 Reply Last reply Reply Quote 0
        • Chrissundefined
          Chriss @Exerqtor
          last edited by

          @Exerqtor

          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

          Exerqtorundefined 1 Reply Last reply Reply Quote 0
          • Exerqtorundefined
            Exerqtor @Chriss
            last edited by Exerqtor

            @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.

            Chrissundefined 1 Reply Last reply Reply Quote 0
            • Chrissundefined
              Chriss @Exerqtor
              last edited by

              @Exerqtor

              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

              1 Reply Last reply Reply Quote 0
              • oliofundefined
                oliof
                last edited by

                is it possible you have a T0 or even T0 P0 in your config.g? In that case, calling T0 while tool 0 is active, none of the tool change macros would be executed.

                <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                Chrissundefined 1 Reply Last reply Reply Quote 0
                • Chrissundefined
                  Chriss @oliof
                  last edited by

                  @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.

                  oliofundefined 1 Reply Last reply Reply Quote 0
                  • oliofundefined
                    oliof @Chriss
                    last edited by

                    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.

                    <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                    Chrissundefined 1 Reply Last reply Reply Quote 1
                    • Chrissundefined
                      Chriss @oliof
                      last edited by

                      @oliof

                      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

                      Chrissundefined 1 Reply Last reply Reply Quote 0
                      • Chrissundefined
                        Chriss @Chriss
                        last edited by

                        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

                        1 Reply Last reply Reply Quote 2
                        • droftartsundefined droftarts marked this topic as a question
                        • droftartsundefined droftarts has marked this topic as solved
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA