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

    sensors.endstops[4].triggered not set until macro exit

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    12
    614
    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.
    • danzaywerundefined
      danzaywer
      last edited by danzaywer

      Hi,
      I'm trying to feed filament from my MMU unit to the exrtuder with stall detection in order to remove sensor next to the extruder but seems that the sensors.endstops[4].triggered value is update only at the end of macro.
      An example of code is;

      M574 V2 S3		        	 
      while !sensors.endstops[4].triggered && iterations<6
      	echo iterations
      	if iterations = 5
      		M291 R"ATTENTION" P"Try last time" S3	
      	G1 V-20 F5000       ; retract a little filament
      	M400                       ; wait for move to finish before changing current
      	M915 V0 S18          ; set stall sensitivity
      	M913 V30
      	M83                         ; relative extrusion
      	G1 H1 V800 F9000    ; feed up to 800mm until stall
      	echo "feed done"
      	M400
      M913 V100
      G92 V0
      

      It repeat the loop until iteraction condition is reached, after macro end i see sensors.endstops[4].triggered true.

      Am I wrong something?
      Board: Duet 2 WiFi (2WiFi)
      Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta4

      cosmowaveundefined 1 Reply Last reply Reply Quote 0
      • cosmowaveundefined
        cosmowave @danzaywer
        last edited by

        @danzaywer
        when you try once without the iterations:

        while !sensors.endstops[4].triggered && iterations<6
        ....
        
        change to
        
        while !sensors.endstops[4].triggered
        ....
        

        Mankati FSXT+, DeltaTowerV2, E3D MS/TC

        danzaywerundefined 1 Reply Last reply Reply Quote 0
        • danzaywerundefined
          danzaywer @cosmowave
          last edited by

          @cosmowave without iteration it loop until

          if iterations = 5
          		M291 R"ATTENTION" P"Try last time" S3
          

          and if a clic "ok" it loop forever....

          1 Reply Last reply Reply Quote 0
          • danzaywerundefined
            danzaywer
            last edited by

            after other tests I found that the trigger is not set to true even at the end of the macro, in my macro I set the physical endstop which was active again, so the problem is on sensors.endstops [4] .triggered which remains false

            cosmowaveundefined 1 Reply Last reply Reply Quote 0
            • cosmowaveundefined
              cosmowave @danzaywer
              last edited by

              @danzaywer in the first post you wrote that the endstop is triggered after the macro. Now you write that it remains false!?
              What's the case now?

              Mankati FSXT+, DeltaTowerV2, E3D MS/TC

              danzaywerundefined 1 Reply Last reply Reply Quote 0
              • danzaywerundefined
                danzaywer @cosmowave
                last edited by

                @cosmowave at the end of my macro I had
                "M574 V2 S1 p"! ZSTOP ""
                so it was triggered because it is a physical sensor that is physically reached, I apologize, my mistake! the problem of the loop however remains, if you use the stalldetection the endstop is not triggered.

                cosmowaveundefined 1 Reply Last reply Reply Quote 0
                • cosmowaveundefined
                  cosmowave @danzaywer
                  last edited by

                  @danzaywer I'm not sure if i understand you correctly...
                  But the loop can't end without triggering the endstop.

                  Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                  danzaywerundefined 1 Reply Last reply Reply Quote 0
                  • danzaywerundefined
                    danzaywer @cosmowave
                    last edited by danzaywer

                    @cosmowave My initial macro is:

                    M574 V2 S3		        	 
                    while !sensors.endstops[4].triggered && iterations<6
                    	echo iterations
                    	if iterations = 5
                    		M291 R"ATTENTION" P"Try last time" S3	
                    	G1 V-20 F5000       ; retract a little filament
                    	M400                       ; wait for move to finish before changing current
                    	M915 V0 S18          ; set stall sensitivity
                    	M913 V30
                    	M83                         ; relative extrusion
                    	G1 H1 V800 F9000    ; feed up to 800mm until stall
                    	echo "feed done"
                    	M400
                    M913 V100
                    G92 V0
                    ......
                    M574 V2 S1 p"! ZSTOP"
                    

                    so at the exit the endstop is triggered.
                    During the "while", becouse of "M574 V2 S3", the endstop is not triggered, I think it's not really managed.
                    Pending clarification I found an alternative that works, quite elegant:

                    G92 V0 ;set V to 0 to ensure while execution
                    M574 V2 S3
                    while move.axes[4].machinePosition<move.axes[4].max && iterations<6
                            echo iterations
                    	G92 V0 		    ;set V to 0 if come from a previus iteration
                    	if iterations = 5
                    		M291 R"ATTENTION" P"Try last time" S3	
                    	G1 V-20 F5000       ; retract a little filament
                    	M400                 ; wait for move to finish before changing current
                    	M915 V0 S18          ; set stall sensitivity
                    	M913 V30
                    	M83                 ; relative extrusion
                    	G1 H1 V800 F9000    ; feed up to 800mm until stall
                    	echo "feed done"
                    	M400
                    
                    

                    MAX limit of V is 100000, G1 H1 set it to this value if stalling occur

                    T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
                    • T3P3Tonyundefined
                      T3P3Tony administrators @danzaywer
                      last edited by

                      @danzaywer There may be an issue with how long a endstop that is a stall detection remains triggered. I simplified the macro to this:

                      while !sensors.endstops[2].triggered && iterations<6
                      	echo iterations
                      	echo sensors.endstops[2].triggered
                      	G4 S1
                      echo sensors.endstops[2].triggered
                      

                      Where endstop 2 for me is a simple switch.
                      Running this macro and pressing the switch part way through gave the expected result:d939c1fb-1fac-4db0-9885-67c132e79029-image.png

                      www.duet3d.com

                      danzaywerundefined 1 Reply Last reply Reply Quote 1
                      • danzaywerundefined
                        danzaywer @T3P3Tony
                        last edited by

                        @t3p3tony
                        The macro with a switch works perfectly, my intent is to remove the physical switch and iterate the feed until the stall occurred. The control over the position and the maximum value gives me the desired result, at this point I am curious to understand the behavior of the virtual sensor when setting the stall detection.

                        T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
                        • T3P3Tonyundefined
                          T3P3Tony administrators @danzaywer
                          last edited by

                          @danzaywer I understand, my point is when you go through the while loop its unlikely to actually ever match the condition during the brief point that the stall occurs.

                          www.duet3d.com

                          danzaywerundefined 1 Reply Last reply Reply Quote 0
                          • danzaywerundefined
                            danzaywer @T3P3Tony
                            last edited by

                            @t3p3tony said in sensors.endstops[4].triggered not set until macro exit:

                            I understand, my point is when you go through the while loop its unlikely to actually ever match the condition during the brief point that the stall occurs

                            Thanks! at this point, checking the position seems to be the only way to verify that the stall has occurred

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