Added facility to record the maximum wind gust and time per day.
Change the accuracy of the barometer from int to one dec pl.
Fix the size of the columns in the UI to stop the constant changing of widths
with data changes
# Common ones
$tmp = unpack("s", substr $blk,7,2) / 1000;
# Common ones
$tmp = unpack("s", substr $blk,7,2) / 1000;
- $h{Pressure} = nearest(1, in2mb($tmp));
+ $h{Pressure} = nearest(0.1, in2mb($tmp));
$tmp = unpack("s", substr $blk,9,2) / 10;
$h{Temp_In} = nearest(0.1, f2c($tmp));
$tmp = unpack("s", substr $blk,9,2) / 10;
$h{Temp_In} = nearest(0.1, f2c($tmp));
my $ts = time;
my $s;
my $dayno = int($ts/86400);
my $ts = time;
my $s;
my $dayno = int($ts/86400);
+ my $writeld;
+ my $cycledata;
+
if ($dayno > $ld->{last_day}) {
if ($dayno > $ld->{last_day}) {
- $ld->{Temp_Out_Max} = $ld->{Temp_Out_Min} = $temp;
- $ld->{Temp_Out_Max_T} = $ld->{Temp_Out_Min_T} = clocktime($ts, 0);
+ $ld->{Temp_Out_Max} = $ld->{Temp_Out_Min} = $ld->{Wind_Max} = $temp;
+ $ld->{Temp_Out_Max_T} = $ld->{Temp_Out_Min_T} = $ld->{Wind_Max_T} = clocktime($ts, 0);
$ld->{last_day} = $dayno;
$ld->{last_day} = $dayno;
- write_ld();
- cycle_loop_data_files();
+ ++$writeld;
+ ++$cycledata;
}
if ($temp > $ld->{Temp_Out_Max}) {
}
if ($temp > $ld->{Temp_Out_Max}) {
- $ld->{Temp_Out_Max} = $temp;
- $ld->{Temp_Out_Max_T} = clocktime($ts, 0);
- write_ld();
+ $h{Temp_Out_Max} = $ld->{Temp_Out_Max} = $temp;
+ $h{Temp_Out_Max_T} = $ld->{Temp_Out_Max_T} = clocktime($ts, 0);
+ ++$writeld;
}
if ($temp < $ld->{Temp_Out_Min}) {
}
if ($temp < $ld->{Temp_Out_Min}) {
- $ld->{Temp_Out_Min} = $temp;
- $ld->{Temp_Out_Min_T} = clocktime($ts, 0);
- write_ld();
+ $h{Temp_Out_Min} = $ld->{Temp_Out_Min} = $temp;
+ $h{Temp_Out_Min_T} = $ld->{Temp_Out_Min_T} = clocktime($ts, 0);
+ ++$writeld;
+ }
+
+ if ($wind->{w} > $ld->{Wind_Max}) {
+ $h{Wind_Max} = $ld->{Wind_Max} = $wind->{w};
+ $h{Wind_Max_T} = $ld->{Wind_Max_T} = clocktime($ts, 0);
+ ++$writeld;
}
if ($ts >= $ld->{last_hour} + 1800) {
}
if ($ts >= $ld->{last_hour} + 1800) {
$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{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};
- $h{Temp_Out_Max_T} = $ld->{Temp_Out_Max_T};
- $h{Temp_Out_Min_T} = $ld->{Temp_Out_Min_T};
-
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}});
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}});
$h{Dir_1m} = nearest(1, $a->{d});
($h{Rain_1m}, $h{Rain_1h}, $h{Rain_24h}) = calc_rain($rain);
$h{Dir_1m} = nearest(1, $a->{d});
($h{Rain_1m}, $h{Rain_1h}, $h{Rain_24h}) = calc_rain($rain);
}
$ld->{last_rain_min} = $ld->{last_rain_hour} = $rain;
}
$ld->{last_rain_min} = $ld->{last_rain_hour} = $rain;
+ $h{Temp_Out_Max} = $ld->{Temp_Out_Max};
+ $h{Temp_Out_Max_T} = $ld->{Temp_Out_Max_T};
+ $h{Temp_Out_Min} = $ld->{Temp_Out_Min};
+ $h{Temp_Out_Min_T} = $ld->{Temp_Out_Min_T};
+ $h{Wind_Max} = $ld->{Wind_Max};
+ $h{Wind_Max_T} = $ld->{Wind_Max_T};
$last_hour_h = {%h};
$s = genstr($ts, 'h', \%h);
$last_hour_h = {%h};
$s = genstr($ts, 'h', \%h);
push @last5daysh, $s;
shift @last5daysh if @last5daysh > 5*24;
}
push @last5daysh, $s;
shift @last5daysh if @last5daysh > 5*24;
}
} elsif ($ts >= $ld->{last_min} + 60) {
my $a = wind_average(@{$ld->{wind_min}});
} elsif ($ts >= $ld->{last_min} + 60) {
my $a = wind_average(@{$ld->{wind_min}});
($h{Rain_1m}, $h{Rain_1h}, $h{Rain_24h}) = calc_rain($rain);
}
$ld->{last_rain_min} = $rain;
($h{Rain_1m}, $h{Rain_1h}, $h{Rain_24h}) = calc_rain($rain);
}
$ld->{last_rain_min} = $rain;
$h{Temp_Out_Max} = $ld->{Temp_Out_Max};
$h{Temp_Out_Max} = $ld->{Temp_Out_Max};
- $h{Temp_Out_Min} = $ld->{Temp_Out_Min};
$h{Temp_Out_Max_T} = $ld->{Temp_Out_Max_T};
$h{Temp_Out_Max_T} = $ld->{Temp_Out_Max_T};
+ $h{Temp_Out_Min} = $ld->{Temp_Out_Min};
$h{Temp_Out_Min_T} = $ld->{Temp_Out_Min_T};
$h{Temp_Out_Min_T} = $ld->{Temp_Out_Min_T};
+ $h{Wind_Max} = $ld->{Wind_Max};
+ $h{Wind_Max_T} = $ld->{Wind_Max_T};
$last_min_h = {%h};
$s = genstr($ts, 'm', \%h);
$last_min_h = {%h};
$s = genstr($ts, 'm', \%h);
@{$ld->{wind_min}} = ();
output_str($s, 1) if $s;
@{$ld->{wind_min}} = ();
output_str($s, 1) if $s;
} else {
my $o = gen_hash_diff($ld->{last_h}, \%h);
} else {
my $o = gen_hash_diff($ld->{last_h}, \%h);
output_str($s, 0) if $s;
}
$ld->{last_h} = \%h;
output_str($s, 0) if $s;
}
$ld->{last_h} = \%h;
+ write_ld() if $writeld;
+ cycle_loop_data_files() if $cycledata;
++$loop_count;
} else {
dbg "CRC check failed for LOOP data!";
++$loop_count;
} else {
dbg "CRC check failed for LOOP data!";
<br><br>
<table class="table">
<tr>
<br><br>
<table class="table">
<tr>
- <th>Time:</th><td><span id="tm"> </span></td>
- <th>Sunrise:</th><td><span id="Sunrise"> </span></td>
- <th>Sunset:</th><td><span id="Sunset"> </span></td>
- <th>Console Volts:</th><td><span id="Batt_Console"> </span></td>
- <th>TX Battery OK:</th><td><span id="Batt_TX_OK"> </span></td>
+ <th width="7%">Time:</th><td width="7%"><span id="tm"> </span></td>
+ <th width="7%">Sunrise:</th><td width="7%"><span id="Sunrise"> </span></td>
+ <th width="7%">Sunset:</th><td width="7%"><span id="Sunset"> </span></td>
+ <th width="7%">Console Volts:</th><td width="7%"><span id="Batt_Console"> </span></td>
+ <th width="7%">TX Battery OK:</th><td width="7%"><span id="Batt_TX_OK"> </span></td>
- <th>Pressure:</th><td><span id="Pressure"> </span></td>
+ <th>Pressure:</th><td><span id="Pressure"> </span> mb</td>
<th>Trend:</th><td><span id="Pressure_Trend_txt"> </span></td>
</tr>
<tr>
<th>Trend:</th><td><span id="Pressure_Trend_txt"> </span></td>
</tr>
<tr>
- <th>Temperature in:</th><td> <span id="Temp_In"> </span></td>
- <th>Humidity:</th><td> <span id="Humidity_In"> </span></td>
+ <th>Temperature in:</th><td> <span id="Temp_In"> </span> °C</td>
+ <th>Humidity:</th><td> <span id="Humidity_In"> </span> %</td>
- <tr><th>Temperature out:</th><td> <span id="Temp_Out"> </span></td>
- <th>Min:</th><td> <span id="Temp_Out_Min"> </span> @ <span id="Temp_Out_Min_T"> </span></td>
- <th>Max:</th><td> <span id="Temp_Out_Max"> </span> @ <span id="Temp_Out_Max_T"> </span></td>
- <th>Humidity:</th><td> <span id="Humidity_Out"> </span></td>
- <th>Dew Point:</th><td> <span id="Dew_Point"> </span></td>
+ <tr><th>Temperature out:</th><td> <span id="Temp_Out"> </span> °C</td>
+ <th>Min:</th><td> <span id="Temp_Out_Min"> </span> °C @ <span id="Temp_Out_Min_T"> </span></td>
+ <th>Max:</th><td> <span id="Temp_Out_Max"> </span> °C @ <span id="Temp_Out_Max_T"> </span></td>
+ <th>Humidity:</th><td> <span id="Humidity_Out"> </span> %</td>
+ <th>Dew Point:</th><td> <span id="Dew_Point"> </span> °C</td>
- <tr><th>Wind:</th><td><span id="Wind"> </span> m/s @ <span id="Dir"> </span> deg</td>
- <th>Wind Dir Minute Avg:</th><td> <span id="Dir_1m"> </span></td>
- <th>Wind Speed Minute Avg:</th><td> <span id="Wind_1m"> </span></td>
+ <tr><th>Wind:</th><td><span id="Dir"> </span> ° @ <span id="Wind"> </span> m/s</td>
+ <th>Wind Minute Avg:</th><td> <span id="Dir_1m"> </span> ° @ <span id="Wind_1m"> </span> m/s </td>
+ <th>Day Max Speed:</th><td> <span id="Wind_Max"> </span> m/s @ <span id="Wind_Max_T"> </span></td>
- <th>Rain 30mins:</th><td> <span id="Rain_1h"> </span></td>
- <th>Day:</th><td> <span id="Rain_Day"> </span></td>
- <th>24hrs:</th><td> <span id="Rain_24h"> </span></td>
- <th>Month:</th><td> <span id="Rain_Month"> </span></td>
- <th>Year:</th><td> <span id="Rain_Year"> </span></td>
+ <th>Rain 30mins:</th><td> <span id="Rain_1h"> </span> mm</td>
+ <th>Day:</th><td> <span id="Rain_Day"> </span> mm</td>
+ <th>24hrs:</th><td> <span id="Rain_24h"> </span> mm</td>
+ <th>Month:</th><td> <span id="Rain_Month"> </span> mm</td>
+ <th>Year:</th><td> <span id="Rain_Year"> </span> mm</td>