mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2026-02-06 15:18:40 +01:00
fix(undulator): fix setpoint and motor stop signal
This commit is contained in:
@@ -24,11 +24,43 @@ class UNDULATORCONTROL(int, enum.Enum):
|
|||||||
BEAMLINE = 1
|
BEAMLINE = 1
|
||||||
|
|
||||||
|
|
||||||
class UndulatorEpicsSignal(EpicsSignal):
|
class UndulatorSetointSignal(EpicsSignal):
|
||||||
"""
|
"""
|
||||||
SLS Undulator setpoint control
|
SLS Undulator setpoint control
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def put(
|
||||||
|
self,
|
||||||
|
value,
|
||||||
|
force=False,
|
||||||
|
connection_timeout=DEFAULT_CONNECTION_TIMEOUT,
|
||||||
|
callback=None,
|
||||||
|
use_complete=None,
|
||||||
|
timeout=DEFAULT_WRITE_TIMEOUT,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Put a value to the setpoint PV.
|
||||||
|
|
||||||
|
If the undulator is operator controlled, it will not move.
|
||||||
|
"""
|
||||||
|
if self.parent.select_control.get() == UNDULATORCONTROL.OPERATOR.value:
|
||||||
|
raise PermissionError("Undulator is operator controlled!")
|
||||||
|
return super().put(
|
||||||
|
value,
|
||||||
|
force=force,
|
||||||
|
connection_timeout=connection_timeout,
|
||||||
|
callback=callback,
|
||||||
|
use_complete=use_complete,
|
||||||
|
timeout=timeout,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class UndulatorStopSignal(EpicsSignal):
|
||||||
|
"""
|
||||||
|
SLS Undulator stop signal"""
|
||||||
|
|
||||||
def put(
|
def put(
|
||||||
self,
|
self,
|
||||||
value,
|
value,
|
||||||
@@ -48,7 +80,7 @@ class UndulatorEpicsSignal(EpicsSignal):
|
|||||||
logger.error(
|
logger.error(
|
||||||
f"Cannot use put for signal {self.name}; Undulator is operator controlled!"
|
f"Cannot use put for signal {self.name}; Undulator is operator controlled!"
|
||||||
)
|
)
|
||||||
return # Do not raise an error, just log it and return None.
|
return None
|
||||||
return super().put(
|
return super().put(
|
||||||
value,
|
value,
|
||||||
force=force,
|
force=force,
|
||||||
@@ -65,10 +97,10 @@ class UndulatorGap(PVPositioner):
|
|||||||
SLS Undulator gap control
|
SLS Undulator gap control
|
||||||
"""
|
"""
|
||||||
|
|
||||||
setpoint = Cpt(UndulatorEpicsSignal, suffix="GAP-SP")
|
setpoint = Cpt(UndulatorSetointSignal, suffix="GAP-SP")
|
||||||
readback = Cpt(EpicsSignal, suffix="GAP-RBV", kind="hinted", auto_monitor=True)
|
readback = Cpt(EpicsSignalRO, suffix="GAP-RBV", kind="hinted", auto_monitor=True)
|
||||||
|
|
||||||
stop_signal = Cpt(UndulatorEpicsSignal, suffix="STOP")
|
stop_signal = Cpt(UndulatorStopSignal, suffix="STOP")
|
||||||
done = Cpt(EpicsSignalRO, suffix="DONE", auto_monitor=True)
|
done = Cpt(EpicsSignalRO, suffix="DONE", auto_monitor=True)
|
||||||
|
|
||||||
select_control = Cpt(EpicsSignalRO, suffix="SCTRL", auto_monitor=True)
|
select_control = Cpt(EpicsSignalRO, suffix="SCTRL", auto_monitor=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user