From f0fb7a47d159dbdcf5332931b8bea7a7a5de70a0 Mon Sep 17 00:00:00 2001 From: edo-neo Date: Wed, 15 Oct 2025 09:44:50 +0200 Subject: [PATCH] ricette benedetti --- config/machine_settings/st-ten-11.ini | 1 + src/lib/helpers/recipe_manager.py | 41 ++++++++++++++++++ src/ui/recipe_selection/recipe_selection.py | 4 ++ .../recipe_spec_and_step_editor.py | 7 +++ .../recipe_spec_and_step_editor.ui | 43 +++++++++++++++++++ src/ui/steps_management/steps_management.py | 2 + src/ui/test/test.py | 13 ++++++ src/ui/test_leak/test_leak.py | 5 ++- 8 files changed, 115 insertions(+), 1 deletion(-) diff --git a/config/machine_settings/st-ten-11.ini b/config/machine_settings/st-ten-11.ini index 74ed7ca..ba990f1 100644 --- a/config/machine_settings/st-ten-11.ini +++ b/config/machine_settings/st-ten-11.ini @@ -5,6 +5,7 @@ image_for_warning= st-ten-11 [hardware_config] archive_synchronizer: present +free_fall: present archive_synchronizer_extra: present uvc_camera: absent label_printer: present diff --git a/src/lib/helpers/recipe_manager.py b/src/lib/helpers/recipe_manager.py index 9c34261..ac681a5 100644 --- a/src/lib/helpers/recipe_manager.py +++ b/src/lib/helpers/recipe_manager.py @@ -106,6 +106,44 @@ def read_steps(row, config, defaults=None, unsupported_steps=None): row.get("pid_pressure_correction", defaults["pid_pressure_correction"])), "pid_mod_config": safe_parse(row.get("pid_mod_config", defaults["pid_mod_config"])), }, + "test_freefall_leak": { + "pre_filling_time": safe_parse(row.get("tempo_pre_riempimento", defaults["tempo_pre_riempimento"])), + "pre_filling_pressure": safe_parse( + row.get("pressione_pre_riempimento", defaults["pressione_pre_riempimento"])) + , + "filling_time": safe_parse(row.get("tempo_riempimento", defaults["tempo_riempimento"])), + "settling_time": safe_parse(get_default_value(row, "tempo_assestamento")), + "settling_pressure_min_percent": safe_parse( + row.get("percentuale_minima_pressione_assestamento", + defaults["percentuale_minima_pressione_assestamento"])) + , + "settling_pressure_max_percent": safe_parse( + row.get("percentuale_massima_pressione_assestamento", + defaults["percentuale_massima_pressione_assestamento"])) + , + "test_time": safe_parse(row.get("tempo_di_test", defaults["tempo_di_test"])), + "test_pressure_qneg": safe_parse( + row.get("pressione_di_test_delta_minimo", defaults["pressione_di_test_delta_minimo"])) + , + "test_pressure": safe_parse(row.get("pressione_di_test", defaults["pressione_di_test"])), + "test_pressure_qpos": safe_parse( + row.get("pressione_di_test_delta_massimo", defaults["pressione_di_test_delta_massimo"])) + , + "flush_time": safe_parse(row.get("tempo_svuotamento", defaults["tempo_svuotamento"])), + "flush_pressure": safe_parse(row.get("pressione_svuotamento", defaults["pressione_svuotamento"])) + , + "chan_sel": safe_parse(row.get("canale_di_prova", defaults["canale_di_prova"])) + , + "ext_flush_time": safe_parse(row.get("tempo_svuotamento_esterno", defaults["tempo_svuotamento_esterno"])) + , + "ext_blow_time": safe_parse(row.get("tempo_soffiaggio_esterno", defaults["tempo_soffiaggio_esterno"])) + , + "pid_pressure_correction": safe_parse( + row.get("pid_pressure_correction", defaults["pid_pressure_correction"])) + , + "pid_mod_config": safe_parse(row.get("pid_mod_config", defaults["pid_mod_config"])) + , + }, "leak_2": { "pre_filling_time": safe_parse(row.get("tempo_pre_riempimento_2", defaults["tempo_pre_riempimento_2"])), "pre_filling_pressure": safe_parse( @@ -254,6 +292,9 @@ def import_recipes(config, csv_path=None, defaults=None, unsupported_steps=None, "vision": len( row.get("test_visione_abilitato", defaults["test_visione_abilitato"])) and "vision" not in ( unsupported_steps or []), + "test_freefall_leak": len( + row.get("prova_tenuta_abilitata", defaults["prova_tenuta_abilitata"])) and "test_freefall_leak" not in ( + unsupported_steps or []), "leak_1": len( row.get("prova_tenuta_abilitata", defaults["prova_tenuta_abilitata"])) and "leak_1" not in ( unsupported_steps or []), diff --git a/src/ui/recipe_selection/recipe_selection.py b/src/ui/recipe_selection/recipe_selection.py index 3db8a57..e5ebb2c 100755 --- a/src/ui/recipe_selection/recipe_selection.py +++ b/src/ui/recipe_selection/recipe_selection.py @@ -40,6 +40,9 @@ class Recipe_Selection(Widget): self.second_leak_test_enabled = self.config["hardware_config"].get("second_leak_test", "absent") == "present" self.defaults = self.config.get("recipes_defaults", noner) self.unsupported_steps = set(unsupported_steps or set()) + # Gate Free Fall feature by hardware_config flag + if self.config.get("hardware_config", {}).get("free_fall", "absent") != "present": + self.unsupported_steps.add("test_freefall_leak") # Hide instruction_extra entirely unless explicitly enabled in recipes_defaults (istruzione_abilitata_extra: x) try: instr_extra_enabled = str(self.config.get("recipes_defaults", noner)["istruzione_abilitata_extra"]).strip().lower() == "x" @@ -158,6 +161,7 @@ class Recipe_Selection(Widget): "pipe_cutter": len(self.config.get("recipes_defaults", noner)["tagliatubi_abilitata"]) and "pipe_cutter" not in self.unsupported_steps, "vision": len(self.config.get("recipes_defaults", noner)["test_visione_abilitato"]) and "vision" not in self.unsupported_steps, "leak_1": len(self.config.get("recipes_defaults", noner)["prova_tenuta_abilitata"]) and "leak_1" not in self.unsupported_steps, + "test_freefall_leak": len(self.config.get("recipes_defaults", noner)["prova_tenuta_abilitata"]) and "test_freefall_leak" not in self.unsupported_steps, "leak_2": (self.second_leak_test_enabled and len(self.config.get("recipes_defaults", noner)["prova_tenuta_abilitata_2"]) and "leak_2" not in self.unsupported_steps), "print": len(self.config.get("recipes_defaults", noner)["stampa_etichetta_abilitata"]) and "print" not in self.unsupported_steps, "step_editors": step_defaults, diff --git a/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.py b/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.py index 71df335..d1ffcb3 100644 --- a/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.py +++ b/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.py @@ -81,6 +81,13 @@ class Recipe_Spec_And_Step_Editor(Editor): "editor": Leak_Step_Editor(), "tab": self.leak_1_t, }, + "test_freefall_leak": { + "type": "test_freefall_leak", + "enable": self.free_fall_enabled_cb, + "widget": "free_fall_editor_w", + "editor": Leak_Step_Editor(), + "tab": self.free_fall_t, + }, "leak_2": { "type": "leak_2", "enable": self.leak_enabled_2_cb, diff --git a/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.ui b/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.ui index 6c4724f..2b31c7a 100644 --- a/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.ui +++ b/src/ui/recipe_spec_and_step_editor/recipe_spec_and_step_editor.ui @@ -434,6 +434,49 @@ Fasi di Test + + + Free Fall + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Fase Abilitata + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Test caduta pressione 2 diff --git a/src/ui/steps_management/steps_management.py b/src/ui/steps_management/steps_management.py index 7a46c20..d45743f 100644 --- a/src/ui/steps_management/steps_management.py +++ b/src/ui/steps_management/steps_management.py @@ -14,6 +14,7 @@ class Step_Spec_JEDECW(QPushButton, Cell): self.editors = { "vision": Vision_Step_Editor(cell_widget=self), "leak_1": Leak_Step_Editor(cell_widget=self), + "test_freefall_leak": Leak_Step_Editor(cell_widget=self), "leak_2": Leak_Step_Editor(cell_widget=self), } self.editor = None @@ -77,6 +78,7 @@ class Steps_Management(Widget): autocomplete={ "type": [ "leak_1", + "test_freefall_leak", "leak_2", "vision", ], diff --git a/src/ui/test/test.py b/src/ui/test/test.py index 88262c5..8c95638 100755 --- a/src/ui/test/test.py +++ b/src/ui/test/test.py @@ -127,6 +127,7 @@ class Test(Widget): "screws": {"screwdriver", "tecna_t3", }, "resistance": {"multicomp", }, "leak_1": {self.tester_component, }, + "test_freefall_leak": {self.tester_component, }, "leak_2": {self.tester_component, }, "pipe_cutter": {"pipe_cutter"}, "vision": {("uvc_camera", "galaxy_camera","hikrobot_sc"), "vision", "vision_saver", }, # "neo_pixels", }, @@ -164,6 +165,8 @@ class Test(Widget): text=u"EMERGENZA INTERVENUTA - RIPRISTINARE PULSANTE E SELEZIONARE \"RESET EMERGENZA\" DAL MEN\u00d9 \"STRUMENTI\"", widget=None), "fail": Test_Assembly(img_path=self.select_step_img("fail"), text=u"CICLO INTERROTTO, PREMERE CONTINUA PER COMINCIARE UN NUOVO CICLO", widget=Test_Fail(parent=self)), "blow": Test_Assembly(img_path=None, text=u"SOFFIAGGIO TUBO IN CORSO - ATTENDERE...", widget=Test_Warning_Img(components=self.components, recipe=self.recipe, step=self.step)), + "test_freefall_leak": Test_Assembly(img_path=None, text=None, widget=Test_Leak(config=self.config,components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces, parent=self)) + if self.config["hardware_config"]["tecna_t3"] != "absent" or self.config["hardware_config"]["furness_controls"] !="absent" else None, "leak_1": Test_Assembly(img_path=None, text=None, widget=Test_Leak(config=self.config,components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces, parent=self)) if self.config["hardware_config"]["tecna_t3"] != "absent" or self.config["hardware_config"]["furness_controls"] !="absent" else None, "leak_2": Test_Assembly(img_path=None, text=None, widget=Test_Leak(config=self.config,components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces, parent=self)) @@ -637,7 +640,17 @@ class Test(Widget): if step.step_type in ("leak_1", "leak_2"): self.leak_step = step + # Ensure Free Fall leak test appears before leak_1 when both are enabled step_types = [step.step_type for step in steps] + if "test_freefall_leak" in step_types and "leak_1" in step_types: + ff_index = step_types.index("test_freefall_leak") + l1_index = step_types.index("leak_1") + if ff_index > l1_index: + # Move Free Fall step to be immediately before leak_1 + steps.insert(l1_index, steps.pop(ff_index)) + # Recompute step_types after reordering + step_types = [step.step_type for step in steps] + if "leak_1" in step_types and "leak_2" in step_types: leak1_index = step_types.index("leak_1") leak2_index = step_types.index("leak_2") diff --git a/src/ui/test_leak/test_leak.py b/src/ui/test_leak/test_leak.py index 9feb38e..be52708 100644 --- a/src/ui/test_leak/test_leak.py +++ b/src/ui/test_leak/test_leak.py @@ -152,7 +152,10 @@ class Test_Leak(Test_Test): 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") + if step.step_type == "test_freefall_leak": + self.display_text(text="COLLAUDARE USANDO IL SISTEMA DI FLUSSAGGIO ALLA FINE DELLA PROVA POSIZIONRE IL PEZZO PER LA PROVATENUTA") + 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: