fix code for current framwork version
- remove _iodev, use HasIo instead of HasIodev - add earlyInit super call
This commit is contained in:
@ -85,7 +85,7 @@ class DPM3(HasIO, Readable):
|
||||
else:
|
||||
cmd = ""
|
||||
cmd = cmd + '*1G3%02X' % adr
|
||||
hexvalue = self._iodev.communicate(cmd)
|
||||
hexvalue = self.communicate(cmd)
|
||||
if adr == self.SCALE:
|
||||
mag = self.MAGNITUDE[hexvalue[0:1]]
|
||||
value = int(hexvalue[1:], 16)
|
||||
@ -95,7 +95,7 @@ class DPM3(HasIO, Readable):
|
||||
|
||||
def write_digits(self, value):
|
||||
# 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
|
||||
# recalculate proper scale and offset
|
||||
self.write_scale_factor(self.scale_factor)
|
||||
@ -103,11 +103,11 @@ class DPM3(HasIO, Readable):
|
||||
return Done
|
||||
|
||||
def read_digits(self):
|
||||
back_value = self._iodev.communicate('*1G135')
|
||||
back_value = self.communicate('*1G135')
|
||||
return int(back_value,16) - 1
|
||||
|
||||
def read_value(self):
|
||||
return float(self._iodev.communicate('*1B1'))
|
||||
return float(self.communicate('*1B1'))
|
||||
|
||||
def read_offset(self):
|
||||
reply = self.query(self.OFFSET)
|
||||
|
Reference in New Issue
Block a user