Track completed Single acquisitions and persist recent addresses

This commit is contained in:
2026-10-07 12:32:29 +03:00
parent 6047ceac89
commit c011c2957b
4 changed files with 103 additions and 1 deletions
+10 -1
View File
@@ -3,6 +3,7 @@ from dataclasses import dataclass
from queue import Queue
from threading import Thread
import csv
from .tektronix_capture_state import CaptureState
from .tektronix import DPO4034, Waveform
from .plot_decimation import pixel_envelope
@@ -36,6 +37,7 @@ class ScopeSession:
def _run(self, factory):
client = factory()
state = CaptureState()
try:
while True:
action, args = self.commands.get()
@@ -44,11 +46,14 @@ class ScopeSession:
try:
if action == "capture" and len(args) in (4, 5):
automatic = len(args) == 5 and args[4]
if automatic and not client.is_running():
status = client.acquisition_status() if automatic else None
if automatic and not state.ready(status):
value = None
else:
value = client.capture(*args[:3])
value = CaptureFrame(value, prepare_preview(value, args[3]))
if automatic:
state.consumed(status)
elif action == "export":
filename, waves = args
with open(filename, "w", newline="", encoding="utf-8-sig") as stream:
@@ -62,6 +67,10 @@ class ScopeSession:
writer.writerow([stamp * 1000, *(w.values[index] for w in waves)])
value = filename
else:
if action == "connect":
state = CaptureState()
if action == "acquisition" and args[0] == "single":
state.arm()
value = getattr(client, action)(*args)
self.results.put((action, value, None))
except Exception as exc: