Commit 4daf9820 authored by Caughlin Bohn's avatar Caughlin Bohn
Browse files

Checksum fix to prevent multilooping

parent b2d545d3
......@@ -113,43 +113,51 @@ s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(1)
#conn, addr = s.accept()
lastItem = 0
while 1:
conn, addr = s.accept()
data = conn.recv(1024)
conn.close()
tempData = data.split(" ")
iter = 0
while iter < int(tempData[2]):
start = NodePath[tempData[0]]
end = NodePath[tempData[1]]
if tempData[3] != lastItem:
print("I am lying about loops" , data)
for i in range(int(tempData[2])):
print(data,iter)
start = NodePath[tempData[0]]
end = NodePath[tempData[1]]
### To do random
start_path = find_path(NetPath,start,end)
path = []
try:
for i in range(0,len(start_path)-1):
path.append(start_path[i]+start_path[i+1])
except:
print("empty path")
try:
for a in path:
data = 128
for i in NetLights.get(a):
r,g,b = 255,0,0
strip.setPixelColor(i,Color(r,g,b))
strip.show()
time.sleep(0.001)
for i in range(0,100):
strip.setPixelColor(i, Color(0,0,0))
strip.show()
time.sleep(0.05)
iter += 1
except Exception as e:
print(str(e))
x=0
print("ERROR")
conn.close()
### To do random
start_path = find_path(NetPath,start,end)
path = []
try:
for i in range(0,len(start_path)-1):
path.append(start_path[i]+start_path[i+1])
except:
print("empty path")
try:
for a in path:
for i in NetLights.get(a):
r,g,b = 255,0,0
strip.setPixelColor(i,Color(r,g,b))
strip.show()
time.sleep(0.005)
for i in range(0,100):
strip.setPixelColor(i, Color(0,0,0))
strip.show()
time.sleep(0.05)
iter += 1
except Exception as e:
print(str(e))
x=0
print("ERROR")
lastItem = tempData[3]
#conn.close()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment