]> dxcluster.org Git - dweather.git/commitdiff
Send wind even if it hasn't changed master
authorDirk Koopman <djk@tobit.co.uk>
Tue, 10 Oct 2017 11:56:16 +0000 (12:56 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 10 Oct 2017 11:56:16 +0000 (12:56 +0100)
Always send wind even if it hasn't changed in order to update the wind rose.

loop.pl

diff --git a/loop.pl b/loop.pl
index 86a0935904817a080119301a0869525c527e3601..e627dde79127b8a86f3f66a2cec460a97e6e46dc 100755 (executable)
--- a/loop.pl
+++ b/loop.pl
@@ -535,18 +535,13 @@ sub process
 
                } else {
                        my $o = gen_hash_diff($ld->{last_h}, \%h);
 
                } 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;
                        output_str($s, 0) if $s;
                }
                $ld->{last_h} = \%h;