Merge pull request 'fix(nidaq): fix on_kickoff call not using set' (#93) from fix-nidaq-kickoff into main
CI for debye_bec / test (push) Successful in 1m4s
CI for debye_bec / test (push) Successful in 1m4s
Tested and works
This commit was merged in pull request #93.
This commit is contained in:
@@ -35,7 +35,7 @@ class DataViewer(BECWidget, QWidget):
|
||||
ICON_NAME = "find_in_page"
|
||||
|
||||
def __init__(self, *arg, parent=None, **kwargs):
|
||||
super().__init__(parent=parent, theme_update=True, *arg, **kwargs)
|
||||
super().__init__(parent=parent, *arg, **kwargs)
|
||||
self.get_bec_shortcuts()
|
||||
|
||||
central = QWidget()
|
||||
|
||||
@@ -76,7 +76,7 @@ class DigitalTwin(BECWidget, QWidget):
|
||||
ICON_NAME = "lightbulb"
|
||||
|
||||
def __init__(self, *arg, parent=None, **kwargs):
|
||||
super().__init__(parent=parent, theme_update=True, *arg, **kwargs)
|
||||
super().__init__(parent=parent, *arg, **kwargs)
|
||||
self.get_bec_shortcuts()
|
||||
|
||||
self.beamline = get_beamline_id()
|
||||
|
||||
@@ -39,7 +39,7 @@ class HutchCam(PSIDeviceBase):
|
||||
super().__init__(name=name, scan_info=scan_info, **kwargs)
|
||||
self.scan_parameters: ScanServerScanInfo = None
|
||||
self.hostname = prefix
|
||||
self.name = ""
|
||||
self.camera_name = ""
|
||||
|
||||
# pylint: disable=E1101
|
||||
def on_connected(self) -> None:
|
||||
@@ -49,12 +49,14 @@ class HutchCam(PSIDeviceBase):
|
||||
info_url = f"http://{CAM_USERNAME}:{CAM_PASSWORD}@{self.hostname}.psi.ch/-wvhttp-01-/info.cgi?item=c.1.name"
|
||||
response = requests.get(info_url, timeout=5)
|
||||
response.raise_for_status()
|
||||
self.name = response.content.decode("utf-8").split("c.1.name.utf8:=")[-1].strip().lower()
|
||||
self.camera_name = (
|
||||
response.content.decode("utf-8").split("c.1.name.utf8:=")[-1].strip().lower()
|
||||
)
|
||||
|
||||
def on_stage(self) -> DeviceStatus:
|
||||
"""Called while staging the device."""
|
||||
self.scan_parameters = fetch_scan_info(self.scan_info)
|
||||
file_path = get_full_path(self.scan_info.msg, name=self.name).removesuffix("h5")
|
||||
file_path = get_full_path(self.scan_info.msg, name=self.camera_name).removesuffix("h5")
|
||||
|
||||
thread = threading.Thread(
|
||||
target=self.acquire_and_save_from_video, args=(file_path,), daemon=True
|
||||
|
||||
@@ -6,9 +6,9 @@ from typing import TYPE_CHECKING, Literal
|
||||
from bec_lib.logger import bec_logger
|
||||
from bec_server.scan_server.scans.scan_base import ScanInfo as ScanServerScanInfo
|
||||
from ophyd import Component as Cpt
|
||||
from ophyd import Device, DeviceStatus, EpicsSignal, EpicsSignalRO, Kind, StatusBase
|
||||
from ophyd import Device, DeviceStatus, EpicsSignal, EpicsSignalRO, Kind
|
||||
from ophyd.status import WaitTimeoutError
|
||||
from ophyd_devices import CompareStatus, ProgressSignal, TransitionStatus
|
||||
from ophyd_devices import CompareStatus, ProgressSignal, StatusBase, TransitionStatus
|
||||
from ophyd_devices.interfaces.base_classes.psi_device_base import PSIDeviceBase
|
||||
from ophyd_devices.sim.sim_signals import SetableSignal
|
||||
|
||||
@@ -433,13 +433,18 @@ class Nidaq(PSIDeviceBase, NidaqControl):
|
||||
status.wait(timeout=self.timeout_wait_for_signal)
|
||||
if self.scan_parameters.scan_name != "nidaq_continuous_scan":
|
||||
status = self.on_kickoff()
|
||||
self.cancel_on_stop(status)
|
||||
status.wait(timeout=self._timeout_wait_for_pv)
|
||||
status.wait()
|
||||
logger.info(f"Device {self.name} was staged: {NidaqState(self.state.get())}")
|
||||
|
||||
def on_kickoff(self) -> DeviceStatus | StatusBase:
|
||||
"""Kickoff the Nidaq"""
|
||||
status = self.kickoff_call.set(1)
|
||||
status = CompareStatus(
|
||||
self.state,
|
||||
NidaqState.KICKOFF.value,
|
||||
timeout=self._timeout_wait_for_pv,
|
||||
description="Waiting for NIDAQ to enter KICKOFF state",
|
||||
)
|
||||
self.kickoff_call.put(1)
|
||||
self.cancel_on_stop(status)
|
||||
return status
|
||||
|
||||
|
||||
Reference in New Issue
Block a user