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

    Need help with homing XYUV and conditional gcode

    Scheduled Pinned Locked Moved
    Gcode meta commands
    6
    13
    373
    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.
    • T3P3Tonyundefined
      T3P3Tony administrators
      last edited by

      Hi Ian

      suggestion from @chrishamm

      if sensors.endstops[x].triggered || sensors.endstops[y].triggered
        abort "Endstops already triggered at the beginning of the homing move, aborting"
      

      would need expanding for all the endstops you wanted to check

      www.duet3d.com

      deckingmanundefined 1 Reply Last reply Reply Quote 0
      • arhiundefined
        arhi
        last edited by

        IMHO the "abort if already.." is the best course of action. Will not help if the switch/cable die during the home move but I think that's an acceptable risk.

        1 Reply Last reply Reply Quote 0
        • A Former User?
          A Former User
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • deckingmanundefined
            deckingman @T3P3Tony
            last edited by deckingman

            @T3P3Tony said in Need help with homing XYUV and conditional gcode:

            Hi Ian

            suggestion from @chrishamm

            if sensors.endstops[x].triggered || sensors.endstops[y].triggered
              abort "Endstops already triggered at the beginning of the homing move, aborting"
            

            would need expanding for all the endstops you wanted to check

            Hi Tony,

            Thanks for that. Could you confirm what I suspect the "abort" does? I assume that if the above command (with X and U end stops) was at the start of my home all macro, it would abort that home all macro yes? If I had a similar command later in the macro file but with Y and V as the end stops, I assume that XU will home but then the rest of the macro would terminate if either a Y or V endstop is already triggered yes?

            Edit. Scratch that - just found a description of the "abort" command.

            Ian
            https://somei3deas.wordpress.com/
            https://www.youtube.com/@deckingman

            1 Reply Last reply Reply Quote 0
            • deckingmanundefined
              deckingman
              last edited by

              I've tried the above suggestion - i.e .......................

              if sensors.endstops[x].triggered

              .............and I get an error message:

              Error: in file macro line 18 column 21 : meta command : unknown value 'x'.

              I tried both upper and lower case "x".

              Ian
              https://somei3deas.wordpress.com/
              https://www.youtube.com/@deckingman

              1 Reply Last reply Reply Quote 0
              • chrishammundefined
                chrishamm administrators
                last edited by

                @deckingman x and y must be replaced with the indices of your endstop (first item is 0, second 1 etc). You can send M409 K"sensors.endstops" to view the current list and states.

                Duet software engineer

                deckingmanundefined 1 Reply Last reply Reply Quote 0
                • deckingmanundefined
                  deckingman @chrishamm
                  last edited by

                  @chrishamm said in Need help with homing XYUV and conditional gcode:

                  @deckingman x and y must be replaced with the indices of your endstop (first item is 0, second 1 etc). You can send M409 K"sensors.endstops" to view the current list and states.

                  Ahh - thanks for that.

                  Ian
                  https://somei3deas.wordpress.com/
                  https://www.youtube.com/@deckingman

                  1 Reply Last reply Reply Quote 0
                  • deckingmanundefined
                    deckingman
                    last edited by deckingman

                    So I just sent M409 K "sensors.endstops" and got

                    Error M409 : expected string expression.

                    Scratch that. I discovered that one must not have a space after the K

                    Ian
                    https://somei3deas.wordpress.com/
                    https://www.youtube.com/@deckingman

                    1 Reply Last reply Reply Quote 0
                    • deckingmanundefined
                      deckingman
                      last edited by deckingman

                      This M409 isn't very helpful. It just lists the status (true or false) for all the end stops but it doesn't say which end stop is associated with which axis.

                      Ian
                      https://somei3deas.wordpress.com/
                      https://www.youtube.com/@deckingman

                      1 Reply Last reply Reply Quote 0
                      • deckingmanundefined
                        deckingman
                        last edited by

                        Other than using DWC to show the end stops, then triggering each one by hand and looking to see which one changes state, is there any other way to know which index value is assigned to which axis?

                        It isn't the order that they are created in config.g because I created XYUVAB and finally Z in that order but Z is index number 2. I haven't been able to find anything in the documentation but it might be buried in there somewhere.

                        Ian
                        https://somei3deas.wordpress.com/
                        https://www.youtube.com/@deckingman

                        1 Reply Last reply Reply Quote 0
                        • deckingmanundefined
                          deckingman
                          last edited by

                          Well that was fun. For anyone else stumbling across this thread, the only way I could discover which end stop index value refers to which axis was to use DWC to display the end stops under machine properties. Here the end stops are listed by index value rather than by axis letter, along with their trigger status. So I had to trigger each one in turn and revert to pen and paper to record which index is assigned to which axis.

                          It would be helpful if someone who knows how end stop incises are assigned to axes could add that to the documentation somewhere.

                          I ended up using separate statement for each end stop so that I got a meaningful message about which end stop to check. i.e.......

                          ;****check if an enstop is alreday triggered becuase it might be a wire has fallen off
                          ; X=0,Y=1,Z=2,U=3,V=4,A=5,B=6
                          
                          if sensors.endstops[1].triggered 
                          	abort "Y endstop already triggered at the beginning of the homing move - aborting" 
                          if sensors.endstops[4].triggered 
                          	abort "V endstop already triggered at the beginning of the homing move - aborting"	
                          

                          Ian
                          https://somei3deas.wordpress.com/
                          https://www.youtube.com/@deckingman

                          1 Reply Last reply Reply Quote 0
                          • OwenDundefined
                            OwenD @deckingman
                            last edited by

                            @deckingman said in Need help with homing XYUV and conditional gcode:

                            EDIT. Thinking about it a bit more, I guess an elegant solution would be to have a macro which checked the status of all end steps, which could be called at the start of any homing macro, but I'm open to suggestions.

                            You can iterate over all endstops (or other arrays) by using # to give you the number available

                            while iterations < #sensors.endstops
                            	if sensors.endstops[iterations].triggered
                            		echo "Endstop " ^ iterations " is triggered"
                            		abort
                            

                            I had thought maybe this could be expanded to try to move away from any active endstop which would effectively test if it was broken (i.e. if it's still active after a 6mm move it's broken), but I can't see an easy way in the object model to determine if the endstop is at min/max or whether it's N/O or N/C.
                            Nor does it seem possible to determine the axis it is associated with other than to assume the endstop number would align with the axes number.
                            But if you had two endstops on an axes that'd fail.

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