mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 08:41:13 -07:00
bench and catalog: the controller's cancel messages spell canceled; the needles follow
This commit is contained in:
@@ -682,7 +682,7 @@ def armed_kill(ctx):
|
||||
"when told."],
|
||||
description="Start a laser job so the controller unlocks the latch and lights the button, "
|
||||
"then open the lid while it waits. The wait must abort with the lid named as the "
|
||||
"reason, cancelled with a soft reset (no alarm - nothing to unlock), the armed "
|
||||
"reason, canceled with a soft reset (no alarm - nothing to unlock), the armed "
|
||||
"window closed (armed -> false), the kernel latch back to locked, and no emission; "
|
||||
"the controller ends Idle. No press is given, so nothing can fire.")
|
||||
def arm_wait_lid(ctx):
|
||||
@@ -709,12 +709,12 @@ def arm_wait_lid(ctx):
|
||||
while time.time() - t1 < 15:
|
||||
ctx.checkpoint()
|
||||
text += g.drain()
|
||||
if "job cancelled" in text and "help]" in text:
|
||||
if "job canceled" in text and "help]" in text:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
ev["messages"] = [ln for ln in text.splitlines() if ln.startswith("[MSG:") or ln.startswith("ALARM")]
|
||||
ctx.log("controller: %s", ev["messages"])
|
||||
ctx.check("lid opened during arm - job cancelled" in text,
|
||||
ctx.check("lid opened during arm - job canceled" in text,
|
||||
"the lid open was not reported as cancelling the arm")
|
||||
ctx.check("help]" in text, "no reset banner after the lid-open cancel (it must be a clean cancel)")
|
||||
ctx.check("ALARM" not in text, "an alarm was raised on the lid-open cancel")
|
||||
@@ -740,7 +740,7 @@ def arm_wait_lid(ctx):
|
||||
st = g.status_report()["state"]
|
||||
ev["state_after"] = st
|
||||
ctx.check(st.startswith("Idle"), "controller is %s after the cancel, expected Idle (no unlock needed)", st)
|
||||
ctx.log("PASS: lid open during the arm wait cancelled the job (clean reset, no alarm), armed=false, latch locked")
|
||||
ctx.log("PASS: lid open during the arm wait canceled the job (clean reset, no alarm), armed=false, latch locked")
|
||||
|
||||
|
||||
@test("laser.pause-resume-lid-cancel", title="One live cut: the button pauses and resumes it, the lid "
|
||||
@@ -761,7 +761,7 @@ def arm_wait_lid(ctx):
|
||||
"with the armed window open - a pause is not a cancel. Press again: the cut "
|
||||
"resumes from where it stopped, lit from the first step (a pause is a sharp corner "
|
||||
"in time; the cut is M3 so the corner dose is there to look at). Lid: emission "
|
||||
"stops in hardware, the job is cancelled "
|
||||
"stops in hardware, the job is canceled "
|
||||
"with the reason reported, the controller resets with the position kept and no "
|
||||
"alarm, the armed window closes and the kernel latch relocks, the hardware button "
|
||||
"latch reads SET, and the head returns to the job start with the lid still open.")
|
||||
@@ -869,7 +869,7 @@ def pause_resume_lid_cancel(ctx):
|
||||
ctx.check(zero_at is not None and zero_at < 3.0,
|
||||
"emission did not stop after the lid opened (first 0 at %s)", zero_at)
|
||||
ctx.check(tail_zero, "emission returned after the lid opened")
|
||||
ctx.check("lid opened - job cancelled" in text, "the lid open was not reported as cancelling the job")
|
||||
ctx.check("lid opened - job canceled" in text, "the lid open was not reported as cancelling the job")
|
||||
ctx.check("help]" in text, "no reset banner after the cancel")
|
||||
ctx.check("ALARM" not in text, "an alarm was raised on the cancel (position should be kept)")
|
||||
t3 = time.time()
|
||||
@@ -904,5 +904,5 @@ def pause_resume_lid_cancel(ctx):
|
||||
ctx.act("lid", "close")
|
||||
ctx.sleep(1)
|
||||
ctx.log("PASS: button paused the burn (emission 0, armed kept, latch unlocked) and resumed it; "
|
||||
"the lid then cancelled it - emission 0 at +%s s, reset without alarm, returned (drift "
|
||||
"the lid then canceled it - emission 0 at +%s s, reset without alarm, returned (drift "
|
||||
"%.3f mm), button latch SET", zero_at, drift)
|
||||
|
||||
@@ -736,8 +736,8 @@ def expect_cancel_and_return(ctx, g, ev, start, k0, why, tag):
|
||||
if ln.startswith("[MSG:") or "help]" in ln or ln.startswith("ALARM")]
|
||||
ev[tag + "_messages"] = msgs
|
||||
ctx.log("[%s] controller: %s", tag, msgs)
|
||||
cancel_msg = "%s - job cancelled" % why
|
||||
ctx.check(cancel_msg in text, "[%s] the job was not cancelled with %r as the reason", tag, why)
|
||||
cancel_msg = "%s - job canceled" % why
|
||||
ctx.check(cancel_msg in text, "[%s] the job was not canceled with %r as the reason", tag, why)
|
||||
ctx.check("help]" in text, "[%s] no reset banner after the cancel (the sender must see the job end)", tag)
|
||||
ctx.check("ALARM" not in text, "[%s] an alarm was raised on the cancel (position should be kept)", tag)
|
||||
t0 = time.time()
|
||||
@@ -906,7 +906,7 @@ def lid_cancel_home(ctx):
|
||||
"back.", timeout=60)
|
||||
hold_drift = expect_cancel_and_return(ctx, g, ev, start2, k1, "lid opened", "hold")
|
||||
ctx.check(not g.status_report()["state"].startswith("Hold"),
|
||||
"the controller is still holding after the lid cancelled the paused job")
|
||||
"the controller is still holding after the lid canceled the paused job")
|
||||
ctx.act("lid", "close")
|
||||
ctx.sleep(1)
|
||||
r = g.command("$J=G91X5F1200")
|
||||
@@ -916,7 +916,7 @@ def lid_cancel_home(ctx):
|
||||
wait_idle(ctx, g, 15)
|
||||
g.command("G90")
|
||||
machine_idle(ctx)
|
||||
ctx.log("PASS: lid open cancelled the job from Run (drift %.3f mm) and from the hold (drift %.3f mm), "
|
||||
ctx.log("PASS: lid open canceled the job from Run (drift %.3f mm) and from the hold (drift %.3f mm), "
|
||||
"reset without alarm, head returned to the start both times", drift, hold_drift)
|
||||
|
||||
|
||||
@@ -980,7 +980,7 @@ def interlock_cancel_home(ctx):
|
||||
wait_idle(ctx, g, 15)
|
||||
g.command("G90")
|
||||
machine_idle(ctx)
|
||||
ctx.log("PASS: interlock open cancelled the job with its own reason and the head returned to the "
|
||||
ctx.log("PASS: interlock open canceled the job with its own reason and the head returned to the "
|
||||
"start (drift %.3f mm) with the loop still open", drift)
|
||||
|
||||
|
||||
@@ -1020,7 +1020,7 @@ def lid_policy_hold(ctx):
|
||||
ev["door_state"] = st["state"] if st else g.status_report()["state"]
|
||||
ctx.check(st is not None, "the lid did not park the job in Door (state %s)", ev["door_state"])
|
||||
ev["messages"] = [ln for ln in text.splitlines() if ln.startswith("[MSG:")]
|
||||
ctx.check("job cancelled" not in text, "the job was cancelled under lid_policy=hold: %s", ev["messages"])
|
||||
ctx.check("job canceled" not in text, "the job was canceled under lid_policy=hold: %s", ev["messages"])
|
||||
ctx.check("returned to the job start" not in text,
|
||||
"the head returned to the job start under lid_policy=hold")
|
||||
held = g.status_report()["MPos"]
|
||||
|
||||
@@ -35,7 +35,7 @@ reported messages:
|
||||
sender connection and the armed window, and carry a fresh
|
||||
ts_mono
|
||||
10. the job start survives a pause: a job paused and resumed by the
|
||||
button, then cancelled by the lid, returns to where the job began,
|
||||
button, then canceled by the lid, returns to where the job began,
|
||||
not to where it was paused (the core restarts a held cycle through
|
||||
Idle); a job abandoned in a hold and reset ends there, so the next
|
||||
job's start is captured afresh where it begins
|
||||
@@ -67,8 +67,8 @@ DISARMED = "laser disarmed - latch locked"
|
||||
BLOCKED = "laser fire blocked"
|
||||
PROMPT = "press the button to start the laser job"
|
||||
RESUME_PROMPT = "press the button to resume the laser job"
|
||||
LID_CANCEL = "lid opened during arm - job cancelled"
|
||||
LOOP_CANCEL = "interlock open during arm - job cancelled"
|
||||
LID_CANCEL = "lid opened during arm - job canceled"
|
||||
LOOP_CANCEL = "interlock open during arm - job canceled"
|
||||
|
||||
# EV_SW words for the file-backed switch source: bit 2 button, bit 3 doors
|
||||
# (set = closed), bit 5 interlock loop (set = OPEN).
|
||||
@@ -727,7 +727,7 @@ def test_lid_open_in_wait():
|
||||
if ARMED in "".join(s.log):
|
||||
fail("[loop-in-wait] armed despite the open interlock loop")
|
||||
print("PASS [lid-in-wait]: lid or interlock open during the arm wait "
|
||||
"cancelled the job and never armed")
|
||||
"canceled the job and never armed")
|
||||
finally:
|
||||
s.close()
|
||||
|
||||
@@ -784,7 +784,7 @@ def test_lid_cancels_and_returns():
|
||||
time.sleep(0.5)
|
||||
x_mid = s.mpos_x()
|
||||
s.set_switches(SW_LID_OPEN)
|
||||
if not wait_for(s.log, "lid opened - job cancelled", 5, s.sock):
|
||||
if not wait_for(s.log, "lid opened - job canceled", 5, s.sock):
|
||||
fail("[lid-cancel] the lid open did not cancel the job")
|
||||
if not wait_for(s.log, DISARMED, 5, s.sock):
|
||||
fail("[lid-cancel] the cancel did not close the armed window")
|
||||
@@ -800,7 +800,7 @@ def test_lid_cancels_and_returns():
|
||||
x_end = s.mpos_x()
|
||||
if x_end is None or abs(x_end) > 0.05:
|
||||
fail("[lid-cancel] head not back at the job start: MPos X=%s (was %s mid-job)" % (x_end, x_mid))
|
||||
print("PASS [lid-cancel]: lid open mid-job -> cancelled, disarmed, reset banner, "
|
||||
print("PASS [lid-cancel]: lid open mid-job -> canceled, disarmed, reset banner, "
|
||||
"returned to X=%.3f (mid-job X=%.3f), Idle, no alarm" % (x_end, x_mid))
|
||||
s.close()
|
||||
# Interlock variant.
|
||||
@@ -808,11 +808,11 @@ def test_lid_cancels_and_returns():
|
||||
start_armed_move(s, "loop-cancel", gcode="G1 X20 F600")
|
||||
time.sleep(0.5)
|
||||
s.set_switches(SW_LOOP_OPEN)
|
||||
if not wait_for(s.log, "interlock open - job cancelled", 5, s.sock):
|
||||
if not wait_for(s.log, "interlock open - job canceled", 5, s.sock):
|
||||
fail("[loop-cancel] the interlock open did not cancel the job")
|
||||
if not wait_for(s.log, "returned to the job start", 15, s.sock):
|
||||
fail("[loop-cancel] no return to the job start after the interlock cancel")
|
||||
print("PASS [loop-cancel]: interlock open mid-job -> cancelled and returned")
|
||||
print("PASS [loop-cancel]: interlock open mid-job -> canceled and returned")
|
||||
finally:
|
||||
s.close()
|
||||
|
||||
@@ -839,7 +839,7 @@ def test_pause_then_lid_cancel_returns_to_the_job_start():
|
||||
fail("[pause-lid-cancel] the second press did not resume (state %s)" % s.state())
|
||||
time.sleep(0.4)
|
||||
s.set_switches(SW_LID_OPEN)
|
||||
if not wait_for(s.log, "lid opened - job cancelled", 5, s.sock):
|
||||
if not wait_for(s.log, "lid opened - job canceled", 5, s.sock):
|
||||
fail("[pause-lid-cancel] the lid open did not cancel the job")
|
||||
if not wait_for(s.log, "returned to the job start", 15, s.sock):
|
||||
fail("[pause-lid-cancel] the head did not report returning to the job start")
|
||||
@@ -899,8 +899,8 @@ def test_lid_policy_hold():
|
||||
if not s.wait_state("Door", 3):
|
||||
fail("[lid-hold] the lid open did not park the job in Door (state %s)" % s.state())
|
||||
read_avail(s.sock, s.log, 1.0)
|
||||
if "job cancelled" in "".join(s.log):
|
||||
fail("[lid-hold] the hold policy cancelled the job")
|
||||
if "job canceled" in "".join(s.log):
|
||||
fail("[lid-hold] the hold policy canceled the job")
|
||||
s.set_switches(SW_CLOSED)
|
||||
time.sleep(0.5)
|
||||
s.sock.sendall(b"~")
|
||||
|
||||
@@ -1272,12 +1272,12 @@ def drill_pcurve(g):
|
||||
aborted = 'rung %d did not finish (state=%s)' % (idx + 1, st)
|
||||
break
|
||||
if t_run1 - t_run0 < line_s - 1.5:
|
||||
# A line that ended early was cancelled by the operator or
|
||||
# A line that ended early was canceled by the operator or
|
||||
# the controller, and a cancel may have moved the head
|
||||
# (the controller returns to machine zero). From here every
|
||||
# relative move is aimed from a position this drill no
|
||||
# longer knows, so send nothing more.
|
||||
aborted = ('rung %d ran %.1f s of %.1f: cancelled; no further '
|
||||
aborted = ('rung %d ran %.1f s of %.1f: canceled; no further '
|
||||
'moves sent' % (idx + 1, t_run1 - t_run0, line_s))
|
||||
break
|
||||
rungs.append({'rung': idx + 1, 'repeat': repeat, 'pct': pct,
|
||||
@@ -1486,9 +1486,9 @@ def drill_dpatch(g):
|
||||
% (i + 1, st, cs.get('verdict'), cs.get('reason')))
|
||||
break
|
||||
if t_run1 - t_run0 < 0.5 * est_s:
|
||||
# Cut short: cancelled, and a cancel may have moved the
|
||||
# Cut short: canceled, and a cancel may have moved the
|
||||
# head, so every relative move from here is aimed blind.
|
||||
aborted = ('patch %d ran %.1f s of ~%.0f: cancelled; no further '
|
||||
aborted = ('patch %d ran %.1f s of ~%.0f: canceled; no further '
|
||||
'moves sent' % (i + 1, t_run1 - t_run0, est_s))
|
||||
break
|
||||
p.update({'t_m3': t_m3, 't_run0': t_run0, 't_run1': t_run1})
|
||||
|
||||
Reference in New Issue
Block a user