Free_fall

This commit is contained in:
eduar 2026-01-23 14:42:45 +01:00
parent bcd7ae6904
commit 58bbbb19e9
3 changed files with 14 additions and 4 deletions

View File

@ -46,7 +46,8 @@ risoluzione:300
[digital_io] [digital_io]
# OUTPUT MAP FOR FIXTURE CONNECTOR # OUTPUT MAP FOR FIXTURE CONNECTOR
id: USB-5862,BID#0 id: USB-5860,BID#0
first_output: 0
[fixture_rfid] [fixture_rfid]

View File

@ -53,7 +53,7 @@ class USB_586x(Component):
self.info.ModuleIndex = 0 self.info.ModuleIndex = 0
self.open_device() self.open_device()
#self.out_bits = self.config["digital_outputs"] self.out_bits = self.config[self.name]
#self.in_bits = self.config["digital_inputs"] #self.in_bits = self.config["digital_inputs"]
# SET ALL RELAYS OFF # SET ALL RELAYS OFF

View File

@ -5,7 +5,7 @@ import os
from PyQt5.QtGui import QPixmap from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QMessageBox, QDialog, QApplication from PyQt5.QtWidgets import QMessageBox, QDialog, QApplication
from PyQt5.QtCore import Qt, pyqtSlot from PyQt5.QtCore import Qt, pyqtSlot, QTimer
from ui import Dialog from ui import Dialog
from ui.test_instructions_reminder import Test_Instructions_Reminder from ui.test_instructions_reminder import Test_Instructions_Reminder
from ui.test_test import Test_Test from ui.test_test import Test_Test
@ -30,6 +30,13 @@ 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))
@ -88,6 +95,7 @@ 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
@ -263,6 +271,7 @@ class Test_Leak(Test_Test):
self.components[self.tester_component].stop_test() self.components[self.tester_component].stop_test()
self.components[self.tester_component].pause() self.components[self.tester_component].pause()
self.disconnect(self.get_connection) self.disconnect(self.get_connection)
self.set_digital_out("first_output", 0) # Set low when test stops
super().stop() super().stop()
self.start_b.setEnabled(False) self.start_b.setEnabled(False)
self.stop_b.setEnabled(False) self.stop_b.setEnabled(False)
@ -488,7 +497,7 @@ class Test_Leak(Test_Test):
QMessageBox.warning(self, "Avviso", text) QMessageBox.warning(self, "Avviso", text)
QApplication.processEvents() QApplication.processEvents()
def set_digital_out(self,out_name=None,state=1,component_name="digital_io_flush_blow"): def set_digital_out(self,out_name=None,state=1,component_name="digital_io"):
if self.io_ok: if self.io_ok:
bit = int(self.parent.config[component_name][out_name]) bit = int(self.parent.config[component_name][out_name])
ret = self.components[component_name].set_bit_verify(0,bit,state) ret = self.components[component_name].set_bit_verify(0,bit,state)