X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=loop.pl;fp=loop.pl;h=fe9165779d3ac551e9b0a66a9ecb5b943e9f016b;hb=66549cb3124dc06a95960142da8c364fae031487;hp=1a677d52360866d28f8e247bffbf1ca7dd406e21;hpb=cbf57212d7962476d2f2e7bb966283ab4fc1e5ba;p=dweather.git diff --git a/loop.pl b/loop.pl index 1a677d5..fe91657 100755 --- a/loop.pl +++ b/loop.pl @@ -42,6 +42,8 @@ our $WS = {}; # websocket connections our $ld = {}; our @last10minsr = (); our @last5daysh = (); +our $windmins = 5; # no of minutes of wind data for the windrose +our $histdays = 5; # no of days of (half)hour data to search for main graph our $loop_count; # how many LOOPs we have done, used as start indicator @@ -152,8 +154,11 @@ read_ld(); my $tnow = time; my $dayno = int ($tnow/86400); -@last5daysh = grab_history(SMGLog->new("day"), "h", $tnow-(86400*5), $_) for ($dayno-4, $dayno-3, $dayno-2, $dayno-1, $dayno); -@last10minsr = map {my ($t, $js) = split(/\s/, $_, 2); $js} grab_history(SMGLog->new("debug"), "r", $tnow-(60*3), $dayno); +for (my $i = 0-$histdays; $i < 0; ++$i ) { + push @last5daysh, grab_history(SMGLog->new("day"), "h", $tnow-(86400*$histdays), $dayno+$i+1); +} +@last10minsr = map {my ($t, $js) = split(/\s/, $_, 2); $js} grab_history(SMGLog->new("debug"), "r", $tnow-(60*$windmins), $dayno); +dbg sprintf("last5days = %d last10mins = %d", scalar @last5daysh, scalar @last10minsr); our $dlog = SMGLog->new("day"); dbg "before next tick";