ACM1219: add checkHWIdent
waiting 0.5 sec before the first communication helps to start properly + added usb dev names for box
This commit is contained in:
parent
476d2087f6
commit
21dae2d9ce
@ -8,7 +8,7 @@ Node('UC220T.psi.ch',
|
||||
Mod('io1',
|
||||
'frappy_psi.RP100.RP100IO',
|
||||
'communication',
|
||||
uri='serial:///dev/tty.usbmodem1401?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
||||
uri='serial:///dev/ttyACM0?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
||||
Mod('V1',
|
||||
'frappy_psi.RP100.VoltageChannel',
|
||||
'Voltage Channel 1',
|
||||
@ -33,7 +33,7 @@ Mod('V2',
|
||||
Mod('io2',
|
||||
'frappy_psi.ACM1219.ACM1219IO',
|
||||
'communication',
|
||||
uri='serial:///dev/tty.usbserial-A904TGR7?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
||||
uri='serial:///dev/ttyUSB0?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
||||
Mod('C1C2',
|
||||
'frappy_psi.ACM1219.BothChannels',
|
||||
'Capacitance channels 1 and 2',
|
||||
@ -81,4 +81,4 @@ Mod('T',
|
||||
'frappy_psi.dummy.Temp',
|
||||
'dummy T written from client',
|
||||
target=Param(min=1, max=325),
|
||||
)
|
||||
)
|
||||
|
@ -17,6 +17,7 @@
|
||||
# Paul M. Neves <pmneves@mit.edu>
|
||||
# *****************************************************************************
|
||||
|
||||
import time
|
||||
from frappy.core import Readable, Parameter, FloatRange, HasIO, StringIO, Property, IntRange,\
|
||||
IDLE, BUSY, WARN, ERROR, Drivable, BoolType, Attached, StructOf
|
||||
|
||||
@ -24,7 +25,18 @@ from frappy.core import Readable, Parameter, FloatRange, HasIO, StringIO, Proper
|
||||
class ACM1219IO(StringIO):
|
||||
"""communication with ACM1219"""
|
||||
end_of_line = ('\r\n', '\r') # ('\n', '\r') ('\r\n', '\r')
|
||||
identification = [('*IDN?', r'.*')]
|
||||
encoding = 'latin-1' # initial reply might not be ascii for a strange reason
|
||||
identification = [('*IDN?', r'.*,ACM1219,.*')]
|
||||
|
||||
def checkHWIdent(self):
|
||||
for _ in range(3):
|
||||
time.sleep(0.5)
|
||||
try:
|
||||
self.communicate('*IDN?')
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
super().checkHWIdent()
|
||||
|
||||
|
||||
class BothChannels(HasIO, Readable):
|
||||
@ -188,4 +200,4 @@ class YoungsModulus(Readable):
|
||||
|
||||
def read_value(self):
|
||||
return self.stress.value / self.strain.value
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user