From: Russ Handorf Date: Fri, 20 Apr 2018 21:50:27 +0000 (-0400) Subject: one weird bug possibly fixed X-Git-Url: http://russells-world.com/code/?a=commitdiff_plain;h=7faf6e4d7297e6046392af4e7a0c225f3c080f9d;p=led-wall.git one weird bug possibly fixed --- diff --git a/server.py b/server.py index 3f9bc55..467cf0f 100644 --- a/server.py +++ b/server.py @@ -26,9 +26,20 @@ pixels = [] for i in range(1024): pixels.append(tuple((0,0,0))) +pixel_status = [] +for i in range(1024): + pixel_status.append(0) + strip.show() print "Starting Server" + +def led_timeout(strip,pixel): + pixel_status[pixel] = time.time() + 30 + for i in range(1024): + if (pixel_status[i] < time.time()) & (pixel_status[i] != 0): + strip.setPixelColor(i, Color(0,0,0)) + while True: data, addr = server.recvfrom(1024) if data: @@ -39,6 +50,7 @@ while True: red=pixel_color[0] green=pixel_color[1] blue=pixel_color[2] + led_timeout(strip,int(color[1])) if (int(elements[1])==0): strip.setPixelColor(int(color[1]), Color(0,0,0)) if color[0]=="R": diff --git a/sniffer.pl b/sniffer.pl index 1401de2..758d3a1 100755 --- a/sniffer.pl +++ b/sniffer.pl @@ -55,7 +55,7 @@ Net::Pcap::loop($object, -1, \&packets, $server) || sub led_timeout { my ($user_data, $pixel) = @_; - $led_timer[$pixel] = time() + 15; + $led_timer[$pixel] = time() + 30; for (my $i=0; $i<1024; $i++) { if (($led_timer[$i] < time()) && ($led_timer[$i]>0)) {