changes, final for today

This commit is contained in:
david rice
2026-04-02 16:17:47 +01:00
parent c61476e846
commit 37aef9e5f7

View File

@@ -176,23 +176,22 @@ def _set_timebase(scale, points):
def _arm_and_wait(timeout=20):
"""
Fire a single acquisition and block until the scope stops (trigger + capture done).
Returns True on success, False on timeout.
Fire a single acquisition using :DIGitize (blocking on Infiniium) and
confirm completion with *OPC?. Temporarily extends scope.timeout to
cover the full wait period.
Returns True on success, False on error/timeout.
"""
scope.write(":SINGle")
deadline = time.time() + timeout
while time.time() < deadline:
try:
# OPERegister bit 3 (mask 0x08) = instrument is running/armed.
# When it clears the acquisition is complete.
cond = int(scope.ask(":OPERegister:CONDition?").strip())
if not (cond & 0x08):
return True
except Exception:
pass
time.sleep(0.25)
print(" WARNING: ACQUISITION TIMEOUT — SCOPE MAY NOT HAVE TRIGGERED.")
return False
prev_timeout = scope.timeout
try:
scope.timeout = timeout + 5 # headroom over the DIGitize wait
scope.write(":DIGitize")
resp = scope.ask("*OPC?").strip()
return resp == "1"
except Exception as e:
print(f" ACQUIRE ERROR: {e}")
return False
finally:
scope.timeout = prev_timeout
def _save_pass(tag, iteration, ts):