From 7faf6e4d7297e6046392af4e7a0c225f3c080f9d Mon Sep 17 00:00:00 2001 From: Russ Handorf Date: Fri, 20 Apr 2018 17:50:27 -0400 Subject: [PATCH] one weird bug possibly fixed --- server.py | 12 ++++++++++++ sniffer.pl | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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)) { -- 2.34.1