fix(panda): edges during a running line are logged, not a scan error
CI for csaxs_bec / test (push) Successful in 3m27s

At 2 mm/s an extra edge at the PSO window entry arrived during the running line
(small field of view, line 4); it was ignored as designed, like on the DDG, but
wait_lines_done aborted the scan. Wrong line or pulse counts still fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M8zoDyJxbBLmjZCEPUo5FM
This commit is contained in:
Mirko HollerandClaude Opus 5.5 committed 2026-10-29 11:34:21 +01:00
1 parent db77f0df81
commit 77d08df54c
3 files changed
+12 -11

No files matched your search

+2 -2
View File
@@ -164,8 +164,8 @@ dev.pandatrig.wait_lines_done(n_lines=1, timeout=5)
dev.pandatrig.line_status() # triggers, lines, pulses, dropped since arm()
```
`wait_lines_done` fails on timeout, on a wrong number of lines or gates and on ignored
edges.
`wait_lines_done` fails on timeout and on a wrong number of lines or gates; ignored edges
(during a running line, e.g. encoder noise at the PSO window entry) are only logged.
PandA FPGA 4.1 PULSE block: an ENABLE edge, a parameter write or a dropped trigger often
makes it replay the previous pulse train without a trigger. The device keeps the PULSE
@@ -348,9 +348,10 @@ class PandaLineTrigger(Device):
def wait_lines_done(self, n_lines: int, timeout: float, poll: float = 0.02) -> dict:
"""
Wait until n_lines lines were triggered and all their pulses sent. Fails on timeout,
on more lines or pulses than expected and on ignored trigger edges (edge during a
running line).
Wait until n_lines lines were triggered and all their pulses sent. Fails on timeout
and on more lines or pulses than expected. Ignored trigger edges (edge during a
running line, e.g. encoder noise at the PSO window entry; the DDG ignores them too)
are only logged.
"""
n_pulses = self._pulse_params["n_pulses"] if self._pulse_params else 0
start = time.time()
@@ -378,7 +379,7 @@ class PandaLineTrigger(Device):
f" got {status['lines']} with {status['pulses']}."
)
if status["triggers"] != status["lines"]:
raise PandaLineTriggerError(
logger.warning(
f"{self.name}: {status['triggers'] - status['lines']} trigger edge(s) ignored"
f" (edge while a line was running or while not armed): {status}."
)
@@ -120,19 +120,19 @@ def test_one_shot_accepts_one_edge(trigger):
trigger.software_trigger()
assert trigger.wait_lines_done(1, timeout=1)["armed"] is False
trigger.software_trigger()
with pytest.raises(PandaLineTriggerError, match="1 trigger edge"):
trigger.wait_lines_done(1, timeout=1)
status = trigger.wait_lines_done(1, timeout=1)
assert status["triggers"] == 2 and status["lines"] == 1
def test_edge_during_line_is_reported(trigger):
def test_edge_during_line_is_ignored(trigger):
trigger.configure_line(5, exp_time=0.01)
trigger.arm()
trigger.software_trigger()
trigger.panda.busy = True
trigger.software_trigger()
trigger.panda.busy = False
with pytest.raises(PandaLineTriggerError, match="ignored"):
trigger.wait_lines_done(1, timeout=1)
status = trigger.wait_lines_done(1, timeout=1)
assert status["triggers"] == 2 and status["lines"] == 1 and status["pulses"] == 5
def test_arm_needs_configure(trigger):