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:
2024-07-03 14:09:13 +02:00
committed by Markus Zolliker
parent 476d2087f6
commit 21dae2d9ce
2 changed files with 17 additions and 5 deletions

View File

@ -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