add descriptions

This commit is contained in:
2024-05-08 15:18:09 -05:00
parent dc4cf5c222
commit faf33aede7
3 changed files with 64 additions and 14 deletions

31
run.py
View File

@@ -69,6 +69,7 @@ sensors = [0,0,0,0]
websocket_process = None
arm_updates = Queue()
animation_wait = False
arm_position = (0,0,0,0,0,0)
def arm_start_callback(res):
fprint("Arm action complete.")
@@ -165,10 +166,15 @@ def check_server():
for idx in range(len(cable_list)):
if cable_list[idx] is not False:
cabledata = jbs.get_position(str(idx))
fs = cabledata["fullspecs"]
tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": cabledata["brand"] }
if "image" in cabledata:
tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": cabledata["brand"], "image": cabledata["image"], "description": "Blah", "short_description": "Bla"}
else:
tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": cabledata["brand"], "description": "Blah", "short_description": "Bla"}
tmp1["image"] = cabledata["image"]
if "Product Overview" in fs and "Product Category" in fs["Product Overview"]:
tmp1["short_description"] = fs["Product Overview"]["Product Category"]
if "Product Overview" in fs and "Suitable Applications" in fs["Product Overview"]:
tmp1["description"] = fs["Product Overview"]["Suitable Applications"]
tmp.append(tmp1)
out = {"map": tmp}
fprint(out)
@@ -262,7 +268,7 @@ def check_server():
sleep(0.001) # Sleep to prevent tight loop
#sleep(0.001) # Sleep to prevent tight loop
@@ -448,6 +454,7 @@ def mainloop_server(pool):
global oldmode
global arm_updates
global animation_wait
global arm_position
if mode != oldmode:
print(" ***** Running mode:", mode, "***** ")
@@ -464,12 +471,18 @@ def mainloop_server(pool):
arm_updates.get()
ledsys.mainloop(None, ring_animation)
elif ring_animation is not None and real:
if animation_wait:
if not arm_updates.empty():
animation_wait = False
val = arm_updates.get()
if animation_wait and not arm_updates.empty():
animation_wait = False
val = None
while not arm_updates.empty():
tmp = arm_updates.get()
if type(tmp) != tuple:
val = tmp
else:
arm_position = tmp
if val is not None:
ledsys.mainloop(led_set_mode, ring_animation)
led_set_mode = None
led_set_mode = None
else:
pass
#fprint("Not triggering LED loop: no ring animation")