diff --git a/dripline/extensions/asteval_endpoint.py b/dripline/extensions/asteval_endpoint.py index 68e134b..8a24f77 100644 --- a/dripline/extensions/asteval_endpoint.py +++ b/dripline/extensions/asteval_endpoint.py @@ -21,7 +21,6 @@ def __init__(self, ''' Args: asteval_format_response_string (str): function definition to format response. Default: "def f(response): return response" - *kwargs -> FormatEntity ''' FormatEntity.__init__(self, **kwargs) self.asteval_format_response_string = asteval_format_response_string # has to contain a definition "def f(response): ... return value" @@ -30,7 +29,7 @@ def __init__(self, @calibrate() def on_get(self): - result =FormatEntity.on_get(self) + result = FormatEntity.on_get(self) raw = result["value_raw"] processed_result = self.evaluator(f"f('{raw}')") logger.debug(f"processed_result: {repr(processed_result)}") diff --git a/dripline/extensions/cmd_endpoint.py b/dripline/extensions/cmd_endpoint.py index 2897f18..731b68c 100644 --- a/dripline/extensions/cmd_endpoint.py +++ b/dripline/extensions/cmd_endpoint.py @@ -24,5 +24,5 @@ def __init__(self, cmd_str=None, **kwargs): self.cmd_str = cmd_str def cmd(self): - logger.debug("Command function was successfully called") + logger.debug("in cmd function") return self.service.send_to_device([self.cmd_str]) diff --git a/dripline/extensions/ethernet_huber_service.py b/dripline/extensions/ethernet_huber_service.py index 68f0bdb..952cd9e 100755 --- a/dripline/extensions/ethernet_huber_service.py +++ b/dripline/extensions/ethernet_huber_service.py @@ -27,7 +27,7 @@ def bytes_to_ints(value): class EthernetHuberService(EthernetSCPIService): ''' - A fairly specific subclass of Service for connecting to ethernet-capable thermo fisher devices. + A fairly specific subclass of Service for connecting to ethernet-capable huber devices. In particular, devices must support a half-duplex serial communication with header information, variable length data-payload and a checksum. ''' def __init__(self, **kwargs): @@ -125,27 +125,32 @@ def __init__(self, get_str: hexstring of the command, e.g. 20 ''' if get_str is None: - raise ValueError(' int("7FFF", 16): + val = val - int("FFFF", 16) - 1 + return val/100. + @calibrate() def on_get(self): # setup cmd here - to_send = [self.cmd_str] + to_send = [self.get_str] logger.debug(f'Send cmd in hexstr: {to_send[0]}') result = self.service.send_to_device(to_send) logger.debug(f'raw result is: {result}') result = result[self.offset: self.offset+self.nbytes] if self.numeric: - val = int(result, 16) - if val > int("7FFF", 16): - val = val - int("FFFF", 16) - 1 - result = val / 100. + logger.debug("is numeric") + result = self.convert_to_float(result) + logger.debug(f'extracted result is: {result}') return result def on_set(self, value): diff --git a/dripline/extensions/pfeiffer_endpoint.py b/dripline/extensions/pfeiffer_endpoint.py index 3a898e6..bffd8f6 100644 --- a/dripline/extensions/pfeiffer_endpoint.py +++ b/dripline/extensions/pfeiffer_endpoint.py @@ -34,7 +34,7 @@ def __init__(self, Args: parameter (int): number of the parameter as documented in the manual" datatype (str): one of ["bool_old", "uint", "ureal", "string", "bool", "ushort", "uexpo", "str16", "str8" - unit_address (int): number of the unit address, allwoed range: 1-16 + unit_address (int): number of the unit address, allowed range: 1-16 ''' Entity.__init__(self, **kwargs) self.parameter = parameter