diff --git a/src/components/tecna_marposs_provaset_t3.py b/src/components/tecna_marposs_provaset_t3.py index ed0eda5..1decbae 100644 --- a/src/components/tecna_marposs_provaset_t3.py +++ b/src/components/tecna_marposs_provaset_t3.py @@ -272,9 +272,9 @@ class TecnaMarpossProvasetT3(ModbusComponent): recipe_barcode = f"j{recipe.part_number}"[:16].encode("ascii") recipe_barcode += b"\x00" * (24 - len(recipe_barcode)) test_flags = 0b0110100001010100 if (step.spec.get("autotest", False) in ["ko_check"]) else 0b0110000001010100 - pid_mode = int(step.spec["pid_mode"])<<4 + pid_mode = int(step.spec.get("pid_mode",self.config["recipes_defaults"]["pid_mode"]))<<4 test_flags = test_flags | pid_mode - pid_ramps=0b0000000000000000 | int(step.spec.get("pid_level",1))<<8 | int(step.spec.get("pid_speed",1))<<12 + pid_ramps=0b0000000000000000 | int(step.spec.get("pid_level",self.config["recipes_defaults"]["pid_level"]))<<8 | int(step.spec.get("pid_speed",self.config["recipes_defaults"]["pid_speed"]))<<12 spec = { "Flag: Instrument settings": 0b0000000000000000, "Test program for read/write operation": table, @@ -299,7 +299,8 @@ class TecnaMarpossProvasetT3(ModbusComponent): "FSL - Discharge limit": step.spec["flush_pressure"], "PSQ - Next sequence program PSOUT mode": 0, "RAMPS: T1 configuration": pid_ramps, - "PID: pressure correction": 100 + "PID: pressure correction": 100, + "Various flags": 0b0000000000000000 } if self.model == "t3p": diff --git a/src/components/tecna_marposs_provaset_t3l_registers.py b/src/components/tecna_marposs_provaset_t3l_registers.py index f52b469..93ac2e1 100644 --- a/src/components/tecna_marposs_provaset_t3l_registers.py +++ b/src/components/tecna_marposs_provaset_t3l_registers.py @@ -336,5 +336,6 @@ registers = { # | 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0 | # | Step % T1 | T1 Steps | "PSQ - Next sequence program PSOUT mode": [754 - 1, {"dt": "16bit_uint", }], - "RAMPS: T1 configuration": [755-1, {"dt": "16bit_uint", }] + "RAMPS: T1 configuration": [755-1, {"dt": "16bit_uint", }], + "Various flags": [758-1, {"dt": "16bit_uint", }] } diff --git a/src/components/tecna_marposs_provaset_t3p_registers.py b/src/components/tecna_marposs_provaset_t3p_registers.py index f84dd2c..6714b7e 100644 --- a/src/components/tecna_marposs_provaset_t3p_registers.py +++ b/src/components/tecna_marposs_provaset_t3p_registers.py @@ -297,7 +297,7 @@ registers = { # | 15 14 13 12 11 10 9 8 | 7 6 5 4 | 3 2 1 0 | # | PSQ | | PSOUT | # PSOUT MODE: 0 = While test run 1 = After start delay 2 = Always 3 = Only during start delay - + "Various flags": [758 - 1, {"dt": "16bit_uint", }] # 1001-1060 Table of the last test performed X The order of the parameters is always the same, as indicated for register from 701 to 759. # 10001-10060 Direct access to test program table number 1 X X The order of the parameters is always the same, as indicated for register from 701 to 759. diff --git a/src/ui/test/test.py b/src/ui/test/test.py index d8db481..7c459c6 100755 --- a/src/ui/test/test.py +++ b/src/ui/test/test.py @@ -302,6 +302,8 @@ class Test(Widget): self.data["recipe"] = model_to_dict(self.recipe) w = self.cycle_available_steps[self.step.type] show = None + if self.step.type=="leak_2": + self.setCentralWidget(w) # NEED TO PRESHOW UI if hasattr(w, "start"): show = w.start(recipe=self.recipe, step=self.step, pieces=self.pieces) if show is not False and w is not current_w: diff --git a/src/ui/test_leak/test_leak.py b/src/ui/test_leak/test_leak.py index 6e46634..00a9b64 100644 --- a/src/ui/test_leak/test_leak.py +++ b/src/ui/test_leak/test_leak.py @@ -8,10 +8,13 @@ from ui import Dialog from ui.test_instructions_reminder import Test_Instructions_Reminder from ui.test_test import Test_Test +VALVE_TIME=0.5 + class Test_Leak(Test_Test): def __init__(self, components=None, recipe=None, step=None, pieces=None, run_once=False, reset_on_start=True, enable_override=False,parent=None): super().__init__(components=components, recipe=recipe, step=step, pieces=pieces, run_once=run_once, reset_on_start=reset_on_start, enable_override=enable_override) self.io_ok = True + self.blow_on = False self.parent=parent self.step=step self.start_b.clicked.connect(self.start_test) @@ -35,6 +38,7 @@ class Test_Leak(Test_Test): chan_sel = self.step.spec["chan_sel"] # 0=CH1, 1=CH2 self.set_digital_out("out_channel_select", chan_sel) self.set_digital_out("in_channel_select", chan_sel) + time.sleep(VALVE_TIME) # SET LED INDICATORS if chan_sel == 0: @@ -43,6 +47,7 @@ class Test_Leak(Test_Test): self.set_digital_out("ch2_led", True) if self.parent.config["hardware_config"].get("external_flush_blow",None)=="present": + self.blow_on=True self.display_text("SOFFIAGGIO IN CORSO...") self.set_digital_out("blow_led",True) self.set_digital_out("blow_on",True) @@ -54,6 +59,8 @@ class Test_Leak(Test_Test): self.set_digital_out("blow_on", False) self.set_digital_out("flush_on", False) + + self.blow_on = False self.components["tecna_t3"].start_test() def start(self, recipe=None, step=None, pieces=None): @@ -83,10 +90,22 @@ class Test_Leak(Test_Test): self.get_connection = self.components["tecna_t3"].out.connect(self.get) self.components["tecna_t3"].resume() if self.parent_assembly_widget is not None: - self.parent_assembly_widget().set_text(text="WAIT") + self.display_text(text="ATTENDERE") self.start_b.setEnabled(False) self.stop_b.setEnabled(False) + if self.step.spec.get("autotest", False) == "ok_check": + self.display_text(text="AUTOTEST: RIMUOVERE FUGA CALIBRATA E PREMERE START PER INIZIARE LA PROVA TENUTA", + bg_color="blue", text_color="white") + elif self.step.spec.get("autotest", False) == "ko_check": + 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") + else: + self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA") + if self.simulate: + QApplication.processEvents() + time.sleep(2) time.sleep(1) # AUTO START SECOND TEST @@ -102,8 +121,8 @@ class Test_Leak(Test_Test): self.components["tecna_t3"].pause() self.disconnect(self.get_connection) super().stop() - if self.parent_assembly_widget is not None: - self.parent_assembly_widget().set_text(text="WAIT") + #if self.parent_assembly_widget is not None: + # self.parent_assembly_widget().set_text(text="WAIT") self.start_b.setEnabled(False) self.stop_b.setEnabled(False) @@ -139,19 +158,21 @@ class Test_Leak(Test_Test): # SET DIGITAL OUTPUTS if self.parent.config["hardware_config"].get("external_flush_blow", None) == "present": + self.blow_on = True self.display_text("SCARICO ESTERNO IN CORSO...") self.set_digital_out("flush_led", True) self.set_digital_out("flush_on", True) + time.sleep(VALVE_TIME) flush_time = int(self.step.spec['ext_flush_time']) time.sleep(flush_time) self.set_digital_out("flush_led", False) - self.set_digital_out("flush_on", False) + #self.set_digital_out("flush_on", False) + if self.parent.config["hardware_config"].get("dual_channel", None) == "present": self.set_digital_out("out_channel_select", False) self.set_digital_out("in_channel_select", False) self.set_digital_out("ch1_led", False) self.set_digital_out("ch2_led", False) - else: #result = None ok = None @@ -192,15 +213,6 @@ class Test_Leak(Test_Test): "END TEST, WAITING THE START OF A NEW TEST" "FINE TEST", }: - if self.step.spec.get("autotest", False) == "ok_check": - self.display_text(text="AUTOTEST: RIMUOVERE FUGA CALIBRATA E PREMERE START PER INIZIARE LA PROVA TENUTA",bg_color="blue",text_color="white") - elif self.step.spec.get("autotest", False) == "ko_check": - 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") - else: - self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA") - if self.simulate: - QApplication.processEvents() - time.sleep(2) self.start_b.setEnabled(True) self.start_b.setDefault(True) @@ -208,7 +220,7 @@ class Test_Leak(Test_Test): self.stop_b.setEnabled(False) else: - if self.step is not None: + if self.step is not None and not self.blow_on: if self.step.spec.get("autotest", False) is not True: self.display_text(text="PROVA TENUTA IN CORSO") else: @@ -222,6 +234,8 @@ class Test_Leak(Test_Test): if self.parent_assembly_widget is not None: self.parent_assembly_widget().set_text(text=text, bg_color=bg_color,text_color=text_color) QApplication.processEvents() + time.sleep(0.3) + QApplication.processEvents() def set_digital_out(self,name=None,state=1): if self.io_ok: bit=int(self.parent.config["digital_io"][name])