Merge remote-tracking branch 'origin/st-ten-2' into st-ten-2
This commit is contained in:
commit
c93a826b49
@ -9,4 +9,4 @@ tecna_t3: present
|
||||
port: COM5
|
||||
|
||||
[multicomp]
|
||||
port: COM4
|
||||
port: COM8
|
||||
|
||||
@ -10,7 +10,7 @@ from .component import Component
|
||||
|
||||
|
||||
class Multicomp730424(Component):
|
||||
def __init__(self, config=None, name=None, period=1, lazy=True, paused=False, threaded=True):
|
||||
def __init__(self, config=None, name=None, period=1/4, lazy=True, paused=False, threaded=True):
|
||||
self.conn = None
|
||||
super().__init__(config=config, name=name, period=period, lazy=lazy, paused=paused, threaded=threaded)
|
||||
|
||||
@ -29,9 +29,15 @@ class Multicomp730424(Component):
|
||||
parity=self.parity,
|
||||
bytesize=self.bytesize,
|
||||
)
|
||||
self.write("FUNC1 \"RES\"")
|
||||
self.write("RATE L")
|
||||
self.write("AUTO 1")
|
||||
|
||||
def set_resistance_scale(self, resistance):
|
||||
self.write(f"CONF:RES {resistance}")
|
||||
def set_resistance_scale(self, resistance=None):
|
||||
if resistance is None:
|
||||
self.write("AUTO 1")
|
||||
else:
|
||||
self.write(f"CONF:RES {resistance}")
|
||||
|
||||
def read(self):
|
||||
try:
|
||||
@ -40,7 +46,7 @@ class Multicomp730424(Component):
|
||||
self.log.exception(traceback.format_exc())
|
||||
return None
|
||||
try:
|
||||
decoded = response.decode("ascii")
|
||||
decoded = response.decode("ascii", errors="ignore").strip()
|
||||
except UnicodeDecodeError:
|
||||
return response
|
||||
try:
|
||||
@ -59,8 +65,9 @@ class Multicomp730424(Component):
|
||||
info = {}
|
||||
try:
|
||||
for value_name, command in {
|
||||
"scale": "CONF:RES?",
|
||||
"measure": "MEAS?",
|
||||
"function": "FUNC1?",
|
||||
"scale": "RANGE?",
|
||||
"measure": "MEAS1?",
|
||||
}.items():
|
||||
self.write(command)
|
||||
info[value_name] = self.read()
|
||||
|
||||
@ -3,7 +3,7 @@ import time
|
||||
import serial
|
||||
|
||||
# tester_port="/dev/ttyUSB0"
|
||||
tester_port = "COM1"
|
||||
tester_port = "COM8"
|
||||
|
||||
conn = serial.Serial(
|
||||
tester_port,
|
||||
@ -16,18 +16,28 @@ conn = serial.Serial(
|
||||
|
||||
cmd_list = [
|
||||
["*IDN?\n", True], # QUERY ID
|
||||
["CONF:RES 500\n", False], # SET RESISTANCE MEASURE, 500 Ohm range
|
||||
["MEAS?\n", True], # GET MEASURE
|
||||
["MEAS?\n", True], # GET MEASURE
|
||||
["FUNC1 \"RES\"\n", False], # QUERY ID
|
||||
["FUNC1?\n", True], # QUERY ID
|
||||
["FUNC2 \"FRES\"\n", False], # QUERY ID
|
||||
["FUNC2?\n", True], # QUERY ID
|
||||
["RATE L\n", True], # QUERY ID
|
||||
["RATE?\n", True], # QUERY ID
|
||||
["AUTO 1\n", False], # SET RESISTANCE MEASURE, 500 Ohm range
|
||||
["AUTO?\n", True], # SET RESISTANCE MEASURE, 500 Ohm range
|
||||
# ["CONF:RES 500\n", False], # SET RESISTANCE MEASURE, 500 Ohm range
|
||||
# ["AUTO?\n", True], # SET RESISTANCE MEASURE, 500 Ohm range
|
||||
["RANGE:RES?\n", True], # SET RESISTANCE MEASURE, 500 Ohm range
|
||||
["MEAS?\n", True], # GET MEASURE
|
||||
["MEAS1?\n", True], # GET MEASURE
|
||||
["MEAS2?\n", True], # GET MEASURE
|
||||
]
|
||||
|
||||
for [cmd, expect_response] in cmd_list:
|
||||
conn.write(bytes(cmd, encoding="ascii"))
|
||||
if expect_response:
|
||||
response = conn.readline()
|
||||
print(f"{cmd} RESPONSE: " + response.decode("ascii"))
|
||||
print(f"{cmd} RESPONSE: " + response.decode("ascii", errors="backslashreplace"))
|
||||
else:
|
||||
print(f"{cmd}")
|
||||
time.sleep(1)
|
||||
# time.sleep(1)
|
||||
conn.close()
|
||||
|
||||
@ -2,6 +2,10 @@ from ui.test_test import Test_Test
|
||||
|
||||
|
||||
class Test_Resistance(Test_Test):
|
||||
def __init__(self, components=None, recipe=None, step=None, run_once=False):
|
||||
super().__init__(components=components, recipe=recipe, step=step, run_once=run_once)
|
||||
self.ok_counter_limit = 4
|
||||
|
||||
def start(self, recipe=None, step=None):
|
||||
super().start(recipe=recipe, step=step)
|
||||
if self.run_once is True and self.done is True and self.done_ok is True:
|
||||
|
||||
@ -11,6 +11,7 @@ class Test_Vision(Test_Test):
|
||||
request_frame = pyqtSignal()
|
||||
|
||||
def __init__(self, components=None, recipe=None, step=None, run_once=False):
|
||||
super().__init__(components=components, recipe=recipe, step=step, run_once=run_once)
|
||||
if "--sim-camera" not in sys.argv:
|
||||
self.ok_counter_limit = 2
|
||||
else:
|
||||
@ -21,7 +22,6 @@ class Test_Vision(Test_Test):
|
||||
"expected": "ATTESO",
|
||||
"score": "PUNTEGGIO",
|
||||
}
|
||||
super().__init__(components=components, recipe=recipe, step=step, run_once=run_once)
|
||||
self.results_tw.setColumnCount(len(self.results_table_headers))
|
||||
self.results_tw.setHorizontalHeaderLabels(self.results_table_headers.values())
|
||||
self.results_tw.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user