Pause automatic waveform transfers on hardware Stop

This commit is contained in:
2026-10-07 12:22:00 +03:00
parent 79b0cde20e
commit 6047ceac89
2 changed files with 18 additions and 3 deletions

View File

@@ -86,6 +86,17 @@ class DPO4034:
raise ValueError("Выберите канал CH1…CH4") raise ValueError("Выберите канал CH1…CH4")
return channel return channel
def is_running(self):
"""Read hardware Run/Stop without changing acquisition or transferring data."""
if self.instrument is None:
raise RuntimeError("Прибор не подключён")
state = self.instrument.query("ACQUIRE:STATE?").strip().upper()
if state in ("0", "OFF", "STOP"):
return False
if state in ("1", "ON", "RUN"):
return True
raise ValueError("Некорректное состояние сбора: " + state)
def settings(self, channel="CH1"): def settings(self, channel="CH1"):
self._channel(channel) self._channel(channel)
if self.instrument is None: if self.instrument is None:

View File

@@ -42,9 +42,13 @@ class ScopeSession:
if action == "shutdown": if action == "shutdown":
break break
try: try:
if action == "capture" and len(args) == 4: if action == "capture" and len(args) in (4, 5):
value = client.capture(*args[:3]) automatic = len(args) == 5 and args[4]
value = CaptureFrame(value, prepare_preview(value, args[3])) if automatic and not client.is_running():
value = None
else:
value = client.capture(*args[:3])
value = CaptureFrame(value, prepare_preview(value, args[3]))
elif action == "export": elif action == "export":
filename, waves = args filename, waves = args
with open(filename, "w", newline="", encoding="utf-8-sig") as stream: with open(filename, "w", newline="", encoding="utf-8-sig") as stream: