Add inverse sensor monitoring in test instructions
Expanded the functionality in test_instructions.py to also monitor and record the state of inverse sensors (inv_sensor). This was done in the checking phase, following similar logic that is used for regular sensors (sensor). Also adjusted the sensor index referencing for these inverse sensors.
This commit is contained in:
parent
e0f58b9918
commit
7351f66d61
@ -57,6 +57,7 @@ class Test_Instructions(Test_Test):
|
||||
self.expected_input_state = True if step.type == "instruction" else False
|
||||
|
||||
self.monitored_ids=self.svg_root.xpath(f'''.//*[starts-with(@id, 'sensor_')]''')
|
||||
self.inv_monitored_ids = self.svg_root.xpath(f'''.//*[starts-with(@id, 'inv_sensor_')]''')
|
||||
|
||||
self.tape_ids=self.svg_root.xpath(f'''.//*[starts-with(@id, 'tape_')]''')
|
||||
|
||||
@ -145,6 +146,18 @@ class Test_Instructions(Test_Test):
|
||||
else:
|
||||
self.inputs[sensor_index] = False
|
||||
ok = False
|
||||
|
||||
#check if all inv_sensor are ok
|
||||
for sensor in self.inv_monitored_ids:
|
||||
sensor_index = int(sensor.attrib['id'].split("_")[2]) - 3 # Changed from 1 a 2 for the prefix
|
||||
byte_idx = int(sensor_index / 8)
|
||||
bit_idx = sensor_index % 8
|
||||
if data[0]["digital_io"][byte_idx][bit_idx] != self.expected_input_state:
|
||||
self.inputs[sensor_index] = True
|
||||
else:
|
||||
self.inputs[sensor_index] = False
|
||||
ok = False
|
||||
|
||||
if ok:
|
||||
self.stop()
|
||||
super().get([{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user