From: Dirk Koopman Date: Sun, 25 Jan 2015 22:02:30 +0000 (+0000) Subject: show when ws not connected X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b7ccfa8837f5ec3fb2c43741b85fa4658c7b1b9;p=dweather.git show when ws not connected --- diff --git a/loop.pl b/loop.pl index bb9582e..2e95491 100755 --- a/loop.pl +++ b/loop.pl @@ -145,6 +145,8 @@ dbg '***'; dbg "*** starting $0"; dbg '***'; +read_ld(); + our $dlog = SMGLog->new("day"); dbg "before next tick"; Mojo::IOLoop->next_tick(sub { loop() }); @@ -168,8 +170,6 @@ exit 0; sub loop { - read_ld(); - dbg "last_min: " . scalar gmtime($ld->{last_min}); dbg "last_hour: " . scalar gmtime($ld->{last_hour}); @@ -419,6 +419,7 @@ sub process @{$ld->{wind_hour}} = (); @{$ld->{wind_min}} = (); + output_str($s, 1) if $s; write_ld(); } elsif ($ts >= $ld->{last_min} + 60) { @@ -446,6 +447,7 @@ sub process $ld->{last_min} = int($ts/60)*60; @{$ld->{wind_min}} = (); + output_str($s, 1) if $s; write_ld(); } else { @@ -456,8 +458,8 @@ sub process else { dbg "loop rec not changed" if isdbg 'chan'; } + output_str($s, 0) if $s; } - output_str($s) if $s; $ld->{last_h} = \%h; ++$loop_count; } else { @@ -482,9 +484,11 @@ sub genstr sub output_str { my $s = shift; + my $logit = shift; + dbg $s; # say $s; - $dlog->writenow($s); + $dlog->writenow($s) if $logit; foreach my $ws (keys $WS) { my $tx = $WS->{$ws}; if ($tx) { @@ -701,14 +705,14 @@ __DATA__
@@ -776,6 +785,8 @@ __DATA__ Month: Year: +
+