Commit e268dc1c authored by bliss administrator's avatar bliss administrator
Browse files

attenuator setup channels for factor and thickness to be displayed in daiquiri

parent e0832e21
Pipeline #56133 failed
from bliss.scanning.scan_meta import get_user_scan_meta
from bliss.config.channels import Cache
'''
class: ID26attenuator
package: id26.controllers.attenuator
......@@ -27,6 +27,12 @@ class ID26Attenuator:
self.wkey = config_dict['wago_logical_name']
self.unit = float(config_dict ['attenuation_unit'])
self.filters = config_dict['filters']
self.__factor = Cache(self, "factor", default_value=0)
self.__thickness = Cache(self, "thickness", default_value=0)
self.factor()
self.thickness()
self._init_meta_data_publishing()
......@@ -69,22 +75,22 @@ class ID26Attenuator:
return (msg)
def factor (self, value = None):
if value != None:
register = list(map(int,' '.join(bin(value)[2:].rjust(len(self.filters),'0')[::-1]).split()))
self.wago.set (self.wkey, register)
register = self.wago.get(self.wkey)
factor = int(''.join(list(map(str,register)))[::-1], base=2)
self.__factor.value = factor
return factor
def thickness (self, value = None):
if value != None:
newvalue = int(value/self.unit)
self.factor(newvalue)
value = self.unit*self.factor()
value = self.unit*self.factor()
self.__thickness.value = value
return value
def insert (self, *channel):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment