This commit is contained in:
edo-neo 2025-05-08 09:14:21 +02:00
parent f8e5f5d454
commit 44010dba02
3 changed files with 40 additions and 11 deletions

View File

@ -26,11 +26,11 @@ poll_time: 10
hold_time: 10
[tecna_t3]
port: /dev/ttyUSB1
model: t3l
port: /dev/ttyUSB0
model: t3p
[fixture_rfid]
port: USB0
port: USB1
[digital_io]
# OUTPUT MAP FOR VALVE CONTROL UNITS
@ -46,6 +46,7 @@ description_field: descrizione
[label_printer]
platform: linux
printer: Zebra_Technologies_ZTC_ZD421-203dpi_ZPL
risoluzione: 203
[recipes_defaults]
tester_discharge_enable: yes

View File

@ -122,7 +122,10 @@ class TecnaMarpossProvasetT3(ModbusComponent):
if formatting is not None:
# units = self.units[formatting]
# data = [data * units[0], units[1]]
data = data * self.units[formatting][0]
if data is not None:
data = data * self.units[formatting][0]
else:
return None
return data
def _convert_to_format(self, data, formatting=None, encoding_map=None):
@ -176,7 +179,7 @@ class TecnaMarpossProvasetT3(ModbusComponent):
self.tecna_error_signal.emit(True, error_message)
raise # Re-raise the exception for further upstream handling if needed
@Component.reconfig_on_error
# @Component.reconfig_on_error
@Component.reconfig_on_error
def write(self, register, data, *args, data_type=None, gain=None, offset=None, formatting=None, encoding_map=None,
**kwargs):
@ -302,8 +305,16 @@ class TecnaMarpossProvasetT3(ModbusComponent):
recipe_barcode = f"j{recipe.part_number}"[:16].encode("ascii")
recipe_barcode += b"\x00" * (24 - len(recipe_barcode))
test_flags = 0b0110100001010000 if (step.spec.get("autotest", False) in ["ko_check"]) else 0b0110000001010000
pid_mode = int(self.config["recipes_defaults"]["pid_mode"])<<4
test_flags = test_flags | pid_mode
pid_mode_text = step.spec.get("pid_mod_config","AUTO") # Get the selected text from the combobox
pid_mode_value = { # Mapping of text to numeric values
"AUTO": 5,
"FAST": 0,
"MEDIUM": 1,
"SLOW": 2,
}.get(pid_mode_text, 5)
test_flags = (test_flags & ~(7 << 4)) | (pid_mode_value << 4)
pid_ramps=0b0000000000000000 | int(self.config["recipes_defaults"]["pid_level"])<<8 | int(self.config["recipes_defaults"]["pid_speed"])<<12
spec = {
"Flag: Instrument settings": 0b0000000000000000,
@ -330,7 +341,7 @@ class TecnaMarpossProvasetT3(ModbusComponent):
"PSQ - Next sequence program PSOUT mode": 0,
"RAMPS: T1 configuration": pid_ramps,
"PID: pressure correction": step.spec.get("pid_pressure_correction",0),
"Various flags": 0b0000000000010000 if self.config["recipes_defaults"]["tester_discharge_enable"] == "yes" else 0b0000000000000000
"Various flags": 0b0000000000010000 if self.config["recipes_defaults"]["tester_discharge_enable"] in ("yes", "x") else 0b0000000000000000
}
if self.model == "t3p":
@ -489,3 +500,7 @@ class TecnaMarpossProvasetT3(ModbusComponent):
#self.tecna_error_signal.emit(True, error_message)
self.log.error(f"Modbus error encountered: {error_message}")
return True, error_message
else:
# Emit no error (False)
self.tecna_error_signal.emit(False, "")
return False, None

View File

@ -26,7 +26,7 @@ class Test_Leak(Test_Test):
self.show_instruction_b.setVisible("show_instructions" in self.parent.config["hardware_config"].keys())
self.show_instruction_b.clicked.connect(self.show_instruction)
self.components[self.tester_component].tecna_error_signal.connect(self.handle_modbus_error)
#self.components[self.tester_component].tecna_error_signal.connect(self.handle_modbus_error)
def show_instruction(self):
dialog=Dialog()
@ -91,6 +91,10 @@ class Test_Leak(Test_Test):
self.simulate = True
else:
self.simulate = False
if "--autostart" in sys.argv:
self.start_b.setEnabled(True)
self.start_b.click()
# /TESTING
show = super().start(recipe=recipe, step=step, pieces=pieces)
if show is False:
@ -103,13 +107,17 @@ class Test_Leak(Test_Test):
self.test_num_l.setText("2/2")
else:
self.test_num_l.setText("1/1")
if self.step.spec.get("autotest", False):
self.template_print_l.setText(f"AUTOTEST")
else:
self.template_print_l.setText(f"{self.parent.print_template}")
self.recipe_pressure_l.setText(f"{self.step.spec['test_pressure']}")
self.leak_min_l.setText(f"{self.step.spec['test_pressure_qneg']}")
self.leak_max_l.setText(f"{self.step.spec['test_pressure_qpos']}")
self.fill_time_l.setText(f"{self.step.spec['filling_time']}")
self.settle_time_l.setText(f"{self.step.spec['settling_time']}")
self.meas_time_l.setText(f"{self.step.spec['test_time']}")
self.valore_PID_l.setText(f"{self.step.spec.get('pid_pressure_correction','NA')}")
# SETUP TEST LOOP
if self.step.spec.get("autotest", False): # IF AUTOTESTING UPLOAD RECIPE EVERY TIME
@ -130,17 +138,22 @@ class Test_Leak(Test_Test):
self.stop_b.setEnabled(False)
if self.step.spec.get("autotest", False) == "ok_check":
self.template_print_l.setVisible(False)
self.template_label.setVisible(False)
self.display_text(text="AUTOTEST: RIMUOVERE FUGA CALIBRATA E PREMERE START PER INIZIARE LA PROVA TENUTA",
bg_color="blue", text_color="white")
super().visualize(None, img=self.status_imgs_full["calibrated-leak-remove"])
elif self.step.spec.get("autotest", False) == "ko_check":
self.template_print_l.setVisible(False)
self.template_label.setVisible(False)
self.display_text(
text="AUTOTEST: COLLEGARE TUBO-TUBO + FUGA CALIBRATA E PREMERE START PER INIZIARE LA PROVA TENUTA DI PROVA",
bg_color="blue", text_color="white")
super().visualize(None, img=self.status_imgs_full["calibrated-leak"])
else:
self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA")
self.template_print_l.setVisible(True)
self.template_label.setVisible(True)
if self.simulate:
QApplication.processEvents()
time.sleep(2)