added keep_true mode for test instructions to hold True state for ST-TEN-11 TBT

This commit is contained in:
neo 2026-05-11 09:08:52 +02:00
parent fb6582857d
commit 15c7cb934b
4 changed files with 22 additions and 10 deletions

View File

@ -22,7 +22,7 @@ In addition to leak testing, the software supports many other functions, dependi
- On Windows: ./init_win.bat
- On Linux: ./init.sh
## fIX Chrome
## FIX Chrome
If chrome doesn't start run this command
rm ~/.config/google-chrome/SingletonLock
## FIX FOR TERMINAL NOT WORKINK FOR WINDOWS 10

View File

@ -102,6 +102,7 @@ baudrate: 9600
[digital_io]
id: USB-5862,BID#0
keep_true = no
[vision]
neural_network: none

View File

@ -48,7 +48,7 @@ risoluzione:300
# OUTPUT MAP FOR FIXTURE CONNECTOR
id: USB-5862,BID#0
first_output: 0
keep_true = yes
[fixture_rfid]
port: COM5

View File

@ -38,6 +38,8 @@ class Test_Instructions(Test_Test):
self.print_b.setVisible(True)
self.print_b.setEnabled(True)
self.print_b.clicked.connect(self.print_button)
# Read the keep_true configuration flag (defaults to disabled)
self.keep_true = str(self.config.get("digital_io", {}).get("keep_true", "no")).lower() in ["yes", "true", "1"]
def start(self, recipe=None, step=None, pieces=None):
show = super().start(recipe=recipe, step=step)
@ -196,6 +198,7 @@ class Test_Instructions(Test_Test):
ok = True
if len(data[0]["digital_io"]) == 0:
return
for sensor in self.monitored_ids:
sensor_name = sensor.attrib['id']
sensor_index_part = sensor.attrib['id'].split("_")[1]
@ -214,8 +217,17 @@ class Test_Instructions(Test_Test):
continue
if isinstance(sensor_index, int):
if (inverse and current_bitstate != self.expected_input_state) or (not inverse and current_bitstate == self.expected_input_state):
is_expected = (inverse and current_bitstate != self.expected_input_state) or (not inverse and current_bitstate == self.expected_input_state)
if self.keep_true:
# Memorize the True state if the condition is met
if is_expected:
self.inputs[sensor_index] = True
elif sensor_index not in self.inputs:
self.inputs[sensor_index] = False
else:
# Live tracking (Original behavior expectation when keep_true is not enabled)
self.inputs[sensor_index] = is_expected
if not self.inputs.get(sensor_index, False):
ok = False
@ -234,7 +246,6 @@ class Test_Instructions(Test_Test):
self.toggle_icons()
def set_done(self):
self.done=True
self.done_ok=True