}
my $tmp;
+ my $temp;
my $rain;
my %h;
$tmp = unpack("s", substr $blk,9,2) / 10;
$h{Temp_In} = nearest(0.1, f2c($tmp));
- $tmp = unpack("s", substr $blk,12,2) / 10;
- $h{Temp_Out} = nearest(0.1, f2c($tmp));
+ $temp = nearest(0.1, f2c(unpack("s", substr $blk,12,2) / 10));
+ $h{Temp_Out} = $temp;
$tmp = unpack("C", substr $blk,14,1);
$h{Wind} = nearest(0.1, mph2mps($tmp));
my $ts = time;
my $s;
+ my $dayno = int($ts/86400);
+ if ($dayno > $ld->{last_day}) {
+ $ld->{Temp_Out_Max} = $ld->{Temp_Out_Min} = $temp;
+ $ld->{last_day} = $dayno;
+ }
+ $ld->{Temp_Out_Max} = $temp if $temp > $ld->{Temp_Out_Max};
+ $ld->{Temp_Out_Min} = $temp if $temp < $ld->{Temp_Out_Min};
+
if ($ts >= $ld->{last_hour} + 3600) {
$h{Pressure_Trend} = unpack("C", substr $blk,3,1);
$h{Pressure_Trend_txt} = $bar_trend{$h{Pressure_Trend}};
$h{Sunrise} =~ s/(\d{2})(\d{2})/$1:$2/;
$h{Sunset} = sprintf( "%04d", unpack("S", substr $blk,93,2) );
$h{Sunset} =~ s/(\d{2})(\d{2})/$1:$2/;
+ $h{Temp_Out_Max} = $ld->{Temp_Out_Max};
+ $h{Temp_Out_Min} = $ld->{Temp_Out_Min};
if ($loop_count) { # i.e not the first
my $a = wind_average(scalar @{$ld->{wind_hour}} ? @{$ld->{wind_hour}} : {w => $h{Wind}, d => $h{Dir}});
}
$ld->{last_rain_min} = $rain;
+ $h{Temp_Out_Max} = $ld->{Temp_Out_Max};
+ $h{Temp_Out_Min} = $ld->{Temp_Out_Min};
+
$s = genstr($ts, 'm', \%h);
$ld->{last_min} = int($ts/60)*60;
$ld->{rain24} ||= [];
my $Rain_1h = nearest(0.1, $rain >= $ld->{last_rain_hour} ? $rain - $ld->{last_rain_hour} : $rain); # this is the rate for this hour, so far
- my $rm = $rain >= $ld->{last_rain_min} ? $rain - $ld->{last_rain_min} : $rain;
+ my $rm = nearest(0.1, $rain >= $ld->{last_rain_min} ? $rain - $ld->{last_rain_min} : $rain);
my $Rain_1m = nearest(0.1, $rm);
push @{$ld->{rain24}}, $Rain_1m;
$ld->{rain_24} += $rm;