mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 08:41:13 -07:00
Put the head back after the hold in the disarm test
laser.disarm-in-hold streams a 40 mm move, feed-holds it two seconds in, waits out the disarm grace, and then resets out of the hold. The recovery put the laser and the controller back and left the head where the hold had caught it: 11.34 mm along on the bench reference, 605 counts, which the hand-back jogged out and reported. The head goes back now, by the distance it actually travelled rather than the distance the move asked for: the hold catches it at a slightly different point every run - ten millimetres nominal at F300 for two seconds, 11.34 measured - so the kernel counters before the move and after the reset are what the return jog is built from. Where it stopped and where it ended go into the evidence. This is not the fault the M5 rapid job had. That job's moves netted plus twenty by construction; this one stops part-way on purpose, and the recovery simply never returned it. laser.armed-kill has the same shape, a kill mid-fire that stops the head where it stops, and is left alone until a run says whether it needs the same treatment.
This commit is contained in:
@@ -640,6 +640,7 @@ def disarm_in_hold(ctx):
|
||||
ev = ctx.evidence
|
||||
with ctx.grbl() as g, LiveJob(ctx, g):
|
||||
prepare(ctx, g)
|
||||
k0 = kernel_start(ctx)
|
||||
ctx.ready(ARM_CUE % "40 mm +X")
|
||||
stream(g, ["G91", "G21", "M4", "S400", "G1 X40 F300"])
|
||||
ctx.log("armed; waiting for motion to start (arm + your button press)...")
|
||||
@@ -682,6 +683,20 @@ def disarm_in_hold(ctx):
|
||||
ctx.sleep(1)
|
||||
if "Alarm" in g.status_report()["state"]:
|
||||
g.command("$X")
|
||||
# The hold parks the head part-way through the move and the reset
|
||||
# abandons the rest of it, so the job ends wherever the feed hold
|
||||
# caught it - about 11 mm in, on the bench reference. That is the
|
||||
# test's own doing and it goes back: the kernel counters say how
|
||||
# far the head actually went, which is what a jog has to undo.
|
||||
wait_idle(ctx, g, 15)
|
||||
dx, dy = kernel_xy_mm(ctx)
|
||||
back_x, back_y = k0[0] - dx, k0[1] - dy
|
||||
ev["left_at_mm"] = [round(dx - k0[0], 3), round(dy - k0[1], 3)]
|
||||
if abs(back_x) >= 0.02 or abs(back_y) >= 0.02:
|
||||
ctx.log("returning the head: %+.3f/%+.3f mm", back_x, back_y)
|
||||
g.command("$J=G91X%.3fY%.3fF1200" % (back_x, back_y))
|
||||
wait_idle(ctx, g, 30)
|
||||
ev["returned_mm"] = list(kernel_xy_mm(ctx))
|
||||
ctx.check(disarmed_at is not None, "still armed after 120 s in Hold")
|
||||
ctx.check(left_hold is None, "the job left Hold (%s) before the disarm", left_hold)
|
||||
check_button_dark(ctx, ev)
|
||||
|
||||
Reference in New Issue
Block a user