flush_blow option wip
This commit is contained in:
parent
9bf1d6b0fd
commit
6d65d00d88
|
|
@ -33,7 +33,7 @@ blow_on: 0 # INPUT VALVE TO SERVICE AIR
|
|||
out_channel_select: 1 # AIR OUT VALVE (0=CH1, 1=CH2)
|
||||
in_channel_select: 2 # AIR IN VALVE (0=CH1, 1=CH2)
|
||||
flush_on: 3 # OUTPUT VALVE TO DIRT COLLECTOR
|
||||
clean_led:4 # CLEAN INDICATOR
|
||||
blow_led:4 # CLEAN INDICATOR
|
||||
ch1_led:5 # CHANNEL 1 ACTIVE INDICATOR
|
||||
ch2_led:6 # CHANNEL 2 ACTIVE INDICATOR
|
||||
flush_led:7 # FLUSH INDICATOR
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from ui.test_test import Test_Test
|
|||
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.parent=parent
|
||||
self.step=step
|
||||
self.start_b.clicked.connect(self.start_test)
|
||||
|
|
@ -28,6 +29,29 @@ class Test_Leak(Test_Test):
|
|||
if self.step.type == "leak_1":
|
||||
self.parent.print_extra_labels()
|
||||
|
||||
# SELECT TEST CHANNEL
|
||||
if "digital_io" in self.components.keys():
|
||||
if "chan_sel" in self.step.spec.keys():
|
||||
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)
|
||||
|
||||
# SET LED INDICATORS
|
||||
self.set_digital_out("blow_led", chan_sel)
|
||||
if chan_sel:
|
||||
self.set_digital_out("ch1_led", chan_sel)
|
||||
else:
|
||||
self.set_digital_out("ch2_led", chan_sel)
|
||||
|
||||
if self.parent.config["hardware_config"].get("external_flush_blow",None)=="present":
|
||||
self.display_text("SOFFIAGGIO IN CORSO...")
|
||||
self.set_digital_out("blow_led",True)
|
||||
self.set_digital_out("blow_on",True)
|
||||
blow_time=int(self.step.spec['ext_blow_time'])
|
||||
time.sleep(blow_time)
|
||||
self.set_digital_out("blow_led", False)
|
||||
self.set_digital_out("blow_on", False)
|
||||
|
||||
self.components["tecna_t3"].start_test()
|
||||
|
||||
def start(self, recipe=None, step=None, pieces=None):
|
||||
|
|
@ -61,29 +85,13 @@ class Test_Leak(Test_Test):
|
|||
self.start_b.setEnabled(False)
|
||||
self.stop_b.setEnabled(False)
|
||||
|
||||
# SETUP RELAY CONFIGURATION
|
||||
if "digital_io" in self.components.keys():
|
||||
if "chan_sel" in step.spec.keys():
|
||||
chan_sel = step.spec["chan_sel"]
|
||||
bits = [0, 0]
|
||||
if chan_sel == 0:
|
||||
bits = [0,0]
|
||||
if chan_sel == 1:
|
||||
bits = [0,1]
|
||||
if chan_sel == 2:
|
||||
bits = [1,0]
|
||||
|
||||
ret=self.components["digital_io"].set_bit_verify(0, 0, bits[1])
|
||||
ret=self.components["digital_io"].set_bit_verify(0, 1, bits[0])
|
||||
time.sleep(1)
|
||||
# AUTO START SECOND TEST
|
||||
if step.type == "leak_2":
|
||||
self.start_b.setEnabled(True)
|
||||
self.start_b.click()
|
||||
|
||||
if ret:
|
||||
time.sleep(1)
|
||||
# AUTO START SECOND TEST
|
||||
if step.type == "leak_2":
|
||||
self.start_b.setEnabled(True)
|
||||
self.start_b.click()
|
||||
else:
|
||||
QMessageBox.critical(None, "Errore", f"Errore di pilotaggio elettrovalvole")
|
||||
return show
|
||||
|
||||
def stop(self):
|
||||
|
|
@ -116,6 +124,7 @@ class Test_Leak(Test_Test):
|
|||
}
|
||||
|
||||
if "Running test: result" in data["tecna_t3"]:
|
||||
# TEST ENDED
|
||||
result = data["tecna_t3"]["Running test: result"]
|
||||
step=self.step.spec.get("autotest", "")
|
||||
if step == "ok_check":
|
||||
|
|
@ -125,10 +134,16 @@ class Test_Leak(Test_Test):
|
|||
else:
|
||||
ok = type(result) is str and "passed" in result.lower() # NORMAL TEST
|
||||
|
||||
if "digital_io" in self.components.keys():
|
||||
# RESET RELAYS
|
||||
ret = self.components["digital_io"].set_bit_verify(0, 0, 0)
|
||||
ret = self.components["digital_io"].set_bit_verify(0, 1, 0)
|
||||
# SET LED INDICATORS
|
||||
|
||||
if self.parent.config["hardware_config"].get("external_flush_blow", None) == "present":
|
||||
self.display_text("SCARICO ESTERNO IN CORSO...")
|
||||
self.set_digital_out("flush_led", True)
|
||||
self.set_digital_out("flush_on", True)
|
||||
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)
|
||||
|
||||
else:
|
||||
#result = None
|
||||
|
|
@ -171,14 +186,11 @@ class Test_Leak(Test_Test):
|
|||
"FINE TEST",
|
||||
}:
|
||||
if self.step.spec.get("autotest", False) == "ok_check":
|
||||
if self.parent_assembly_widget is not None:
|
||||
self.parent_assembly_widget().set_text(text="AUTOTEST: RIMUOVERE FUGA CALIBRATA E PREMERE START PER INIZIARE LA PROVA TENUTA",bg_color="blue",text_color="white")
|
||||
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":
|
||||
if self.parent_assembly_widget is not None :
|
||||
self.parent_assembly_widget().set_text(text="AUTOTEST: COLLEGARE TUBO-TUBO + FUGA CALIBRATA E PREMERE START PER INIZIARE LA PROVA TENUTA DI PROVA",bg_color="blue",text_color="white")
|
||||
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:
|
||||
if self.parent_assembly_widget is not None:
|
||||
self.parent_assembly_widget().set_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")
|
||||
if self.simulate:
|
||||
QApplication.processEvents()
|
||||
time.sleep(2)
|
||||
|
|
@ -191,16 +203,26 @@ class Test_Leak(Test_Test):
|
|||
else:
|
||||
if self.step is not None:
|
||||
if self.step.spec.get("autotest", False) is not True:
|
||||
if self.parent_assembly_widget is not None:
|
||||
self.parent_assembly_widget().set_text(text="PROVA TENUTA IN CORSO")
|
||||
self.display_text(text="PROVA TENUTA IN CORSO")
|
||||
else:
|
||||
if self.parent_assembly_widget is not None:
|
||||
self.parent_assembly_widget().set_text(text="AUTOTEST: PROVA TENUTA IN CORSO")
|
||||
self.display_text(text="AUTOTEST: PROVA TENUTA IN CORSO")
|
||||
self.start_b.setEnabled(False)
|
||||
self.stop_b.setEnabled(True)
|
||||
ok = data.get("results", {}).get("ok", None)
|
||||
super().visualize(data, img=self.status_imgs_full[ok])
|
||||
|
||||
def display_text(self,text="", bg_color=None,text_color=None):
|
||||
if self.parent_assembly_widget is not None:
|
||||
self.parent_assembly_widget().set_text(text=text, bg_color=bg_color,text_color=text_color)
|
||||
|
||||
def set_digital_out(self,name=None,state=1):
|
||||
if self.io_ok:
|
||||
bit=int(self.parent.config["digital_io"][name])
|
||||
ret = self.components["digital_io"].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
|
||||
|
||||
def save_last(self):
|
||||
if self.last is None:
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user