fixes to make pylint happy

Change-Id: I95baf4e585603a640d4ec71076a4d509082775ed
This commit is contained in:
2022-06-14 15:24:27 +02:00
parent 778ac17172
commit 5951312d40
5 changed files with 27 additions and 18 deletions

View File

@ -21,8 +21,7 @@
"""oxford instruments triton (kelvinoxjt dil)"""
from math import sqrt
from secop.core import Writable, Parameter, Readable, Drivable, IDLE, WARN, BUSY, Done
from secop.errors import HardwareError
from secop.core import Writable, Parameter, Readable, Drivable, IDLE, WARN, BUSY, ERROR, Done
from secop.datatypes import EnumType, FloatRange
from secop.lib.enum import Enum
from secop_psi.mercury import MercuryChannel, Mapped, off_on, HasInput, SELF
@ -62,7 +61,7 @@ class Action(MercuryChannel, Writable):
# PCOND (pause pre-cool (not condense?) automation)
# RCOND (resume pre-cool (not condense?) automation)
# WARM (warm-up)
# EPCL (empty pre-coll automation)
# EPCL (empty pre-cool automation)
class Valve(MercuryChannel, Drivable):
@ -76,7 +75,19 @@ class Valve(MercuryChannel, Drivable):
self.read_status()
def read_value(self):
return self.query('VALV:SIG:STATE', open_close)
pos = self.query('VALV:SIG:STATE', open_close)
if pos == self.target:
self.status = IDLE, ''
self._try_count = 0
self.setFastPoll(False)
elif self._try_count <= 7: # odd number: last try is previous position
# toggle new/previous position until success or too many tries
self.change('VALV:SIG:STATE', pos if self._try_count % 2 else self.target, open_close)
self._try_count += 1
self.status = BUSY, 'opening' if self.target else 'closing'
else:
self.status = ERROR, 'can not %s valve' % self.target.name
return pos
def read_status(self):
pos = self.read_value()