99) $number=99; if ($number < 50) { // blue to green $g = floor(255 * ($number / 50)); $b = 120; $r = 0; } else { // green to yelow $r = 255; $g = floor(255 * ((50-$number%50) / 50)); $b = 0; } return sprintf("%02X%02X%02X",$r,$g,$b); } function printFreqPpmGain($freq,$ppm,$gain){ echo ""; echo ""; echo ""; echo ""; echo "
Freq:".$freq."MHzPPM:".$ppm."Gain:".$gain."
"; } function printBar($db){ for($i=0;$i<$GLOBALS["wfDbSize"];$i++) echo ' '; } function printListenFreq($position,$freq,$dbLevel,$afc){ $afcT=""; if ( is_numeric($afc) ) $afcT=" ".$afc." Hz"; echo "".$position." : ".$freq." MHz".$afcT." (".$dbLevel." dB)"; } function printSDR($fil){ if (($handle = @fopen($fil, "r")) !== FALSE) { $line = fgets($handle); $freq=$line{2}.$line{3}.$line{4}.".".$line{5}.$line{6}.$line{7}; $line = fgets($handle); $ppm=$line{2}.$line{3}; $line = fgets($handle); $gain=$line{2}.$line{3}; printFreqPpmGain($freq,$ppm,$gain); echo "
"; while (($line = fgets($handle)) !== false) { $values=explode(";",$line); echo ""; $p=ord($line{10}); $position=$values[$GLOBALS["wfMapping"]["lp"]-1]; $freq=$values[$GLOBALS["wfMapping"]["freq"]-1]; $freq=substr($freq,0,3).".".substr($freq,3,7); $afc=$values[$GLOBALS["wfMapping"]["afc"]-1]; $db=$values[$GLOBALS["wfMapping"]["db"]-1]; $dbLevel=ord($db{0}); printListenFreq($position,$freq,$dbLevel,$afc); printBar($db); echo "
"; } } else echo "NO SDR"; } echo " $value) { echo ""; } echo "
$i"; printSDR($value); echo "
"; ?>