This commit is contained in:
stres1 2022-07-28 12:27:54 +02:00
parent 18f260bed3
commit 3c2d6f3775
15 changed files with 533 additions and 535 deletions

View File

@ -43,7 +43,7 @@ port: COM1
baudrate: 9600
[vision]
detection_threshold: 0.5
detection_threshold: 0.75
neural_network: hs3-20000
; recipes_path: ./config/vision_test_recipes

View File

@ -2,3 +2,4 @@
this: this
mino: mino
DESKTOP-VOCOB38: vm
ST-RES-1: stres1

View File

@ -0,0 +1,8 @@
[tecna_t3]
port: COM5
[neo_pixels]
port: COM4
baudrate: 9600

View File

@ -1,7 +1,7 @@
item {
id: 1
name: 'hs-ok'
color: '0x000000'
color: '0x55AA55'
}
item {
id: 2

2
designer_win.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
venv/Lib/site-packages/qt5_applications/Qt/bin/designer

View File

@ -1,4 +0,0 @@
#!/bin/bash -e
cd "$(dirname "$0")"
source "./venv/Scripts/activate" || source "./venv/bin/activate"
python -O "./src/lib/charts/MultiAxisExample.py"

View File

@ -1,4 +0,0 @@
#!/bin/bash -e
cd "$(dirname "$0")"
source "./venv/Scripts/activate" || source "./venv/bin/activate"
python -O "./src/lifecycle.py"

View File

@ -1,4 +1,5 @@
import sys
import time
import traceback
if "--sim-serial" in sys.argv:
@ -16,6 +17,13 @@ C_UINT32_MAX = c_uint32(-1).value
class NeoPixels(Component):
def __init__(self, config=None, name=None):
super().__init__(config=config, name=name, threaded=False)
self.conn = serial.Serial(
self.port,
baudrate=self.baudrate,
stopbits=self.stopbits,
parity=self.parity,
bytesize=self.bytesize,
)
def config_changed(self):
self.port = self.config[self.name]["port"]
@ -30,18 +38,11 @@ class NeoPixels(Component):
if not color.startswith("#") or len(color) != 7:
raise ValueError("the color parameter must be in the html hex format: '#RRGGBB'")
try:
conn = serial.Serial(
self.port,
baudrate=self.baudrate,
stopbits=self.stopbits,
parity=self.parity,
bytesize=self.bytesize,
)
conn.write(int.to_bytes(pixel, length=4, byteorder="big") + bytes.fromhex(color[1:7]) + b"\n")
response = conn.readline()
self.conn.write(int.to_bytes(pixel, length=4, byteorder="big") + bytes.fromhex(color[1:7]) + b"\n")
response = self.conn.readline()
if response != "ok\n":
self.log.error(response.strip())
conn.close()
# conn.close()
except serial.serialutil.SerialException:
self.log.exception(traceback.format_exc())

View File

@ -180,7 +180,7 @@ class TecnaMarpossProvasetT3P(ModbusComponent):
"Running test: test type",
"Running test: sequence index",
]}
if info["Running test: active phase"] == "END TEST, WAITING THE START OF A NEW TEST":
if info["Running test: active phase"] == "FINE TEST":
info.update(self.get_test_results())
self.log.debug(str(info))
super()._get([info])

View File

@ -7,7 +7,7 @@ registers = {
"Life counter: TOTAL TESTS": [8 - 1, {"dt": "32bit_uint", }],
"Real time test pressure output": [11 - 1, {"dt": "32bit_int", "f": 21, }],
"Real time differential pressure output": [13 - 1, {"dt": "32bit_int", "f": 22, }],
"Real time pressure line regulator": [15 - 1, {"dt": "16bit_int", "f": 23, }],
"Real time pressure line regulator": [15 - 1, {"dt": "16bit_int", "f": 23,"g":0.1 }],
"Active alarm flags": [16 - 1, {"dt": "16bit_uint", }],
# | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
# | | | | A5 | A4 | A3 | A2 | A1 | | | | | | E3 | E2 | E1 |
@ -28,9 +28,9 @@ registers = {
"Running test: flow rate format": [27 - 1, {"dt": "16bit_uint", }], # white
"Active test program number": [31 - 1, {"dt": "16bit_uint", }],
"Running test: active phase": [32 - 1, {"dt": "16bit_uint", "decoding": {
0: "WAITING START",
10: "CHECK BARCODE",
20: "WAITING BARCODE",
0: "ATTESA START",
10: "CONTROLLO BARCODE",
20: "ATTESA BARCODE",
30: "START TEST",
40: "START CAGE",
50: "START PLUG",
@ -38,10 +38,10 @@ registers = {
70: "WAIT DELAY ACKNOWLEDGE COMMAND",
80: "WAIT DELAY",
90: "WAIT ACKNOWLEDGE",
100: "T0 PRE-FILL",
110: "T1 FILLING",
120: "T2 SETTLING",
130: "T3 MEASURE",
100: "T0 PRE-RIEMPIMENTO",
110: "T1 RIEMPIMENTO",
120: "T2 ASSESTAMENTO",
130: "T3 MISURA",
140: "WAITING OPERATOR RESULT ACKNOWLEDGE",
150: "RESULT PRESENT",
160: "MARKING",
@ -49,7 +49,7 @@ registers = {
180: "END SEQUENCE PROGRAM",
190: "END PLUG",
200: "END CAGE",
210: "END TEST, WAITING THE START OF A NEW TEST",
210: "FINE TEST",
}, }],
"Running test: phase backwards time": [33 - 1, {"dt": "16bit_uint", "f": 26, }],
"Running test: filling pressure": [34 - 1, {"dt": "32bit_int", "f": 21, }],

View File

@ -381,9 +381,9 @@ class Vision(Component):
if lock:
self.lock.unlock()
detections = {
"detection_scores": [scores],
"detection_boxes": [boxes],
"detection_classes": [map(lambda class_id: class_id + 1, class_ids)],
"detection_scores": [scores][0:1],
"detection_boxes": [boxes][0:1],
"detection_classes": [map(lambda class_id: class_id + 1, class_ids)][0:1],
}
else:
detections = self.model(tensor)

View File

@ -2,8 +2,11 @@ import time
import serial
#tester_port="/dev/ttyUSB0"
tester_port="COM1"
conn = serial.Serial(
"/dev/ttyUSB0",
tester_port,
baudrate=115200,
stopbits=serial.STOPBITS_ONE,
parity=serial.PARITY_NONE,

View File

@ -4,11 +4,13 @@ import serial
C_UINT32_MAX = c_uint32(-1).value
conn = serial.Serial(
"/dev/ttyACM1",
"COM4",
baudrate=9600,
stopbits=serial.STOPBITS_ONE,
parity=serial.PARITY_NONE,
bytesize=serial.EIGHTBITS,
rtscts=False,
xonxoff=False
)
pixel = C_UINT32_MAX
color = "#ff00ff"

View File

@ -44,7 +44,7 @@ class Test(Widget):
"done": Test_Assembly(self.select_step_img("success"), u"COLLAUDO COMPLETATO"),
"emergency": Test_Assembly(self.select_step_img("reset_emergency"), u"EMERGENZA INTERVENUTA - RIPRISTINARE PULSANTE E SELEZIONARE \"RESET EMERGENZA\" DAL MEN\u00d9 \"STRUMENTI\""),
"fail": Test_Assembly(self.select_step_img("fail"), u"CICLO INTERROTTO"),
"leak": Test_Assembly(None, u"PREMERE START PER COMINCIARE LA PROVA TENUTA E ATTENDERE IL SUO COMPLETAMENTO", Test_Leak(components=self.components, recipe=self.recipe, step=self.step)),
"leak": Test_Assembly(None, u"PREMERE START PER INIZIARE LA PROVA TENUTA", Test_Leak(components=self.components, recipe=self.recipe, step=self.step)),
"print": Test_Assembly(self.select_step_img("print"), u"STAMPA ETICHETTA IN CORSO"),
"select_recipe": Test_Assembly(None, u"SELEZIONARE IL CODICE DA COLLAUDARE", Recipe_Selection()),
"vision": Test_Assembly(None, u"VERIFICARE CONTROLLO CON TELECAMERA", Test_Vision(components=self.components, recipe=self.recipe, step=self.step)),
@ -279,11 +279,13 @@ class Test(Widget):
def print(self, archived=None):
self.log.info("cycle print")
# LABEL PRINT
datamatrix= archived.recipe.part_number+ archived.time.strftime("%m%y")+f"{archived.id:0>5}"
dt_label=archived.time.strftime("%d/%m/%Y %H:%M:%S")
context = {
"DATAMATRIX": str(self.data.get("barcodes", {}).get("serial", "")),
"DATAMATRIX_TEXT": str(self.data.get("barcodes", {}).get("serial", "-")),
"PIECE_NUM": str(self.data.get("barcodes", {}).get("serial", "-")),
"DATETIME": str(archived.time.isoformat()),
"DATAMATRIX": datamatrix,
"DATAMATRIX_TEXT": datamatrix,
"PIECE_NUM": str(archived.id),
"DATETIME": dt_label,
"SHIFT": str(get_shift(archived.time)),
"STATION": str(self.machine_id),
"OPERATOR": str(Users.get_session().user.username),

File diff suppressed because it is too large Load Diff