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

    Probe deploy in loops

    Scheduled Pinned Locked Moved
    Gcode meta commands
    2
    4
    234
    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.
    • sinned6915undefined
      sinned6915
      last edited by sinned6915

      I am working on a probe_find_Z macro. I started rolling my own, then found owendare's and wanted to try it with the while loop instead .

      the odd behavior is it will pick up the probe and then the system will complain the probe is already deployed before probing.

      normally, I try to wrap any sucessive probing with M401/M402 sequences. I can not figure out where its checking the probe status and erring out.

      do i need another while loop to check the probe deploy token?

      here is the output-

      deployuser token = true
      Probe State = 0
      deployprobe start value Probe already picked up.  Manually return probe to the dock
      

      from this macro-

      ; Probe the same spot 10 times to test repeatably.
      
      M291 P"Probe will be tested 10 times and return mean and standard deviation. Ok or Cancel?" R"Begin probe test?" S3 ; User must click OK or cancel.
      
      ; Check if any axis hasn't been homed, and home it if required
      while iterations < #move.axes ; By putting # in front of the array object, it will return the number of configured axis
      	if !move.axes[iterations].homed ; if this axis is not homed
      		G28 ; home all axes
      		break ; no need to continue this loop
      	else
      	; All axes are homed, but may not be in a point that can be probed. Move to the center of the area that can be probed.
      	M401
      	G1 X{(move.compensation.probeGrid.maxs[0] - move.compensation.probeGrid.mins[0])/2} Y{(move.compensation.probeGrid.maxs[1] - move.compensation.probeGrid.mins[1])/2} Z15 F6000
      	M400
      ;now begin our probe test
      while iterations < 10
      	if iterations <9
      		G30 P{iterations} X{move.axes[0].machinePosition} Y{move.axes[1].machinePosition} Z-9999 ; probe the current position and record the offset
      	else
      		G30 P{iterations} X{move.axes[0].machinePosition} Y{move.axes[1].machinePosition} Z-9999 S-1 ; probe the current position and calculate the deviation
      M402
      

      this is mine- half done, but with static probes instead of a loop.

      ;***  
      ; findZprobeoffset.g  
      ; ***  
      ; the system must be homed before running this macro
      ; echo sensors.probes[0].deployedByUser
      if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed      ; If the printer hasnt been Y homed, home it
         M98 P"0:/sys/homex.g"  
         M98 P"0:/sys/homey.g"  
         M98 P"0:/sys/homez.g"  
      
      ; make sure that the nozzle is properly gapped with known height gauge before the start of the test
      ; Preheat nozzle to 130, clean nozzle, touch off nozzle to 0.2mm feeler gauge, G92 Z0.2 
      
      M291 P"Has the system been calibrated to a known good thickness gauge and the height set via G92? Ok or Cancel?" R"WARNING" S3  
      
      M291 P"Probe will be tested 10 times and return mean and standard deviation. Ok or Cancel?" R"WARNING" S3  
      ; User must click OK or cancel.  
      
      M401               ; deploy probe
      ; echo sensors.probes[0].deployedByUser
      G1 X75 Y75 Z15   ; travel to X,Y of probe point 15mm above bed  
      G30 Z-9999         ; probe point 1
      G30 Z-9999         ; probe point 2
      G30 Z-9999         ; probe point 3
      G30 Z-9999         ; probe point 4
      G30 Z-9999         ; probe point 5
      G30 Z-9999         ; probe point 6
      G30 Z-9999         ; probe point 7
      G30 Z-9999         ; probe point 8
      G30 Z-9999         ; probe point 9
      G30 Z-9999 S-1     ; probe point 10, computer average and standard of deviation
      G91 
      G0 Z15
      G90
      M400
      G4 P500
      ; echo sensors.probes[0].deployedByUser
      M402               ; retract probe
      ; echo sensors.probes[0].deployedByUser
      M400
      
      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @sinned6915
        last edited by

        @sinned6915 what type of Z probe do you gave; what M558 command have you used to configure it; and what is in your deployprobe.g and retractprobe.g files?

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        sinned6915undefined 1 Reply Last reply Reply Quote 0
        • sinned6915undefined
          sinned6915 @dc42
          last edited by

          @dc42 i am using a detachable probe. here are my configs and macros:

          ; Mag Probe Settings
          ; RRF2 was M558 P5 H8 F300 T9000 A1 S.01 
                                                          ; set Z probe type to switch and the dive height + speeds.  Probe A times
          M558 K0 P8 C"^zprobe.in" H10 R0.5 F360:120 T9000 A5 S0.01
                                                          ; M558 K0 P5 C"^zprobe.in" H10 R0.5 F200 T9000 A1 S0.03
                                                          ; K0 for probe 0, P5 for filtered NC switch, P8 for UN-filtered NC switch, C for input pin, 
                                                          ; ^ for enabling the native pullup resistor on Duet2 hardware running RRF3  
                                                          ; H dive height of 8mm, F240/120 probing speed 4-2mm/sec, T9000 travel speed 150mm/sec,   
                                                          ; A3 number of probes 1, S0.01 max tolerance of 0.01 
                                                          ;
          G31 K0 P500 X-16.4 Y-29.27 Z3.12                ; for snap action switches DF2 etc
          

          deployprobe.g

          ; ***********************************************************
          ; Euclid Probe Fixed Dock M401 Deploy Probe Macro
          ; saveas system/deployprobe.g
          ; comments and echo statements throughout are provided for convenience
          ; ***********************************************************
          ; echo "Running deployprobe.g"
          ; echo "Homing Check"
          if !move.axes[0].homed || !move.axes[1].homed     ; If the printer hasn't been homed, home it
             M98 P"0:/sys/homexy.g" 
             
          ; uncomment next line to echo the probe deploy state 
          ; echo "Object Model Deployuser token =" ^sensors.probes[0].deployedByUser
          
          M564 H1 S0                   ; Allow movement BEYOND axes boundaries (for Y to reach probe dock)
          
          G91                      ; relative positioning
          ; echo "Lift Z in advance of deploy" 
          G1 H2 Z15 F3000          ; move Z 15 for clearance above dock.
          ;                        ; need to figure out some safety check on this
          G90                                   ; absolute positioning
          
          ; echo "Probe Value =" ^sensors.probes[0].value[0]
          
          if sensors.probes[0].value[0]!=1000    ; if sensor is value other than 1000 do this
            ; uncomment next line to echo the probe deploy state 
            echo "deployuser token = " ^sensors.probes[0].deployedByUser
            echo "Probe State = " ^sensors.probes[0].value[0]
            abort "deployprobe start value Probe already picked up.  Manually return probe to the dock"
          
          ; if we're here we know it's becasue the above is true which I assume is because you have an NC switch as a probe.
          ; echo "Passed first logic test to deploy probe"
          
          ; Dock side position is at X0 Y20
          ; Docked probe postion is at X0 Y-16 
          ; Dock exit point is at X65 Y-16 
          
          G90
          G1 X0.0 Y20.0 F6000           ; move adjacent to probe dock location
          M400                          ; wait for moves to finish
          G4 P250                       ; wait 250 msecs
          ; echo "Probe Pickup while loop running"
          
          ; uncomment next line to echo the probe deplot state 
          ; echo "Object Model Deployuser token (before while loop) = " ^sensors.probes[0].deployedByUser
          
          ; while sensors.probes[0].value[0]=1000
          G90
          G0 X0.0 Y-16.0 F3000        ;  move over dock 
          M400                        ; wait for moves to finish
          G4 P250                     ; pause for pickup 
          ; echo "Probe Value =" ^sensors.probes[0].value[0]
          G0 X65 Y-16.0 F1200         ;  slide probe out of dock - slowly
          M400                        ; wait for moves to finish
          G4 P250                     ; pause 1 seconds
          ; echo "Move to Center"
          G1 X150 Y150 F3000        ; move bed to clear probe from build surface 
          M400                          ; wait for moves to finish
          G4 P250
          ; echo "Probe Pickup while loop complete"
          
          ; uncomment to echo the probe deplot state 
          ; echo "Object Model Deployuser token (after while loop) = " ^sensors.probes[0].deployedByUser
          
          
          if sensors.probes[0].value[0]!=0
            ; uncomment to echo the probe deploy state 
            echo "Object Model Deployuser token (in abort if section)= " ^sensors.probes[0].deployedByUser
            abort "Deployprobe endvalue not 0 Probe not picked up!  Deploy cancelled."
          
          echo "Restrict to Print Bed Size"
          M564 H1 S1                    ; Restrict movement to within axes boundaries (for normal Y movement)
          
          echo "Macro deployprobe.g complete"
          

          retractprobe.g

           ; ***********************************************************
          ;
          ; retractprobe.g
          ;
          ; ***********************************************************
          ; M118 S"Redefine probe as NC"
          ; M558 K0 P5 C"^zprobe.in" H8 R0.5 F200 T9000 A1 S0.03
          ; M400
          ; echo "running retractprobe.g macro"
          ; echo "deployuser token= " ^sensors.probes[0].deployedByUser
          ; echo "Probe Value = " ^sensors.probes[0].value[0]
          
          if sensors.probes[0].value[0]!= 0
            echo "deployuser token= " ^sensors.probes[0].deployedByUser
            echo "Probe Value = " ^sensors.probes[0].value[0]
            abort "retractprobe: Probe not currently picked up!"
          
          ; echo "pass first logic loop"
          M564 S0	                     ; allow movement outside of print area
          ; echo "deployuser token= " ^sensors.probes[0].deployedByUser
          ; echo "Probe Value = " ^sensors.probes[0].value[0]
          G90	                         ; absolute positioning
          
          ; G1 X100.0 Y4.0 Z7.89 F12000         ; move to the starting point 
          ; G1 X100.0 Y-27.0 Z7.890 F12000         ; move to the starting point Glass Bed
          G0 X100.0 Y-16.0 Z9.0 F12000         ; move to the starting point Bare Alum
          G0 X45.0 Y-16.0 F6000              ; move to the entry position for the dock
          G0 X2.0 Y-16.0 F3000               ; move to the dock position
          G0 X2.0 Y0.0 F12000             ; move to the side adjacent to the dock
          M400
          G4 P250
          G0 X100.0 Y0.0 F12000           ; move to the right to clear dock
          G0 X145 Y0.0  F6000          ; move to start point at middle front 
          M400
          G4 P250
          
          M564 S1                      ; limit axis to print area
          ; echo "complete movement commands"
          
          if sensors.probes[0].value[0]!= 1000
            echo "deployuser token= " ^sensors.probes[0].deployedByUser
            echo "Probe Value = " ^sensors.probes[0].value[0]
            abort "retractprobe: Probe not correctly dropped off in dock!"
           
          ; echo "deployuser token= " ^sensors.probes[0].deployedByUser
          ; echo "Probe Value = " ^sensors.probes[0].value[0]
          ; echo "retractprobe.g macro complete"
          
          dc42undefined 1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @sinned6915
            last edited by dc42

            @sinned6915 I just checked the code. The M401 command does not check whether the probe has been deployed already, it always runs deployprobe.g. It then sets the "deployed by user" flag so that G30, G29 etc. commands don't attempt to deploy/retract it. Similarly, M402 always runs retractprobe.g and clears the "deployed by user" flag.

            So I suggest you avoid calling M401 in that while loop, or arrange to call it only the first time.

            You can read the state of the deployedByUser flag from the object mode, under sensors.probes.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

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