dual
This commit is contained in:
parent
afdee1335e
commit
4d4769a7be
|
|
@ -19,6 +19,7 @@ second_leak_test: present
|
|||
barcode_recipe_selection: present
|
||||
external_flush_blow: present # EXTERNAL BOX CONTROLLING MULTI-CHANNEL TEST (IF PRESENT), BLOW-CLEANING AND EXTERNAL FLUSH
|
||||
dual_channel: present
|
||||
freefall: present # Added freefall setting
|
||||
#fixture_id: present
|
||||
|
||||
[tecna_t3]
|
||||
|
|
@ -55,6 +56,7 @@ blow_led:7 # CLEAN INDICATOR
|
|||
ch1_led:6 # CHANNEL 1 ACTIVE INDICATOR
|
||||
ch2_led:5 # CHANNEL 2 ACTIVE INDICATOR
|
||||
flush_led:4 # FLUSH INDICATOR
|
||||
first_output: 8 # Added first_output for freefall
|
||||
|
||||
[recipe]
|
||||
recipe_name_field: codice_ricetta
|
||||
|
|
@ -109,7 +111,7 @@ settling_pressure_max_percent: 5
|
|||
test_pressure: 7000
|
||||
test_time: 10
|
||||
test_pressure_qpos: 5 #Q+ Upper test leak limit
|
||||
test_pressure_qneg: 15 #Q- Lower test leak limit
|
||||
test_pressure_qneg: 15 #Q- Lower test leak limit (tube-tube)
|
||||
test_pressure_tt_qpos: 1 # Q+ Upper test leak limit (tube-tube)
|
||||
test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube)
|
||||
flush_time: 1
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ class Test_Leak(Test_Test):
|
|||
self.recipe_written = False
|
||||
self.start_b.clicked.connect(self.start_test)
|
||||
self.stop_b.clicked.connect(self.stop_test)
|
||||
self.show_instruction_b.setVisible("show_instructions" in self.parent.config["hardware_config"].keys())
|
||||
|
||||
hardware_config = self.config.get("hardware_config", {})
|
||||
self.show_instruction_b.setVisible("show_instructions" in hardware_config)
|
||||
self.show_instruction_b.clicked.connect(self.show_instruction)
|
||||
|
||||
# Connect to the tecna_error_signal to handle connection issues
|
||||
|
|
@ -32,7 +34,7 @@ class Test_Leak(Test_Test):
|
|||
|
||||
def show_instruction(self):
|
||||
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.recipe,bench_name=self.config.get("machine_id", "")))
|
||||
dialog.show()
|
||||
|
||||
def reset(self):
|
||||
|
|
@ -49,50 +51,53 @@ class Test_Leak(Test_Test):
|
|||
def start_test(self):
|
||||
# 1. HANDLE FREEFALL SPECIFIC OUTPUTS
|
||||
if self.step.step_type == "test_freefall_leak":
|
||||
self.set_digital_out("first_output", 1)
|
||||
self.set_digital_out("first_output", 1, component_name="digital_io_flush_blow")
|
||||
|
||||
# 2. PRINT LABELS IF NECESSARY
|
||||
# 2. PRINT LABELS IF NECESSARY
|
||||
if self.step.step_type == "leak_1":
|
||||
self.parent.print_extra_labels()
|
||||
|
||||
# 3. CHANNEL SELECTION (Moved outside of the flush/blow check)
|
||||
# This ensures channels are switched even if external_flush_blow is absent
|
||||
if self.parent.config["hardware_config"].get("dual_channel", None) == "present":
|
||||
chan_sel = self.step.spec.get("chan_sel", 0) # Default to CH1 (0) if not specified
|
||||
self.set_digital_out("out_channel_select", chan_sel)
|
||||
self.set_digital_out("in_channel_select", chan_sel)
|
||||
# 3. CHANNEL SELECTION (with defensive checks)
|
||||
hardware_config = self.config.get("hardware_config", {})
|
||||
if hardware_config.get("dual_channel") == "present":
|
||||
is_freefall_machine = hardware_config.get("freefall") == "present"
|
||||
chan_sel = self.step.spec.get("chan_sel", 0)
|
||||
|
||||
if is_freefall_machine:
|
||||
chan_sel = 1 - chan_sel
|
||||
|
||||
self.set_digital_out("out_channel_select", chan_sel, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("in_channel_select", chan_sel, component_name="digital_io_flush_blow")
|
||||
|
||||
# SET LED INDICATORS
|
||||
if chan_sel == 0:
|
||||
self.set_digital_out("ch1_led", True)
|
||||
self.set_digital_out("ch2_led", False) # Ensure the other is off
|
||||
self.set_digital_out("ch1_led", True, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("ch2_led", False, component_name="digital_io_flush_blow")
|
||||
else:
|
||||
self.set_digital_out("ch2_led", True)
|
||||
self.set_digital_out("ch1_led", False)
|
||||
self.set_digital_out("ch2_led", True, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("ch1_led", False, component_name="digital_io_flush_blow")
|
||||
|
||||
time.sleep(VALVE_TIME)
|
||||
|
||||
# 4. EXTERNAL FLUSH / BLOW LOGIC
|
||||
if self.parent.config["hardware_config"].get("external_flush_blow", None) == "present":
|
||||
if hardware_config.get("external_flush_blow") == "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)
|
||||
self.set_digital_out("blow_led", True, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("blow_on", True, component_name="digital_io_flush_blow")
|
||||
time.sleep(VALVE_TIME)
|
||||
self.set_digital_out("flush_on", True)
|
||||
self.set_digital_out("flush_on", True, component_name="digital_io_flush_blow")
|
||||
|
||||
blow_time = int(self.step.spec.get('ext_blow_time', 3))
|
||||
time.sleep(blow_time)
|
||||
|
||||
self.set_digital_out("blow_led", False)
|
||||
self.set_digital_out("blow_on", False)
|
||||
self.set_digital_out("blow_led", False, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("blow_on", False, component_name="digital_io_flush_blow")
|
||||
time.sleep(VALVE_TIME)
|
||||
self.set_digital_out("flush_on", False)
|
||||
self.set_digital_out("flush_on", False, component_name="digital_io_flush_blow")
|
||||
|
||||
# 5. FALLBACK LED FOR SINGLE CHANNEL MACHINES
|
||||
elif self.parent.config["hardware_config"].get("dual_channel", None) != "present":
|
||||
# Ensure CH1 LED is on for standard machines if no dual channel exists
|
||||
self.set_digital_out("ch1_led", True)
|
||||
elif hardware_config.get("dual_channel") != "present":
|
||||
self.set_digital_out("ch1_led", True, component_name="digital_io_flush_blow")
|
||||
|
||||
# 6. TRIGGER PHYSICAL TESTER
|
||||
self.blow_on = False
|
||||
|
|
@ -149,7 +154,8 @@ class Test_Leak(Test_Test):
|
|||
if self.step.spec.get("autotest", False): # IF AUTOTESTING UPLOAD RECIPE EVERY TIME
|
||||
self.recipe_written = False
|
||||
|
||||
if self.parent.config["hardware_config"].get("second_leak_test", "absent") == "present": # IF SECOND LEAK TEST ENABLED UPLOAD RECIPE EVERY TIME
|
||||
hardware_config = self.config.get("hardware_config", {})
|
||||
if hardware_config.get("second_leak_test") == "present": # IF SECOND LEAK TEST ENABLED UPLOAD RECIPE EVERY TIME
|
||||
self.recipe_written = False
|
||||
|
||||
if not self.recipe_written:
|
||||
|
|
@ -227,7 +233,8 @@ class Test_Leak(Test_Test):
|
|||
|
||||
# AUTO START SECOND TEST
|
||||
if step.step_type == "leak_2":
|
||||
if self.config["hardware_config"].get("dual_channel", "absent") == "present":
|
||||
hardware_config = self.config.get("hardware_config", {})
|
||||
if hardware_config.get("dual_channel") == "present":
|
||||
self.recipe_written = False
|
||||
time.sleep(1)
|
||||
self.start_b.setEnabled(True)
|
||||
|
|
@ -244,7 +251,7 @@ class Test_Leak(Test_Test):
|
|||
self.components[self.tester_component].stop_test()
|
||||
self.components[self.tester_component].pause()
|
||||
self.disconnect(self.get_connection)
|
||||
self.set_digital_out("first_output", 0) # Set low when test stops
|
||||
self.set_digital_out("first_output", 0, component_name="digital_io_flush_blow") # Set low when test stops
|
||||
super().stop()
|
||||
self.start_b.setEnabled(False)
|
||||
self.stop_b.setEnabled(False)
|
||||
|
|
@ -344,26 +351,26 @@ class Test_Leak(Test_Test):
|
|||
self.parent.autostart_next_step = True
|
||||
|
||||
# SET DIGITAL OUTPUTS
|
||||
|
||||
if self.parent.config["hardware_config"].get("external_flush_blow", None) == "present":
|
||||
hardware_config = self.config.get("hardware_config", {})
|
||||
if hardware_config.get("external_flush_blow") == "present":
|
||||
self.blow_on = True
|
||||
if self.parent.config["hardware_config"].get("dual_channel", None) != "present":
|
||||
self.set_digital_out("ch1_led", False)
|
||||
if hardware_config.get("dual_channel") != "present":
|
||||
self.set_digital_out("ch1_led", False, component_name="digital_io_flush_blow")
|
||||
|
||||
self.display_text("SCARICO ESTERNO IN CORSO...")
|
||||
self.set_digital_out("flush_led", True)
|
||||
self.set_digital_out("flush_on", True)
|
||||
self.set_digital_out("flush_led", True, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("flush_on", True, component_name="digital_io_flush_blow")
|
||||
time.sleep(VALVE_TIME)
|
||||
flush_time = int(self.step.spec.get('ext_flush_time',3))
|
||||
time.sleep(flush_time)
|
||||
self.set_digital_out("flush_led", False)
|
||||
self.set_digital_out("flush_led", False, component_name="digital_io_flush_blow")
|
||||
#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)
|
||||
if hardware_config.get("dual_channel") == "present":
|
||||
self.set_digital_out("out_channel_select", False, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("in_channel_select", False, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("ch1_led", False, component_name="digital_io_flush_blow")
|
||||
self.set_digital_out("ch2_led", False, component_name="digital_io_flush_blow")
|
||||
else:
|
||||
#result = None
|
||||
ok = None
|
||||
|
|
@ -421,7 +428,7 @@ class Test_Leak(Test_Test):
|
|||
if d.get("Running test: active phase", None) in {
|
||||
"WAITING START",
|
||||
"ATTESA START",
|
||||
"END TEST, WAITING THE START OF A NEW TEST"
|
||||
"END TEST, WAITING THE START OF A NEW TEST",
|
||||
"FINE TEST",
|
||||
"STANDBY",
|
||||
"PRESSIONE BASSA",
|
||||
|
|
@ -481,11 +488,18 @@ class Test_Leak(Test_Test):
|
|||
|
||||
def set_digital_out(self,out_name=None,state=1,component_name="digital_io"):
|
||||
if self.io_ok:
|
||||
bit = int(self.parent.config[component_name][out_name])
|
||||
ret = self.components[component_name].set_bit_verify(0,bit,state)
|
||||
if not ret:
|
||||
QMessageBox.critical(None, "ERRORE", f"ERRORE I/O DIGITALE - VERIFICARE CONNESSIONE USB")
|
||||
self.io_ok = False
|
||||
component_config = self.config.get(component_name, {})
|
||||
bit_val = component_config.get(out_name)
|
||||
if bit_val is not None:
|
||||
bit = int(bit_val)
|
||||
ret = self.components[component_name].set_bit_verify(0,bit,state)
|
||||
if not ret:
|
||||
QMessageBox.critical(None, "ERRORE", f"ERRORE I/O DIGITALE - VERIFICARE CONNESSIONE USB")
|
||||
self.io_ok = False
|
||||
else:
|
||||
# Handle case where out_name is not in the config to avoid a crash
|
||||
print(f"Warning: Output '{out_name}' not found in '{component_name}' config.")
|
||||
|
||||
|
||||
def save_last(self):
|
||||
if self.last is None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user