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

    Conditional homing and z-height fine adjustment

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    4
    20
    1.1k
    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.
    • fcwiltundefined
      fcwilt @GuidoP
      last edited by

      @GuidoP said in Conditional homing and z-height fine adjustment:

      I have had several considerations for implementing the z-max switches: ...

      Thank you for the reply.

      All of my printers home to Z min and it seems to me all of the reasons you stated for using Z max apply to Z min.

      • The crash scenario is the same for min versus max.

      • Most slicers will execute some user defined code on print completion. One of the things my "printing complete" macro does is move down to a bit - it could just as easily move to Z max.

      • I don't understand the fixed reference issue. You are referencing the frame when using either min or max - correct?

      Thanks for the help in understanding.

      I don't know if this makes any difference but I eliminated multiple Z steppers in favor a single stepper, belt driven setup which naturally keeps both Z axis lead screws in sync.

      Frederick

      Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

      GuidoPundefined 1 Reply Last reply Reply Quote 1
      • GuidoPundefined
        GuidoP @fcwilt
        last edited by

        @fcwilt Thanks for sharing your thoughts and considerations.
        An alternative to my current setup would indeed be using a z-min homing scenario and just use the endstops as safetystops so the bed wont crash when is full down when the machine starts. (This is actuatlly my backuo scenario if i don't get the macro running).

        The crash scenarion in a z-min homing situation is higher imho:

        • Machine starts, axis are not homed. The machine has no clue where the different axis are located
        • Homing is initiated. X and Y homing will initiate (in the default g-code) a Z move in the z-max direction. Regardless if z-max or z-min is used
        • If the bed is at or near the z-max position, with z-min endstops the machine has no way of knowing it will run out of bed travel and will crash to the mechanical limits. In a z-max endstop configuration the z-max endstop will trigger, stopping the move gracefully. With to independend z-motors you'll need to re-perform the bed leveling again due to the unknown shift between the two leadscrews. I'm not sure what would happen in your setup with a single stepper for 2 leadscrews. Does the belt slip or does the stepper skip steps?

        I have two optical endstops bolted to the frame between steppermotor and linear rod. As the frame is square and level these switches are in the same position horizontally. I use a single 25mm aluminium angle profile bolted directly to the 2020 profiles of the bed as endstop flag. So basically there are no manual adjustments and everything is referenced to a fixed point resulting in a repeatable fixed horizontal level.
        An alternative to this procedure on the z-min side would be using the z-probe to probe near the leadscrews and let the duet calculate how to level things out. This is a bit more straight forward without extra probing time. (Or use a single steppermotor which drives 2 leadscrews.... 😉 )

        There are a lot of differnt approaches and sollutions to solving a single problem. These are my solutions now, which i might (or might not) change in the future... That's the beauty of learning and progressing... 🙂

        Anyway, i'm getting a bit off-topic... Sorry... 🙂

        fcwiltundefined 1 Reply Last reply Reply Quote 0
        • fcwiltundefined
          fcwilt @GuidoP
          last edited by

          @GuidoP said in Conditional homing and z-height fine adjustment:

          • Homing is initiated. X and Y homing will initiate (in the default g-code) a Z move in the z-max direction. Regardless if z-max or z-min is used

          If it moves in the Z max direction when using Z min end stop then something is wrong. It should not do that.

          Frederick

          Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

          Phaedruxundefined 1 Reply Last reply Reply Quote 0
          • Phaedruxundefined
            Phaedrux Moderator @fcwilt
            last edited by

            @fcwilt said in Conditional homing and z-height fine adjustment:

            If it moves in the Z max direction when using Z min end stop then something is wrong. It should not do that.

            Maybe he means the small lift before homing x and y for clearance?

            Z-Bot CoreXY Build | Thingiverse Profile

            fcwiltundefined GuidoPundefined 2 Replies Last reply Reply Quote 0
            • fcwiltundefined
              fcwilt @Phaedrux
              last edited by

              @Phaedrux said in Conditional homing and z-height fine adjustment:

              Maybe he means the small lift before homing x and y for clearance?

              What small lift? I must do things backwards. I home Z first and then move to Z=5 before I home Y & X.

              Frederick

              Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

              Phaedruxundefined 1 Reply Last reply Reply Quote 0
              • Phaedruxundefined
                Phaedrux Moderator @fcwilt
                last edited by

                @fcwilt For instance in homeall.

                G1 Z5 F100 S2 ; Lower bed 5mm to ensure it is below the trigger height

                Z-Bot CoreXY Build | Thingiverse Profile

                fcwiltundefined 1 Reply Last reply Reply Quote 0
                • fcwiltundefined
                  fcwilt @Phaedrux
                  last edited by

                  @Phaedrux said in Conditional homing and z-height fine adjustment:

                  @fcwilt For instance in homeall.

                  G1 Z5 F100 S2 ; Lower bed 5mm to ensure it is below the trigger height

                  What would you do that?

                  Consider when homing to Z min:

                  G1 Z-999 H1
                  G1 Z20
                  G1 Z-999 H1

                  When the first G1 executes if the endstop is already triggered no movement takes place and the next G1 executes which is safe.

                  Am I overlooking something?

                  Frederick

                  Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                  Phaedruxundefined 1 Reply Last reply Reply Quote 0
                  • Phaedruxundefined
                    Phaedrux Moderator @fcwilt
                    last edited by

                    @fcwilt said in Conditional homing and z-height fine adjustment:

                    Am I overlooking something?

                    Yes, when using a probe you must position the probe first, so X and Y must be homed first, and by default the configurator includes a short lift of the Z axis to give clearance for the X Y move and to lift the probe above trigger height.

                    But I was just speculating on what he might have been meaning.

                    Z-Bot CoreXY Build | Thingiverse Profile

                    fcwiltundefined 1 Reply Last reply Reply Quote 0
                    • fcwiltundefined
                      fcwilt @Phaedrux
                      last edited by

                      @Phaedrux said in Conditional homing and z-height fine adjustment:

                      Yes, when using a probe you must position the probe first, so X and Y must be homed first, and by default the configurator includes a short lift of the Z axis to give clearance for the X Y move and to lift the probe above trigger height.

                      Ah... I see.

                      I use a Z min endstop switch setup for homing in relation to the frame so I never encountered that issue.

                      I only use the Z probe for setting Z=0 and mesh comp probing, things which only occur after the ZYX homing has been done.

                      Thanks.

                      Frederick

                      Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                      1 Reply Last reply Reply Quote 0
                      • GuidoPundefined
                        GuidoP @Phaedrux
                        last edited by

                        @Phaedrux said in Conditional homing and z-height fine adjustment:

                        @fcwilt said in Conditional homing and z-height fine adjustment:

                        If it moves in the Z max direction when using Z min end stop then something is wrong. It should not do that.

                        Maybe he means the small lift before homing x and y for clearance?

                        Thats correct 🙂

                        1 Reply Last reply Reply Quote 0
                        • GuidoPundefined
                          GuidoP
                          last edited by

                          Thanks all for the input, but unfortunately it does not bring me closer to an answer to the original question: Why does the conditional gcode not work as intended? Where is the bug in the code??

                          1 Reply Last reply Reply Quote 0
                          • GuidoPundefined
                            GuidoP
                            last edited by

                            I finally got the macro working with following code:

                            ; Source: https://forum.duet3d.com/topic/4202/homing-to-z-max-when-also-using-a-z-probe/19
                            ; Start g-code: G28, M98 P"0:/macros/Leveling/SetZ" ; run z fine tuning
                            
                            ; If the printer hasn't been homed, home it
                            
                            ;M291 P"checking homing status" R"Homing status" S1			; Report status
                            
                            if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed  	; Check if axis are not homed
                              ;If axis are not homed, home axis
                              echo "Axis are not homed, performing homing"
                              M98 P"0:/sys/homeall.g"
                            else
                              ;If axis are already homed, home only the X and Y axis
                              echo "axis are homed, re-homing x and Y"
                              M98 P"0:/sys/homex.g"											; Run the Home X macro
                              M98 P"0:/sys/homey.g"											; Run the Home Y macro
                              ;G1 X100 Y100 H0 F1800											; move to be centre slowly.
                              
                            ;End homeing check
                            M291 P"Axis homed" R"Homing status" S1							; Report status
                            ;echo "start fine tuning z-level"
                            G1 X100 Y100 H0 F1000											; move to be centre slowly.
                            G1 Z15 H1 F8000	 	 											; Raise the bed to start probing
                            G30 															; probe for z=0
                            G1 Z10 H1 F1000 												; raise nozzle
                            G30 S-1 														; check z gap
                            G1 Z10 H1 F1000 												; raise nozzle
                            
                            M400															; Wait until all moves are completed
                            

                            I changed and tested several different thing, but i think the trick that did it was removing the empty line between the end of the "If" block and the start of the "else" block.

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post
                            Unless otherwise noted, all forum content is licensed under CC-BY-SA