laser_stream_test: rule 8 reads a FIRE tick's distance from a step, so a dwell burn shows under the dither

check_fire_gaps counted consecutive stepless ticks carrying FIRE and
reset on any dark tick: the analog rendering of a fire state leaked
into a cycle's idle pad (stepper_stream.c gf_stream_go_idle names it:
a stationary dwell burn at every planner starve). Under the density
model every tick goes through the dither mask, so the same leaked
state renders as bursts of at most one period (80 ticks at S800)
split by dark ticks, and the run never reaches the limit. With the
analog churn session gone, density-churn was the only session on rule
9, and it could not see the leak it was there for.

The check now reads rule 8 both ways: the run of lit stepless ticks as
before, and for every FIRE tick its distance from the nearest step on
either side, the one before it and the one after it. A cut's first
FIRE tick leads its first step by the accel-from-rest interval (412
ticks at x32) and its last trails its last step by less, both inside
the limit (1000); a FIRE tick with no step that near on either side is
in a gap, and lit, however the dither spaced it. The distance is read
from both sides because a stream opens dark on its lead-in pad and a
cycle opens lit before its first step: depth into a stepless run alone
flagged the m4 session's first lit tick, 22529 ticks of dark pad after
the stream start and a few hundred before the first step.

Proof: on synthetic streams, a legitimate 2253-tick dark gap between
two cuts passes both readings; a continuous analog leak across it
fails both; the same gap carrying a dithered leak at S800 (64 of 80
ticks lit) and at S200 (16 of 80) passed the old reading and fails the
new. The whole harness passes against the native null-sink build
(-DGFMCODE_WAIT_S=5.0), every session.

Acceptance: none; the harness is grblHAL's CI's, and src/** of
grblhal-glowforge keeps its covers.
This commit is contained in:
ScottW514
2026-10-15 16:18:06 -04:00
parent c3da9fa1bd
commit 80ddd53bcd
+43 -12
View File
@@ -24,7 +24,10 @@ over TCP, then checks the dumps against the kernel feeder contract:
the stream must never lean on the kernel's end-of-data backstop
8. no FIRE bit ever rides a zero-step gap: a stepless run of stream
bytes carrying FIRE longer than any legitimate between-step
interval is a stationary dwell burn
interval is a stationary dwell burn, and so is a FIRE tick deeper
into a stepless run than that interval, however it is spaced (the
density dither masks a stale fire state into bursts split by dark
ticks, so FIRE continuity says nothing under it; depth does)
9. rules 7-8 hold across rapid cycle stop/start churn (planner-starve
shaped jobs), where the FIRE state of the previous cycle must not
leak into the idle-gap pad bytes
@@ -692,19 +695,47 @@ def tick_bytes(data):
def check_fire_gaps(name, data):
"""Rule 8: no stepless run carrying FIRE longer than the limit."""
run = 0
"""Rule 8, read both ways so it holds under either power model: no
stepless run carrying FIRE on every tick for the limit (a stale fire
state as the analog model renders it), and no FIRE tick farther than
the limit from every step, the one before it and the one after it
(the same state as the density model renders it: the dither masks it
into bursts shorter than the limit, split by dark ticks, so the first
reading never trips). A cut's first FIRE tick leads its first step by
the accel-from-rest interval and its last trails its last step by
less, both inside the limit; a FIRE tick with no step that near on
either side is in a gap, and lit."""
ticks = tick_bytes(data)
n = len(ticks)
# Ticks from each tick to the next step tick at or after it.
ahead = [n] * n
nxt = None
for i in range(n - 1, -1, -1):
if ticks[i] & 0x25: # an X/Y/Z step
nxt = i
if nxt is not None:
ahead[i] = nxt - i
run = 0 # consecutive stepless ticks carrying FIRE
since = n # ticks since the last step
worst = 0
for tick, b in enumerate(tick_bytes(data)):
if b & 0x10 and not b & 0x25: # FIRE, no X/Y/Z step
run += 1
worst = max(worst, run)
if run >= FIRE_GAP_LIMIT_TICKS:
fail("[%s] FIRE carried across a %d-tick zero-step gap "
"ending at tick %d (stationary dwell burn)"
% (name, run, tick))
else:
for tick, b in enumerate(ticks):
if b & 0x25:
run = since = 0
continue
since += 1
if not b & 0x10:
run = 0
continue
run += 1
worst = max(worst, run)
if run >= FIRE_GAP_LIMIT_TICKS:
fail("[%s] FIRE carried across a %d-tick zero-step gap "
"ending at tick %d (stationary dwell burn)"
% (name, run, tick))
if since > FIRE_GAP_LIMIT_TICKS and ahead[tick] > FIRE_GAP_LIMIT_TICKS:
fail("[%s] FIRE %d ticks after a step and %d before the next, "
"at tick %d (stationary dwell burn, masked by the dither)"
% (name, since, ahead[tick], tick))
return worst