added keep_true mode for test instructions to hold True state for ST-TEN-11 TBT
This commit is contained in:
parent
fb6582857d
commit
15c7cb934b
|
|
@ -22,7 +22,7 @@ In addition to leak testing, the software supports many other functions, dependi
|
||||||
- On Windows: ./init_win.bat
|
- On Windows: ./init_win.bat
|
||||||
- On Linux: ./init.sh
|
- On Linux: ./init.sh
|
||||||
|
|
||||||
## fIX Chrome
|
## FIX Chrome
|
||||||
If chrome doesn't start run this command
|
If chrome doesn't start run this command
|
||||||
rm ~/.config/google-chrome/SingletonLock
|
rm ~/.config/google-chrome/SingletonLock
|
||||||
## FIX FOR TERMINAL NOT WORKINK FOR WINDOWS 10
|
## FIX FOR TERMINAL NOT WORKINK FOR WINDOWS 10
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ baudrate: 9600
|
||||||
|
|
||||||
[digital_io]
|
[digital_io]
|
||||||
id: USB-5862,BID#0
|
id: USB-5862,BID#0
|
||||||
|
keep_true = no
|
||||||
|
|
||||||
[vision]
|
[vision]
|
||||||
neural_network: none
|
neural_network: none
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ risoluzione:300
|
||||||
# OUTPUT MAP FOR FIXTURE CONNECTOR
|
# OUTPUT MAP FOR FIXTURE CONNECTOR
|
||||||
id: USB-5862,BID#0
|
id: USB-5862,BID#0
|
||||||
first_output: 0
|
first_output: 0
|
||||||
|
keep_true = yes
|
||||||
|
|
||||||
[fixture_rfid]
|
[fixture_rfid]
|
||||||
port: COM5
|
port: COM5
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ class Test_Instructions(Test_Test):
|
||||||
self.print_b.setVisible(True)
|
self.print_b.setVisible(True)
|
||||||
self.print_b.setEnabled(True)
|
self.print_b.setEnabled(True)
|
||||||
self.print_b.clicked.connect(self.print_button)
|
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):
|
def start(self, recipe=None, step=None, pieces=None):
|
||||||
show = super().start(recipe=recipe, step=step)
|
show = super().start(recipe=recipe, step=step)
|
||||||
|
|
@ -192,10 +194,11 @@ class Test_Instructions(Test_Test):
|
||||||
super().get(None, override=override)
|
super().get(None, override=override)
|
||||||
return
|
return
|
||||||
|
|
||||||
#check if all sensor are ok
|
# check if all sensor are ok
|
||||||
ok = True
|
ok = True
|
||||||
if len(data[0]["digital_io"])==0:
|
if len(data[0]["digital_io"]) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
for sensor in self.monitored_ids:
|
for sensor in self.monitored_ids:
|
||||||
sensor_name = sensor.attrib['id']
|
sensor_name = sensor.attrib['id']
|
||||||
sensor_index_part = sensor.attrib['id'].split("_")[1]
|
sensor_index_part = sensor.attrib['id'].split("_")[1]
|
||||||
|
|
@ -206,16 +209,25 @@ class Test_Instructions(Test_Test):
|
||||||
sensor_index = sensor_index_part
|
sensor_index = sensor_index_part
|
||||||
|
|
||||||
inverse = 'inv' in sensor_name
|
inverse = 'inv' in sensor_name
|
||||||
byte_idx=int(sensor_index/8) if isinstance(sensor_index, int) else None
|
byte_idx = int(sensor_index / 8) if isinstance(sensor_index, int) else None
|
||||||
bit_idx=sensor_index%8 if isinstance(sensor_index, int) else None
|
bit_idx = sensor_index % 8 if isinstance(sensor_index, int) else None
|
||||||
current_bitstate = data[0]["digital_io"][byte_idx][bit_idx] if isinstance(sensor_index, int) else None
|
current_bitstate = data[0]["digital_io"][byte_idx][bit_idx] if isinstance(sensor_index, int) else None
|
||||||
|
|
||||||
if 'stat' in sensor_name:
|
if 'stat' in sensor_name:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if isinstance(sensor_index, int):
|
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
|
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):
|
if not self.inputs.get(sensor_index, False):
|
||||||
ok = False
|
ok = False
|
||||||
|
|
@ -234,7 +246,6 @@ class Test_Instructions(Test_Test):
|
||||||
|
|
||||||
self.toggle_icons()
|
self.toggle_icons()
|
||||||
|
|
||||||
|
|
||||||
def set_done(self):
|
def set_done(self):
|
||||||
self.done=True
|
self.done=True
|
||||||
self.done_ok=True
|
self.done_ok=True
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user