X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=loop.pl;h=e287ce5913b0370d0aa32345ac6348b42b343541;hb=b5935e862dc6dd1a6b6154905bac6db8836132d6;hp=fe9165779d3ac551e9b0a66a9ecb5b943e9f016b;hpb=66549cb3124dc06a95960142da8c364fae031487;p=dweather.git diff --git a/loop.pl b/loop.pl index fe91657..e287ce5 100755 --- a/loop.pl +++ b/loop.pl @@ -42,8 +42,9 @@ our $WS = {}; # websocket connections our $ld = {}; our @last10minsr = (); our @last5daysh = (); -our $windmins = 5; # no of minutes of wind data for the windrose +our $windmins = 2; # 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 $updatepermin = 60 / 2.5; # no of updates per minute our $loop_count; # how many LOOPs we have done, used as start indicator @@ -164,6 +165,7 @@ our $dlog = SMGLog->new("day"); dbg "before next tick"; Mojo::IOLoop->next_tick(sub { loop() }); dbg "before app start"; +app->secrets([qw(Here's something that's really seakrett)]); app->start; dbg "after app start"; @@ -486,9 +488,13 @@ sub process } else { my $o = gen_hash_diff($ld->{last_h}, \%h); if ($o) { + $o->{Dir} ||= $h{Dir}; + $o->{Wind} ||= $h{Wind}; + $o->{Dir} += 0; + $o->{Wind} += 0; $s = genstr($ts, 'r', $o); push @last10minsr, $s; - shift @last10minsr if @last10minsr > 240; + shift @last10minsr while @last10minsr > ($windmins * $updatepermin); } else { dbg "loop rec not changed" if isdbg 'chan';