frappy_psi.ahcapbridge: fix loss unit mechanism
Change-Id: Iba4ca4988146a71a01dcc6dbe911be5588bfe292
This commit is contained in:
@@ -52,7 +52,7 @@ class IO(StringIO):
|
||||
timeout = 5
|
||||
sent_command = False # used to detect that communicate was called directly
|
||||
ECHO = re.compile('>|AV |VO |FR |SI |SH ') # this is recognized as an echo
|
||||
MEAS = re.compile(' *([FC]=|NO DATA)') # overriden by the module
|
||||
MEAS = None # overriden by the module
|
||||
|
||||
@Command(StringType(), result=StringType())
|
||||
def communicate(self, command, noreply=False):
|
||||
@@ -63,7 +63,7 @@ class IO(StringIO):
|
||||
reply = super().communicate(command, noreply)
|
||||
reply = reply and reply.strip()
|
||||
if self.check_echo_off(reply):
|
||||
return reply
|
||||
return reply
|
||||
raise CommunicationFailedError('detected echo but can not switch off')
|
||||
|
||||
def check_echo_off(self, reply):
|
||||
@@ -74,6 +74,8 @@ class IO(StringIO):
|
||||
if self.MEAS.match(reply or ''):
|
||||
# this is a meas reply
|
||||
break
|
||||
if reply == 'NO DATA FOUND':
|
||||
break
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -158,7 +160,13 @@ class AHBase(HasIO, Pinata, Acquisition):
|
||||
reply = self.communicate('UN 2')
|
||||
# this should be a measurement reply
|
||||
mdict = self.get_meas_reply(reply)
|
||||
self._lossunit = mdict.get('lossunit', 'undefined')
|
||||
unit = mdict.get('lossunit', 'undefined')
|
||||
if unit == self.UNIT:
|
||||
if self._lossunit != self.UNIT:
|
||||
self.log.warn('changed loss unit from %r to %r', self._lossunit, self.UNIT)
|
||||
else:
|
||||
self.log.warn('bad reply for UN 2: %r', reply)
|
||||
self._lossunit = unit
|
||||
|
||||
def change_param(self, short, value, param):
|
||||
if self._mode == RUNNING:
|
||||
|
||||
Reference in New Issue
Block a user