new sensor id ok
This commit is contained in:
parent
e886433fd7
commit
0705d40a09
72
config/instruction_images/st-ten-5/5802850926.svg
Normal file
72
config/instruction_images/st-ten-5/5802850926.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 237 KiB |
91
config/instruction_images/st-ten-5/5802963598.svg
Normal file
91
config/instruction_images/st-ten-5/5802963598.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 284 KiB |
79
config/instruction_images/st-ten-5/5802963681.svg
Normal file
79
config/instruction_images/st-ten-5/5802963681.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 480 KiB |
|
|
@ -16,7 +16,6 @@ python -B -u "./src/main.py" \
|
||||||
--auto-accept-test-admin-permission \
|
--auto-accept-test-admin-permission \
|
||||||
--auto-login-admin \
|
--auto-login-admin \
|
||||||
--auto-select \
|
--auto-select \
|
||||||
--debugger-workaround \
|
|
||||||
--no-edgetpu \
|
--no-edgetpu \
|
||||||
--no-gpu \
|
--no-gpu \
|
||||||
--panel \
|
--panel \
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ class USB_586x(Component):
|
||||||
read = []
|
read = []
|
||||||
if is_win or self.simulate:
|
if is_win or self.simulate:
|
||||||
if self.simulate:
|
if self.simulate:
|
||||||
read.append(bytearray(0))
|
read=[1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]
|
||||||
else:
|
else:
|
||||||
ret = self.di_read(0, self.in_size)
|
ret = self.di_read(0, self.in_size)
|
||||||
if ret[0].value == ErrorCode.Success.value:
|
if ret[0].value == ErrorCode.Success.value:
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class Test_Instructions(Test_Test):
|
||||||
self.svgWidget=None
|
self.svgWidget=None
|
||||||
self.svg_root=None
|
self.svg_root=None
|
||||||
self.flag=False
|
self.flag=False
|
||||||
|
self.inputs={}
|
||||||
self.svg_widget=QtSvg.QSvgWidget()
|
self.svg_widget=QtSvg.QSvgWidget()
|
||||||
self.layout = QVBoxLayout()
|
self.layout = QVBoxLayout()
|
||||||
self.layout.addWidget(self.svg_widget)
|
self.layout.addWidget(self.svg_widget)
|
||||||
|
|
@ -31,12 +32,7 @@ class Test_Instructions(Test_Test):
|
||||||
|
|
||||||
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)
|
||||||
ring_ids=[f"ring_{i+1}" for i in range(step.spec["num_ring"])]
|
|
||||||
piece_ids=[f"piece_{i+1}" for i in range(step.spec["num_piece"])]
|
|
||||||
tape_ids=[f"tape_{i+1}" for i in range(step.spec["num_tape"])]
|
|
||||||
self.ids=ring_ids+piece_ids
|
|
||||||
self.inputs= {idx: {"id":id,"status":False} for idx,id in enumerate(self.ids)}
|
|
||||||
self.tapes = {idx: {"id": id, "status": False} for idx, id in enumerate(tape_ids)}
|
|
||||||
self.timer.start(1000)
|
self.timer.start(1000)
|
||||||
# setup test loop
|
# setup test loop
|
||||||
self.get_connection = self.components["digital_io"].out.connect(self.get)
|
self.get_connection = self.components["digital_io"].out.connect(self.get)
|
||||||
|
|
@ -48,22 +44,26 @@ class Test_Instructions(Test_Test):
|
||||||
self.svg_root = etree.parse(svg_path)
|
self.svg_root = etree.parse(svg_path)
|
||||||
self.svg_str = etree.tostring(self.svg_root)
|
self.svg_str = etree.tostring(self.svg_root)
|
||||||
self.svg_str=etree.tostring(self.svg_root)
|
self.svg_str=etree.tostring(self.svg_root)
|
||||||
|
|
||||||
|
self.monitored_ids=self.svg_root.xpath(f'''.//*[starts-with(@id, 'sensor_')]''')
|
||||||
|
|
||||||
|
self.tape_ids=self.svg_root.xpath(f'''.//*[starts-with(@id, 'tape_')]''')
|
||||||
|
|
||||||
self.done = False
|
self.done = False
|
||||||
return show
|
return show
|
||||||
|
|
||||||
def toggle_icons(self):
|
def toggle_icons(self):
|
||||||
self.flag = not self.flag
|
self.flag = not self.flag
|
||||||
|
|
||||||
for idx,tape in self.tapes.items():
|
for elem in self.tape_ids:
|
||||||
elem = self.svg_root.findall(f'''.//*[@id='{tape["id"]}']''')[0]
|
|
||||||
if self.flag:
|
if self.flag:
|
||||||
self.show_tape(elem)
|
self.show_tape(elem)
|
||||||
else:
|
else:
|
||||||
self.hide_tape(elem)
|
self.hide_tape(elem)
|
||||||
|
|
||||||
for idx,input in self.inputs.items():
|
for elem in self.monitored_ids:
|
||||||
elem = self.svg_root.findall(f'''.//*[@id='{input["id"]}']''')[0]
|
sensor_index = int(elem.attrib['id'].split("_")[1]) - 3
|
||||||
if input["status"]:
|
if self.inputs[sensor_index]:
|
||||||
self.show_ok(elem)
|
self.show_ok(elem)
|
||||||
self.show_icon(elem)
|
self.show_icon(elem)
|
||||||
else:
|
else:
|
||||||
|
|
@ -76,9 +76,9 @@ class Test_Instructions(Test_Test):
|
||||||
self.show_svg()
|
self.show_svg()
|
||||||
|
|
||||||
def show_ok(self,id):
|
def show_ok(self,id):
|
||||||
id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}ok.png"
|
id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}img/ok.png"
|
||||||
def show_ko(self,id):
|
def show_ko(self,id):
|
||||||
id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}arw-yel-down.png"
|
id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}img/arw-yel-down.png"
|
||||||
|
|
||||||
def show_icon(self,id):
|
def show_icon(self,id):
|
||||||
id.set("display", "inline")
|
id.set("display", "inline")
|
||||||
|
|
@ -87,7 +87,7 @@ class Test_Instructions(Test_Test):
|
||||||
id.set("display", "none")
|
id.set("display", "none")
|
||||||
|
|
||||||
def show_tape(self,id):
|
def show_tape(self,id):
|
||||||
id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}tape_black.png"
|
id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}img/tape_black.png"
|
||||||
id.set("display", "inline")
|
id.set("display", "inline")
|
||||||
|
|
||||||
def hide_tape(self,id):
|
def hide_tape(self,id):
|
||||||
|
|
@ -110,13 +110,14 @@ class Test_Instructions(Test_Test):
|
||||||
ok = True
|
ok = True
|
||||||
if len(data[0]["digital_io"])==0:
|
if len(data[0]["digital_io"])==0:
|
||||||
return
|
return
|
||||||
for sensor_index,sensor in enumerate(self.ids):
|
for sensor in self.monitored_ids:
|
||||||
|
sensor_index = int(sensor.attrib['id'].split("_")[1])-3
|
||||||
byte_idx=int(sensor_index/8)
|
byte_idx=int(sensor_index/8)
|
||||||
bit_idx=sensor_index%8
|
bit_idx=sensor_index%8
|
||||||
if data[0]["digital_io"][byte_idx][bit_idx]:
|
if data[0]["digital_io"][byte_idx][bit_idx]:
|
||||||
self.inputs[sensor_index]["status"]=True
|
self.inputs[sensor_index] = True
|
||||||
else:
|
else:
|
||||||
self.inputs[sensor_index]["status"] = False
|
self.inputs[sensor_index] = False
|
||||||
ok = False
|
ok = False
|
||||||
if ok:
|
if ok:
|
||||||
super().get([{
|
super().get([{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user