fix freefall
This commit is contained in:
parent
ce63d006da
commit
815135bbc6
|
|
@ -30,13 +30,6 @@ class Test_Leak(Test_Test):
|
||||||
# Connect to the tecna_error_signal to handle connection issues
|
# Connect to the tecna_error_signal to handle connection issues
|
||||||
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 _test_output_sequence(self, step):
|
|
||||||
"""Sets the first digital output of the usb_586x based on the step type."""
|
|
||||||
if step.step_type == "test_freefall_leak":
|
|
||||||
self.set_digital_out("first_output", 1) # Set high
|
|
||||||
else:
|
|
||||||
self.set_digital_out("first_output", 0) # Set low
|
|
||||||
|
|
||||||
def show_instruction(self):
|
def show_instruction(self):
|
||||||
dialog=Dialog()
|
dialog=Dialog()
|
||||||
dialog.setCentralWidget(Test_Instructions_Reminder(recipe=self.parent.recipe,bench_name=self.parent.config.machine_id))
|
dialog.setCentralWidget(Test_Instructions_Reminder(recipe=self.parent.recipe,bench_name=self.parent.config.machine_id))
|
||||||
|
|
@ -54,6 +47,8 @@ class Test_Leak(Test_Test):
|
||||||
self.stop_b.setEnabled(False)
|
self.stop_b.setEnabled(False)
|
||||||
|
|
||||||
def start_test(self):
|
def start_test(self):
|
||||||
|
if self.step.step_type == "test_freefall_leak":
|
||||||
|
self.set_digital_out("first_output", 1) # Set high
|
||||||
# print extra labels
|
# print extra labels
|
||||||
if self.step.step_type == "leak_1":
|
if self.step.step_type == "leak_1":
|
||||||
self.parent.print_extra_labels()
|
self.parent.print_extra_labels()
|
||||||
|
|
@ -95,7 +90,6 @@ class Test_Leak(Test_Test):
|
||||||
|
|
||||||
|
|
||||||
def start(self, recipe=None, step=None, pieces=None):
|
def start(self, recipe=None, step=None, pieces=None):
|
||||||
self._test_output_sequence(step) # Call with the step object
|
|
||||||
# TESTING
|
# TESTING
|
||||||
if "--test-leak" in sys.argv:
|
if "--test-leak" in sys.argv:
|
||||||
self.simulate = True
|
self.simulate = True
|
||||||
|
|
@ -191,33 +185,10 @@ class Test_Leak(Test_Test):
|
||||||
|
|
||||||
self.display_text(text="USARE IL SISTEMA DI FLUSSAGGIO. AL TERMINE POSIZIONARE IL PEZZO PER LA PROVA TENUTA")
|
self.display_text(text="USARE IL SISTEMA DI FLUSSAGGIO. AL TERMINE POSIZIONARE IL PEZZO PER LA PROVA TENUTA")
|
||||||
|
|
||||||
# Show placeholder image for free-fall: PERVIETÀ.png
|
# Show placeholder image for free-fall
|
||||||
pervieta_path_candidates = [
|
super().visualize(None, img=self.status_imgs_full[None])
|
||||||
"config/warning_images/generic/PERVIETÀ.png",
|
|
||||||
"config/warning_images/generic/PERVIETA.png",
|
|
||||||
"config/warning_images/generic/pervieta.png",
|
|
||||||
]
|
|
||||||
img_path = next((p for p in pervieta_path_candidates if os.path.exists(p)), None)
|
|
||||||
if img_path is not None:
|
|
||||||
super().visualize(None, img=QPixmap(img_path))
|
|
||||||
else:
|
|
||||||
# Fallbacks: try the older instruction image or default
|
|
||||||
try:
|
|
||||||
instr_folder = (self.config.get("machine", {}) or {}).get("instruction_folder", getattr(self.config, "machine_id", "")).strip() or getattr(self.config, "machine_id", "")
|
|
||||||
except Exception:
|
|
||||||
instr_folder = getattr(self.config, "machine_id", "")
|
|
||||||
ff_img = None
|
|
||||||
for ext in ("png", "jpg", "jpeg"):
|
|
||||||
candidate = f"config/instruction_images/{instr_folder}/free_fall.{ext}"
|
|
||||||
if os.path.exists(candidate):
|
|
||||||
ff_img = candidate
|
|
||||||
break
|
|
||||||
if ff_img is not None:
|
|
||||||
super().visualize(None, img=QPixmap(ff_img))
|
|
||||||
else:
|
|
||||||
super().visualize(None, img=self.status_imgs_full[None])
|
|
||||||
else:
|
else:
|
||||||
# If the recipe contains a Free Fall test, show the PERVIETÀ image as default even on Leak steps
|
# If the recipe contains a Free Fall test, show a default image even on Leak steps
|
||||||
try:
|
try:
|
||||||
has_free_fall = any(getattr(s, "step_type", None) == "test_freefall_leak" for s in (self.parent.cycle_steps or []))
|
has_free_fall = any(getattr(s, "step_type", None) == "test_freefall_leak" for s in (self.parent.cycle_steps or []))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -228,17 +199,8 @@ class Test_Leak(Test_Test):
|
||||||
self._free_fall_img_scale = 1.75
|
self._free_fall_img_scale = 1.75
|
||||||
# Keep normal Leak instruction text
|
# Keep normal Leak instruction text
|
||||||
self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA")
|
self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA")
|
||||||
# Load PERVIETÀ image with fallbacks
|
# Load default image
|
||||||
pervieta_path_candidates = [
|
super().visualize(None, img=self.status_imgs_full[None])
|
||||||
"config/warning_images/generic/PERVIETÀ_2.png",
|
|
||||||
"config/warning_images/generic/PERVIETA_2.png",
|
|
||||||
"config/warning_images/generic/pervieta_2.png",
|
|
||||||
]
|
|
||||||
img_path = next((p for p in pervieta_path_candidates if os.path.exists(p)), None)
|
|
||||||
if img_path is not None:
|
|
||||||
super().visualize(None, img=QPixmap(img_path))
|
|
||||||
else:
|
|
||||||
super().visualize(None, img=self.status_imgs_full[None])
|
|
||||||
else:
|
else:
|
||||||
# Ensure Free Fall mode is disabled for other steps
|
# Ensure Free Fall mode is disabled for other steps
|
||||||
self._free_fall_mode = False
|
self._free_fall_mode = False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user