@@ -138,7 +138,7 @@ B This is where you can set up some meaningful strings for the up to 8 transmitters allowed with the wireless Vantage Pro. -B This controls how often you want messages written to syslog in the event of a console alarm. This number represents the number of passes through the data collection loop. On most systems this will be appoximately 1.1 seconds of real time. Your results will depend on system load, available memory, processor speed, etc. There is a sleep call in the main loop which prevents more than one pass per second. +B This controls how often you want messages written to syslog in the event of a console alarm. This number represents the number of passes through the data collection loop. On most systems this will be appoximately 1.02 seconds of real time. Your results will depend on system load, available memory, processor speed, etc. =cut @@ -383,7 +383,6 @@ if($minute == 0 && $hour == 12 && $clock_set == 0){ set_clock();}; if($minute == 1 && $hour == 12){ $clock_set = 0;}; get_data(); # The data collection subroutine - sleep(1); # No more than once per second, please }; close(DAILY); syslog("info", "$name exiting."); @@ -851,12 +850,12 @@ push(@bar_vals, $bar); # Place current value on top of stack $old_bar = $bar_vals[0]; # Read bottom value from stack $bar_diff = $bar - $old_bar; - if($#bar_vals > 11998){ shift(@bar_vals); }; - if($bar_diff < -.05){ $trend = "FR"; }; - if($bar_diff >= -.05 && $bar_diff < 0){ $trend = "FS"; }; - if($bar_diff == 0){ $trend = "ST"; }; - if($bar_diff > 0 && $bar_diff <= .05){ $trend = "RS"; }; - if($bar_diff > .05){ $trend = "RR"; }; + if($#bar_vals > 10548){ shift(@bar_vals); }; + if($bar_diff < -.05){ $trend = "FR"; }; + if($bar_diff > -.06 && $bar_diff < -.02){ $trend = "FS"; }; + if($bar_diff > -.03 && $bar_diff < .03){ $trend = "ST"; }; + if($bar_diff > .02 && $bar_diff < .06){ $trend = "RS"; }; + if($bar_diff > .05){ $trend = "RR"; }; }; }; $intemp = hex("$data[11]$data[10]"); @@ -1035,6 +1034,9 @@ $alarm0 = hex("$data[71]"); $alarm1 = hex("$data[72]"); $alarm2 = hex("$data[73]"); +# The station does not sleep if there is a console alarm. +# So, we will sleep in order to keep the loop timing consistent +if($alarm0 > 0 || $alarm1 > 0 || $alarm2 > 0){ sleep(1); }; if($alarm0 & 1){$bar_fall_alarm++; }else{$bar_fall_alarm = 0; }; if($alarm0 & 2){$bar_rise_alarm++; }else{$bar_rise_alarm = 0; }; if($alarm0 & 4){$low_intemp_alarm++; }else{$low_intemp_alarm = 0; };