Update of state names

This commit is contained in:
gac-x01da
2024-10-17 07:02:06 +02:00
committed by wakonig_k
parent 6d43a08bd5
commit 23dd8c11e0

View File

@@ -25,10 +25,10 @@ class NidaqState(int, enum.Enum):
""" Possible States of the NIDAQ backend"""
DISABLED = 0
STANDBY = 1
PRERUN = 2
ACQUIRING = 3
STOPPED = 4
ERRORSTOP = 5
STAGE = 2
KICKOFF = 3
ACQUIRE = 4
UNSTAGE = 5
class ScanRates(int, enum.Enum):
""" Sampling Rate options for the backend, in kHZ and MHz"""
@@ -121,13 +121,13 @@ class NIDAQCustomMixin(CustomDetectorMixin):
self.parent.scan_type.set(ScanType.TRIGGERED).wait()
# TODO, not working with scan_duration 0 for the moment to be fixed once solved
self.parent.scan_duration.set(999999).wait()
self.parent.arm.set(1).wait()
if not self.wait_for_signals(signal_conditions=[(self.parent.state.get, NidaqState.PRERUN)],
self.parent.stage_call.set(1).wait()
if not self.wait_for_signals(signal_conditions=[(self.parent.state.get, NidaqState.STAGE)],
timeout = self.timeout_wait_for_signal,
check_stopped=True,
):
raise NidaqError(f"Device {self.parent.name} has not been reached in state PRERUN, current state {NidaqState(self.parent.state.get())}")
self.parent.trigger_call.set(1).wait()
raise NidaqError(f"Device {self.parent.name} has not been reached in state STAGE, current state {NidaqState(self.parent.state.get())}")
self.parent.kickoff_call.set(1).wait()
logger.info(f"Device {self.parent.name} was staged: {NidaqState(self.parent.state.get())}")
def on_pre_scan(self) -> None:
@@ -136,11 +136,11 @@ class NIDAQCustomMixin(CustomDetectorMixin):
The NIDAQ should go into Acquiring mode. """
if not self._check_if_scan_name_is_valid():
return None
if not self.wait_for_signals(signal_conditions=[(self.parent.state.get, NidaqState.ACQUIRING)],
if not self.wait_for_signals(signal_conditions=[(self.parent.state.get, NidaqState.KICKOFF)],
timeout = self.timeout_wait_for_signal,
check_stopped=True,
):
raise NidaqError(f"Device {self.parent.name} failed to reach state ACQUIRING during pre scan, current state {NidaqState(self.parent.state.get())}")
raise NidaqError(f"Device {self.parent.name} failed to reach state KICKOFF during pre scan, current state {NidaqState(self.parent.state.get())}")
logger.info(f"Device {self.parent.name} ready to take data after pre_scan: {NidaqState(self.parent.state.get())}")
def on_unstage(self) -> None:
@@ -174,8 +174,8 @@ class NIDAQ(PSIDetectorBase):
enable_compression = Cpt(EpicsSignal, suffix="NIDAQ-EnableRLE", kind=Kind.config)
trigger_call = Cpt(EpicsSignal, suffix="NIDAQ-Trigger", kind=Kind.config)
arm = Cpt(EpicsSignal, suffix="NIDAQ-Arm", kind = Kind.config)
kickoff_call = Cpt(EpicsSignal, suffix="NIDAQ-Kickoff", kind=Kind.config)
stage_call = Cpt(EpicsSignal, suffix="NIDAQ-Stage", kind = Kind.config)
state = Cpt(EpicsSignal, suffix="NIDAQ-FSMState", kind= Kind.config)
server_status = Cpt(EpicsSignalRO, suffix="NIDAQ-ServerStatus", kind=Kind.config)
compression_ratio = Cpt(EpicsSignalRO, suffix="NIDAQ-CompressionRatio", kind=Kind.config)