bec_worker: removed superfluous devices and added frontlight brightness
This commit is contained in:
@@ -82,7 +82,7 @@ class BECClientWorker:
|
||||
try:
|
||||
self.position_devices, self.planner = self.__init_beamline_environment()
|
||||
self.__backlight_brightness = self.position_devices['bl_bright']
|
||||
self.__detector_cover = self.position_devices['det_cov']
|
||||
self.__frontlight_brightness = self.position_devices['fl_bright']
|
||||
except Exception as e:
|
||||
logger.error(f"Error initialising BEC devices: {e}")
|
||||
#raise self._raise_bec_error(e, operation="create planner")
|
||||
@@ -358,9 +358,9 @@ class BECClientWorker:
|
||||
"Invalid BEC reinitialisation method. "
|
||||
"Expected one of: auto, beamline, sample."
|
||||
)
|
||||
|
||||
#TODO move these into Init beamline env
|
||||
self.__backlight_brightness = self.position_devices['bl_bright']
|
||||
self.__detector_cover = self.position_devices['det_cov']
|
||||
self.__frontlight_brightness = self.position_devices['fl_bright']
|
||||
logger.info(f"Reinitialised BEC planner and position devices using method={method}")
|
||||
return self.list_position_devices()
|
||||
except Exception as e:
|
||||
@@ -451,50 +451,6 @@ class BECClientWorker:
|
||||
except Exception as e:
|
||||
self._raise_bec_error(e, operation=f"scans.mv:det_y:{value}", tags=["det_z"])
|
||||
|
||||
@property
|
||||
def detector_cover(self) -> DetectorCoverEnum:
|
||||
"""Returns the detector cover POSTION.
|
||||
If actual is True, returns the positon as an Enum: 2 is open, 1 is closed.
|
||||
otherwise returns the position value.
|
||||
"""
|
||||
if self.simulated:
|
||||
return DetectorCoverEnum.CLOSED
|
||||
try:
|
||||
return DetectorCoverEnum(self.__detector_cover.position)
|
||||
except Exception as e:
|
||||
self._raise_bec_error(e, operation=f"get_det_cov", tags=["det_cov"])
|
||||
raise
|
||||
|
||||
@detector_cover.setter
|
||||
def detector_cover(self, position:DetectorCoverEnum):
|
||||
"""Move the detector cover to the specified position"""
|
||||
if self.simulated:
|
||||
logger.info(f"Simulating detector cover move to {position.value}")
|
||||
return
|
||||
try:
|
||||
self.__detector_cover.move(position)
|
||||
except Exception as e:
|
||||
self._raise_bec_error(e, operation=f"position_devices['det_cov'].move:{position.value}", tags=["det_cov"])
|
||||
raise
|
||||
|
||||
def detector_cover_toggle(self):
|
||||
"""Toggle the detector cover"""
|
||||
if self.simulated:
|
||||
return
|
||||
try:
|
||||
current = self.detector_cover
|
||||
if current is DetectorCoverEnum.OPEN:
|
||||
target = DetectorCoverEnum.CLOSED
|
||||
else:
|
||||
target = DetectorCoverEnum.OPEN
|
||||
self.detector_cover = target
|
||||
except Exception as e:
|
||||
self._raise_bec_error(
|
||||
e,
|
||||
operation=f"detector cover toggle, could not change cover open/close ",
|
||||
tags=["det_cov"]
|
||||
)
|
||||
|
||||
@property
|
||||
def backlight_brightness(self) -> BrightnessEnum:
|
||||
"""returns backlight brightness as an Enum: 'off' or 'on', can also be a value...
|
||||
|
||||
Reference in New Issue
Block a user