fix code for current framwork version

- remove _iodev, use HasIo instead of HasIodev
- add earlyInit super call
This commit is contained in:
zolliker 2022-09-08 14:57:06 +02:00
parent 8bfe969a95
commit 3597adf869
3 changed files with 9 additions and 8 deletions

View File

@ -85,7 +85,7 @@ class DPM3(HasIO, Readable):
else: else:
cmd = "" cmd = ""
cmd = cmd + '*1G3%02X' % adr cmd = cmd + '*1G3%02X' % adr
hexvalue = self._iodev.communicate(cmd) hexvalue = self.communicate(cmd)
if adr == self.SCALE: if adr == self.SCALE:
mag = self.MAGNITUDE[hexvalue[0:1]] mag = self.MAGNITUDE[hexvalue[0:1]]
value = int(hexvalue[1:], 16) value = int(hexvalue[1:], 16)
@ -95,7 +95,7 @@ class DPM3(HasIO, Readable):
def write_digits(self, value): def write_digits(self, value):
# value defines the number of digits # value defines the number of digits
back_value = self._iodev.communicate('*1F135%02X\r*1G135' % (value + 1)) back_value = self.communicate('*1F135%02X\r*1G135' % (value + 1))
self.digits = int(back_value, 16) - 1 self.digits = int(back_value, 16) - 1
# recalculate proper scale and offset # recalculate proper scale and offset
self.write_scale_factor(self.scale_factor) self.write_scale_factor(self.scale_factor)
@ -103,11 +103,11 @@ class DPM3(HasIO, Readable):
return Done return Done
def read_digits(self): def read_digits(self):
back_value = self._iodev.communicate('*1G135') back_value = self.communicate('*1G135')
return int(back_value,16) - 1 return int(back_value,16) - 1
def read_value(self): def read_value(self):
return float(self._iodev.communicate('*1B1')) return float(self.communicate('*1B1'))
def read_offset(self): def read_offset(self):
reply = self.query(self.OFFSET) reply = self.query(self.OFFSET)

View File

@ -24,7 +24,7 @@ import time
from secop.datatypes import StringType, FloatRange from secop.datatypes import StringType, FloatRange
from secop.modules import Parameter, Property, Readable from secop.modules import Parameter, Property, Readable
from secop.io import HasIodev, StringIO from secop.io import HasIO, StringIO
class LscIO(StringIO): class LscIO(StringIO):
@ -33,13 +33,13 @@ class LscIO(StringIO):
wait_before = 0.05 wait_before = 0.05
class ResChannel(HasIodev, Readable): class ResChannel(HasIO, Readable):
"""temperature channel on Lakeshore 340""" """temperature channel on Lakeshore 340"""
iodevClass = LscIO ioClass = LscIO
value = Parameter(datatype=FloatRange(unit='Ohm')) value = Parameter(datatype=FloatRange(unit='Ohm'))
channel = Property('the channel A,B,C or D', StringType()) channel = Property('the channel A,B,C or D', StringType())
def read_value(self): def read_value(self):
return float(self._iodev.communicate('SRDG?%s' % self.channel)) return float(self.communicate('SRDG?%s' % self.channel))

View File

@ -71,6 +71,7 @@ class Uniax(PersistentMixin, Drivable):
_find_target = 0 _find_target = 0
def earlyInit(self): def earlyInit(self):
super().earlyInit()
self._zero_pos_tol = {} self._zero_pos_tol = {}
self._action = self.idle self._action = self.idle