diff --git a/mipi_test.py b/mipi_test.py index 0064777..c472eaf 100644 --- a/mipi_test.py +++ b/mipi_test.py @@ -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):