DAQ: added back_light and fornt_light functionality for changing brightness, can set the state of the backlight.
This commit is contained in:
+36
-6
@@ -6,6 +6,7 @@
|
||||
# - property setter, which assumes that sync move is done (excl. zoom, which is async by default)
|
||||
|
||||
import time
|
||||
from enum import Enum
|
||||
|
||||
import numpy as np
|
||||
from epics import PV
|
||||
@@ -18,6 +19,9 @@ from aare.devices.area_detector import epicsAD
|
||||
from aare.devices.enum_pv import EnumPv
|
||||
from aare.devices.my_motor import MyMotor
|
||||
|
||||
class BacklightPositionEnum(Enum):
|
||||
PARK = 0
|
||||
MEASURE = 1
|
||||
|
||||
class BeamlineDevices:
|
||||
def __init__(self, beamline: MXBeamline):
|
||||
@@ -27,7 +31,14 @@ class BeamlineDevices:
|
||||
self.__ring_current_pv = PV(f"ARS07-DPCT-0100:CURR")
|
||||
self.__dtz = MyMotor(f"{BEAMLINE}-ES-DET:TRZ")
|
||||
self.__sample_cam = epicsAD(f"{BEAMLINE}-SAMCAM:")
|
||||
self.__back_light = PV(f"{BEAMLINE}-ES-BL")
|
||||
|
||||
self.__back_light_pos_set = PV(f"{BEAMLINE}-ES-BL:POS-SET")
|
||||
self.__back_light_pos_get = PV(f"{BEAMLINE}-ES-BL:POS-GET")
|
||||
self.__back_light_bright_set = PV(f"{BEAMLINE}-ES-BL:SET")
|
||||
self.__back_light_bright_get = PV(f"{BEAMLINE}-ES-BL:GET")
|
||||
self.__front_light_bright_set = PV(f"{BEAMLINE}-ES-BL:SET")
|
||||
self.__front_light_bright_get = PV(f"{BEAMLINE}-ES-BL:GET")
|
||||
|
||||
self.__zoom_set = PV(f"{BEAMLINE}-ES-SAMCAM:ZOOM.VAL")
|
||||
self.__zoom_get = PV(f"{BEAMLINE}-ES-SAMCAM:ZOOM.RBV")
|
||||
self.__aerotech = aerotech.AerotechControllerEpics(beamline)
|
||||
@@ -46,11 +57,26 @@ class BeamlineDevices:
|
||||
# Lamp light
|
||||
@property
|
||||
def lamp_light(self) -> float:
|
||||
return 0
|
||||
return self.__front_light_bright_get.get()
|
||||
|
||||
@lamp_light.setter
|
||||
def lamp_light(self, v: float):
|
||||
pass
|
||||
self.set_front_light(v, wait=False)
|
||||
|
||||
def set_front_light(self, v: float, /, wait: bool = True):
|
||||
self.__front_light_bright_set.put(v, wait=wait)
|
||||
|
||||
# Back light
|
||||
@property
|
||||
def back_light(self) -> float:
|
||||
return self.__back_light_bright_get.get()
|
||||
|
||||
@lamp_light.setter
|
||||
def back_light(self, v: float):
|
||||
self.set_back_light(v, wait=False)
|
||||
|
||||
def set_back_light(self, v: float, /, wait: bool = True):
|
||||
self.__back_light_bright_set.put(v, wait=wait)
|
||||
|
||||
# Zoom
|
||||
@property
|
||||
@@ -91,11 +117,15 @@ class BeamlineDevices:
|
||||
# Reflector (backlight?)
|
||||
@property
|
||||
def reflector_up(self) -> bool:
|
||||
return False
|
||||
return self.__back_light_pos_get.get() == BacklightPositionEnum.MEASURE.value
|
||||
|
||||
@reflector_up.setter
|
||||
def reflector_up(self, value: bool):
|
||||
pass
|
||||
def reflector_up(self, value: StagePositionEnum):
|
||||
self.set_reflector_up(value, wait=True)
|
||||
|
||||
def set_reflector_up(self, value: StagePositionEnum, /, wait: bool = True):
|
||||
self.__back_light_pos_set.put(BacklightPositionEnum.MEASURE.value if value else BacklightPositionEnum.PARK.value,
|
||||
wait=wait)
|
||||
|
||||
# Beamstop
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user