frappy_psi/SR.py: move soft auto range from read_value to doPoll
Change-Id: Ia94e081eaa4c28b1f436227635d7c5beb883792b
This commit is contained in:
parent
82e9b599ad
commit
1e56f2f39e
@ -58,6 +58,14 @@ class XY(HasIO, Readable):
|
|||||||
|
|
||||||
ioClass = SR_IO
|
ioClass = SR_IO
|
||||||
|
|
||||||
|
def doPoll(self):
|
||||||
|
super().doPoll()
|
||||||
|
if self.autorange == 1: # soft auto range
|
||||||
|
if max(abs(x), abs(y)) >= 0.9 * self.range and self.irange < 27:
|
||||||
|
self.write_irange(self.irange + 1)
|
||||||
|
elif max(abs(x), abs(y)) <= 0.3 * self.range and self.irange > 1:
|
||||||
|
self.write_irange(self.irange - 1)
|
||||||
|
|
||||||
def comm(self, cmd):
|
def comm(self, cmd):
|
||||||
reply, status, overload = self.communicate(cmd).split(';') # try/except
|
reply, status, overload = self.communicate(cmd).split(';') # try/except
|
||||||
reply = reply.rstrip('\n')
|
reply = reply.rstrip('\n')
|
||||||
@ -85,11 +93,6 @@ class XY(HasIO, Readable):
|
|||||||
reply = self.comm('XY.').split(',')
|
reply = self.comm('XY.').split(',')
|
||||||
x = float(reply[0])
|
x = float(reply[0])
|
||||||
y = float(reply[1])
|
y = float(reply[1])
|
||||||
if self.autorange == 1: # soft
|
|
||||||
if max(abs(x), abs(y)) >= 0.9 * self.range and self.irange < 27:
|
|
||||||
self.write_irange(self.irange + 1)
|
|
||||||
elif max(abs(x), abs(y)) <= 0.3 * self.range and self.irange > 1:
|
|
||||||
self.write_irange(self.irange - 1)
|
|
||||||
return x, y
|
return x, y
|
||||||
|
|
||||||
def read_freq(self):
|
def read_freq(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user