[arm-allstar] saytime.pl modification for exactly 100 degree temperature
    Lawrence Roney 
    roney at chiarappa.com
       
    Sun Jul 16 14:59:03 EDT 2017
    
    
  
Hi,
 
Out here in the Nevada desert, we are using new temperature function that is built into the /usr/local/sbin/saytime.pl script.
 
We found a little glitch.  If the temperature is exactly 100 degrees, it will only say "10 degrees"
 
I added a few lines as a work around.  There is likely much cleaner and structured way to do this with an ELSE statement vs. a GOTO tag, but I will let the more accomplished perl programmers figure that out. 
 
Thanks Doug for everything you do to support the hobby and Allstar!
 
Lawrence - N6YFN
Henderson Amateur Radio Club
www.W7HEN.com
 
--- Previous lines snipped ---
if ($localwxtemp ne "" ) {
    $FNAME = $FNAME . $base . "/wx/temperature.gsm ";
 
    if ($localwxtemp < -1 ) {
        $FNAME = $FNAME . $base . "/digits/minus.gsm ";
        $localwxtemp=int(abs($localwxtemp));
    } else {
        $localwxtemp=int($localwxtemp);
    }
 
#
# Next 6 lines added if temperature is exactly 100 degrees.
# Also added a goto CONCATENATE tag to skip the rest of the temperature parsing
#
    if ($localwxtemp == 100) {
        $FNAME = $FNAME . $base . "/digits/" . "1" . ".gsm ";
        $FNAME = $FNAME . $base . "/digits/" . "hundred" . ".gsm ";
        $FNAME = $FNAME . $base . "/degrees.gsm ";
        goto CONCATENATE;
    }
 
    if ($localwxtemp > 100) {
        $FNAME = $FNAME . $base . "/digits/" . "1" . ".gsm ";
        $FNAME = $FNAME . $base . "/digits/" . "hundred" . ".gsm ";
        $localwxtemp=($localwxtemp-100);
    }
 
    if ($localwxtemp < 20) {
        $FNAME = $FNAME . $base . "/digits/" . $localwxtemp . ".gsm ";
    } else {
        $localwxtemp10 = substr ($localwxtemp,0,1) . "0";
        $FNAME = $FNAME . $base . "/digits/" . $localwxtemp10 . ".gsm ";
        $localwxtemp1 = substr ($localwxtemp,1,1);
        if ($localwxtemp1 > 0) {
          $FNAME = $FNAME . $base . "/digits/" . $localwxtemp1 . ".gsm ";
        }
    }
    $FNAME = $FNAME . $base . "/degrees.gsm ";
}
}
 
CONCATENATE:
#
# Following lines concatenate all of the files to one output file
#
@proglist = ("cat " . $FNAME . " > " . $outdir . "/current-time.gsm");
system(@proglist);
#
# Following lines process the output file with sox to lower the volume
# negative numbers lower than -1 reduce the volume - see Sox man page
# Other processing could be done if necessary
#
# REMOVED V1.5 - use telemetry levels
#
#@proglist = ("nice -19 sox --temp /tmp " . $outdir . "/temp.gsm " . $outdir . "/current-time.gsm vol -0.35");
#system(@proglist);
#
# Say the time on the local node
#
@proglist = ("/usr/sbin/asterisk -rx \"rpt localplay " . $mynode . " " . $outdir . "/current-time\"");
system(@proglist);
 
# end of saytime.pl
    
    
More information about the ARM-allstar
mailing list