G1 Hn or conditional gcode for movement?
-
Hi all-
I am triyng to figure out if I should be using a piece of conditional gcode or a G1 linear move with an H flag.
I have a cartesian machine. I am using a magnetically & electrically detachable NC switch for a Z-probe. When probe is disconnected, it is seen as NO by the controller. When its connected, its seen as a NC switch.
Ideally, I would have a dock that is fixed in X,Y,Z space. The conflict I have is that I don't have enough height in Z to make it fit without the bed crashing into the probe/dock when Z=0. I can't put a hole or relieve the bed to clear the switch.
I would like to dock it on the buildplate, that way X & Y are fixed, but Z will be variable in the machine's axis, but fixed realtive to the bed. The same thing might be applicable to a delta type machine to dock the probe on the bed or one of the verticals.
I have a deploy and retract scheme worked out for X & Y, but not Z.
Since the starting height of the bed is random, based on the height of the last print for example, I am trying to come up with a way to safely move bed up to the correct elevation to pick up the probe.
I am imagining somethine like the following-
- Allow movement w/o homing.
- Drop bed 5mm to ensure clearance
- Home X & Y
- Move to (X,Y) dock position.
- Move bed up in Z until probe couples.
- Home Z
- Probe bed
- Retract probe.
I am using the following to detect presence of probe. Since the probe is Normally Closed, I am using 0 & 1000 for states.
if sensors.probes[0].value[0]!=1000
for probe coupled, and this for lack of the probe
if sensors.probes[0].value[0] != 0
I am struggling with what logic statement to construct to raise the bed. Should it be a if/then conditional construct or a while loop? Or a G1 with an H option (1, 3?) that requires me the flip the function of the probe from NC to NO for sensing, or something like this for deply probe ?
; ...raise z for clearance ; ...home X & Y ; ...move X Y to dock position G91 ; relative coords if sensors.probes[0].value[0]!=1000 abort "deployprobe: Probe already picked up. Manually return probe to the dock" elif if sensors.probes[0].value[0]!<1000 G1 H0 Z-300 F300 ; ... move probe out of dock G90 ; absolute coords M564 S1 ; limit axis to print area M400 ; ... move to bed center ; ... probe Z ; ... mesh bed leveling else if sensors.probes[0].value[0] != 0 abort "deployprobe: Probe not picked up!"
----------- OR ---------------
M558 K0 P8 C"!zprobe.in" H8 F300 T12000 A3 S0.01 ; set as unfiltered NO switch ; ...raise z for clearance ; ...home X & Y ; ...move X Y to dock position G91 ; relative coords G1 H1 Z-300 F300 ; ... move probe out of dock G90 ; absolute coords M564 S1 ; limit axis to print area M558 K0 P5 C"^zprobe.in" H8 F300 T12000 A3 S0.01 ; correct setting for NC switch M400
-
I tried the second way by changing the setting for the endstop. I am confused as to the results so far.
I have a macro that is basically
M558 K0 P8 C"!zprobe.in" H8 F300 T12000 A3 S0.01 ; set as unfiltered NO switch M564 S0 ; allow movement outside of print area G91 ; G1 Z10 ; may not be needed if premptive Z move on X & Y homing is good enough G90 ; absolute positioning M98 P"move/ZTestdock_side.g" ; move carraige to the side of the dock aligning magnets in X M98 P"move/ZTestdock.g" ; move carraige over probe aligning magnets in Y G30 S-1 K0 ; probe down to the probe when magnets complete circuit probe should be triggered
but when I try to run it, I get an error saying that its already triggered. Probe state is 0 on the console and on PanelDue. Isn't the probe value of the Normally Open (NO) switch 0 until it is closed and then its 1000?
When I readback M558, this is my result.
M558
Z Probe 0: type 8, input pin !zprobe.in, output pin nil, dive height 8.0mm, probe speed 300mm/min, travel speed 12000mm/min, recovery time 0.00 sec, heaters normal, max taps 3, max diff 0.01 -
@sinned6915 said in G1 Hn or conditional gcode for movement?:
I get an error saying that its already triggered.
Remove the ! from zprobe.in
-
what is 'better' - tricking the firmware into believeing the endstop is a NO switch
or
trying to use conditional gcode to move until the sensor value is different with the correct probe settings ?in the end, are we relying to on the same sensor and reading?
this is what i have now with the probe docked in a fixed holder. sorry for the crappy hone video quality.
https://photos.app.goo.gl/quJBFf2LPLkPS46v9the problem is not enought height difference between the probe dox and the bed. note the difference i height under the probe switch and the gap under the nozzle.
https://photos.app.goo.gl/fUNDR3zAX3U6vD2n7 -
I am having the most Devil of a time with this- no matter what I try, I can not get the machine to detect/stop probe pickup
M409 K"sensors.probes[0].value" if sensors.probes[0].value[0]!=1000 ; if sensor is value other than 1000 do this abort "deployprobe: Probe already picked up. Manually return probe to the dock" elif G91 M564 S0 H0 ; allow movement outside of print area and while not homed G1 Z6 F6000 ; move Z for clearance G90 ; absolute positioning G1 X0 Y-15 F6000 ; move to side of probe dock location M400 ; wait for moves to finish G1 X0 Y-29.5 ; move exactly above probe for pickup M400 ; wait for moves to finish ; code for manual probe pickup ; M291 S2 P"Attach Probe" R"Probe Pickup" ; M292 while sensors.probes[0].value[0]=1000 ; loop to check when probe value changes from 1000 to 0 G1 Z-290 F360 ; move bed with probe dock up if sensors.probes[0].value[0]=0 ; when switch is coupled the sensor value will change to 0 break ; when sensor = 0, end loop M564 S1 ; limit axis to print area G1 Z2 F360 ; move bed to clear probe from dock G1 X55 F6000 ; move probe out of the dock G1 Z5 F360 ; move bed to clear probe from glass build surface M400 ; wait for moves to finish G90 else if sensors.probes[0].value[0]!= 0 abort "deployprobe: Probe not picked up!"
is where i am at now. The bed keeps moving once the probe is picked up. I can see the probe value on PanelDue go from 1000 to 0. There is enough room for the probe to lift up to couple to the carraige and then enough clearance for the switch to travl back down to trigger.
any suggesions on the logic ?
-
I have tried using a G1 H1 Z-290 F600 but its not working like I thought it should.
I basically can not get the logic to stop movement once the probe gets picked up.
i thought that this would be straightforward but its humbling.
anyone have any suggestions?
-
@sinned6915 Have you checked the list of firmware limitations,? There are a number of combinations of board/probe type/ motor that don't work. I'm using my phone right now so it's not easy for me to find a link but search the documentation.
-
@deckingman said in G1 Hn or conditional gcode for movement?:
@sinned6915 Have you checked the list of firmware limitations? There are a number of combinations of board/probe type/ motor that don't work.
I did not think to check that. I will start to look for that. That is a good suggestion.
-
-
@Phaedrux thanks for the link. I was spinning my wheels tryign to find that.
hmmm.....after reading, one of my Z motors is on the Duex board currently. I will try to switch it with the extruder motor.
That way all the Z motors will be on the main board with the Z probe, and the X & Y motors as well.
I will report back after I work on this.
-
I just realized the page you linked is for Duet3. I can't find similar for Duet2.