From: Dirk Koopman Date: Tue, 10 Oct 2017 11:56:16 +0000 (+0100) Subject: Send wind even if it hasn't changed X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;p=dweather.git Send wind even if it hasn't changed Always send wind even if it hasn't changed in order to update the wind rose. --- diff --git a/loop.pl b/loop.pl index 86a0935..e627dde 100755 --- a/loop.pl +++ b/loop.pl @@ -535,18 +535,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 while @last10minsr > ($windmins * $updatepermin); - } - else { - dbg "loop rec not changed" if isdbg 'chan'; - } + $o ||= {}; + # we always send wind even if it hasn't changed in order to update the wind rose. + $o->{Dir} ||= ($h{Dir} + 0); + $o->{Wind} ||= ($h{Wind} + 0); + $s = genstr($ts, 'r', $o); + push @last10minsr, $s; + shift @last10minsr while @last10minsr > ($windmins * $updatepermin); output_str($s, 0) if $s; } $ld->{last_h} = \%h;