From 3d808f88911e7614bb92f1a6d477ffb54651d5c3 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Tue, 10 Oct 2017 12:56:16 +0100 Subject: [PATCH] Send wind even if it hasn't changed Always send wind even if it hasn't changed in order to update the wind rose. --- loop.pl | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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; -- 2.43.0