diff --git a/DisplayNode/WorkerNetwork.py b/DisplayNode/WorkerNetwork.py index af05b90fdaa48f119d9593cf130a307d516da3b6..435eb10af9f16f86fa9b38b899b6ae3f78764c35 100644 --- a/DisplayNode/WorkerNetwork.py +++ b/DisplayNode/WorkerNetwork.py @@ -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() +