kopia lustrzana https://github.com/rs1729/RS
scan/decode: update to IQ decoders, sync test-branch
rodzic
b7a0c04ead
commit
36a2c0df85
|
@ -7,12 +7,25 @@
|
||||||
#mkfifo log.1
|
#mkfifo log.1
|
||||||
#mkfifo log.2
|
#mkfifo log.2
|
||||||
|
|
||||||
TERM="xfce4-terminal"
|
TERM="gnome-terminal"
|
||||||
|
|
||||||
$TERM --geometry=64x61+470+140 --hide-menubar -T term0 -H -e './scan_multi_rs.pl'
|
if [ $1 = "xfce4" ]; then
|
||||||
|
TERM="xfce4-terminal"
|
||||||
|
fi
|
||||||
|
|
||||||
$TERM --geometry=160x20+1000+836 --hide-menubar -T term3 -H -e 'cat log.2'
|
echo $TERM
|
||||||
$TERM --geometry=160x20+1000+488 --hide-menubar -T term2 -H -e 'cat log.1'
|
|
||||||
$TERM --geometry=160x20+1000+140 --hide-menubar -T term1 -H -e 'cat log.0'
|
|
||||||
|
|
||||||
|
if [ $TERM = "xfce4-terminal" ]; then
|
||||||
|
$TERM --geometry=64x61+270+140 --hide-menubar -T term0 -H -e './scan_multi_rs.pl'
|
||||||
|
|
||||||
|
$TERM --geometry=180x20+800+836 --hide-menubar -T term3 -H -e 'cat log.2'
|
||||||
|
$TERM --geometry=180x20+800+488 --hide-menubar -T term2 -H -e 'cat log.1'
|
||||||
|
$TERM --geometry=180x20+800+140 --hide-menubar -T term1 -H -e 'cat log.0'
|
||||||
|
else
|
||||||
|
$TERM --geometry=64x61+200+140 --hide-menubar -e 'bash -c "./scan_multi_rs.pl; read line"'
|
||||||
|
|
||||||
|
$TERM --geometry=180x20+800+880 --hide-menubar -e 'bash -c "cat log.2; read line"'
|
||||||
|
$TERM --geometry=180x20+800+510 --hide-menubar -e 'bash -c "cat log.1; read line"'
|
||||||
|
$TERM --geometry=180x20+800+140 --hide-menubar -e 'bash -c "cat log.0; read line"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,18 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use 5.010;
|
use 5.010;
|
||||||
|
|
||||||
|
##
|
||||||
|
## gcc scan_fft_pow.c -lm -o scan_pow
|
||||||
|
## gcc dft_detect.c -lm -o dft_detect
|
||||||
|
## #build decoders in RS/demod/mod/ and RS/imet/imet4iq.c
|
||||||
|
##
|
||||||
|
## #make FIFOs
|
||||||
|
## mkfifo /tmp/sdr.0; mkfifo log.0
|
||||||
|
## mkfifo /tmp/sdr.1; mkfifo log.1
|
||||||
|
## mkfifo /tmp/sdr.2; mkfifo log.2
|
||||||
|
## #use scan_multi.sh
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
my $verbose = 1;
|
my $verbose = 1;
|
||||||
my $stderr_null = " 2>/dev/null ";
|
my $stderr_null = " 2>/dev/null ";
|
||||||
|
@ -15,14 +27,14 @@ my $max_terms = 3;
|
||||||
my $log = "log";
|
my $log = "log";
|
||||||
my $sdr = "/tmp/sdr";
|
my $sdr = "/tmp/sdr";
|
||||||
|
|
||||||
my $ppm = 45;
|
my $ppm = 0; # set ppm offset of rtl-sdr
|
||||||
my $gain = 40.2;
|
my $gain = 20.7; # set gain, e.g. 40.2
|
||||||
|
my $center_freq = 403420e3; # off-center, rtl_sdr-mirrors ... e.g. 404620e3
|
||||||
|
|
||||||
my $if_sr = 48e3;
|
my $if_sr = 48e3;
|
||||||
my $decimate = 40; # 20..50 # 32*48000 = 1536000
|
my $decimate = 40; # 20..50 # 32*48000 = 1536000
|
||||||
my $band_sr = $if_sr * $decimate; # 40*48000 = 1920000
|
my $band_sr = $if_sr * $decimate; # 40*48000 = 1920000
|
||||||
|
|
||||||
my $center_freq = 404620e3; # off-center, rtl_sdr-mirrors ...
|
|
||||||
|
|
||||||
if ($ARGV[0]) {
|
if ($ARGV[0]) {
|
||||||
$band_sr = $ARGV[0];
|
$band_sr = $ARGV[0];
|
||||||
|
@ -47,16 +59,14 @@ my $str_rtlsdr = "rtl_sdr -g $gain -p ".$ppm." -f ".$center_freq." -s ".$band_sr
|
||||||
print $str_rtlsdr."\n";
|
print $str_rtlsdr."\n";
|
||||||
|
|
||||||
my $bps = 8; # rtl-sdr: 8bit
|
my $bps = 8; # rtl-sdr: 8bit
|
||||||
my $b2f_conv;
|
|
||||||
if ($bps == 16) { $b2f_conv = "convert_s16_f"; }
|
|
||||||
else { $b2f_conv = "convert_u8_f"; }
|
|
||||||
|
|
||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
|
|
||||||
my $iqraw = "rtlsdr.raw";
|
my $iqraw = "rtlsdr.raw";
|
||||||
system("$str_rtlsdr -n ".(8*$band_sr)." $iqraw");
|
my $ts = "-n ".(8*$band_sr);
|
||||||
|
system("$str_rtlsdr $ts $iqraw");
|
||||||
|
|
||||||
my $powfile = "peaks.txt";
|
my $powfile = "peaks.txt";
|
||||||
|
|
||||||
|
@ -66,33 +76,33 @@ system("python plot_fft_pow.py &");
|
||||||
|
|
||||||
my @rs_matrix;
|
my @rs_matrix;
|
||||||
|
|
||||||
$rs_matrix[2][0] = "dfm";
|
$rs_matrix[2][0] = "dfm"; # tn_DFM=2
|
||||||
$rs_matrix[2][1] = "9600"; # lp-filter bw
|
$rs_matrix[2][1] = "9600"; # lp-filter bw
|
||||||
$rs_matrix[2][2] = "./dfm09 --ecc --ptu -v"; # --auto ## DFM9 = -DFM
|
$rs_matrix[2][2] = "./dfm09mod --ecc --ptu -vv --IQ"; # --auto ## DFM9 = DFM
|
||||||
|
|
||||||
$rs_matrix[3][0] = "rs41";
|
$rs_matrix[3][0] = "rs41"; # tn_RS41=3
|
||||||
$rs_matrix[3][1] = "9600"; # lp-filter bw
|
$rs_matrix[3][1] = "9600"; # lp-filter bw
|
||||||
$rs_matrix[3][2] = "./rs41 --ecc2 --crc --ptu -vx";
|
$rs_matrix[3][2] = "./rs41mod --ptu2 -vx --IQ"; # --auto
|
||||||
|
|
||||||
$rs_matrix[4][0] = "rs92";
|
$rs_matrix[4][0] = "rs92"; # tn_RS92=4
|
||||||
$rs_matrix[4][1] = "9600";
|
$rs_matrix[4][1] = "9600";
|
||||||
$rs_matrix[4][2] = "./rs92 --ecc --crc -v"; # -e brdc / -a almanac
|
$rs_matrix[4][2] = "./rs92mod --ecc --crc -v --IQ"; # -e brdc / -a almanac
|
||||||
|
|
||||||
$rs_matrix[8][0] = "lms6";
|
$rs_matrix[5][0] = "m10"; # tn_M10=5
|
||||||
$rs_matrix[8][1] = "9600";
|
$rs_matrix[5][1] = "9600"; # scan: carrier offset
|
||||||
$rs_matrix[8][2] = "./lms6 --vit --ecc -v";
|
$rs_matrix[5][2] = "./m10mod -c --ptu -v --dc --IQ";
|
||||||
|
|
||||||
$rs_matrix[5][0] = "m10"; # scan: carrier offset
|
$rs_matrix[6][0] = "m20"; # tn_M20=6
|
||||||
$rs_matrix[5][1] = "9600";
|
$rs_matrix[6][1] = "9600"; # scan: carrier offset
|
||||||
$rs_matrix[5][2] = "./m10 -c -vv";
|
$rs_matrix[6][2] = "./mXXmod -c --ptu -v --dc --IQ";
|
||||||
|
|
||||||
$rs_matrix[6][0] = "imet1ab";
|
$rs_matrix[7][0] = "imet4"; # tn_IMET4=26
|
||||||
$rs_matrix[6][1] = "32000"; # > detect-bw
|
|
||||||
$rs_matrix[6][2] = "./imet1ab_dft -v";
|
|
||||||
|
|
||||||
$rs_matrix[7][0] = "imet4";
|
|
||||||
$rs_matrix[7][1] = "12000";
|
$rs_matrix[7][1] = "12000";
|
||||||
$rs_matrix[7][2] = "./imet1rs_dft -r";
|
$rs_matrix[7][2] = "./imet4iq -v --dc --lpIQ --iq";
|
||||||
|
|
||||||
|
$rs_matrix[8][0] = "lms6"; # tn_LMS6=8
|
||||||
|
$rs_matrix[8][1] = "9600";
|
||||||
|
$rs_matrix[8][2] = "./lms6Xmod --vit2 --ecc -v --IQ";
|
||||||
|
|
||||||
$rs_matrix[10][0] = "";
|
$rs_matrix[10][0] = "";
|
||||||
|
|
||||||
|
@ -120,17 +130,14 @@ while ($line = <$fh>) {
|
||||||
my $fq = $1;
|
my $fq = $1;
|
||||||
if ($verbose) { print "[ $fq ] "; }
|
if ($verbose) { print "[ $fq ] "; }
|
||||||
print $line; # no chomp
|
print $line; # no chomp
|
||||||
my $lp = $filter/($if_sr*2.0);
|
my $cmd = "$detect -t 10 --IQ $fq - $band_sr $bps $iqraw 2>/dev/null";
|
||||||
my $cmd = "cat $iqraw | csdr $b2f_conv | csdr shift_addition_cc ".(-$fq)." $stderr_null| ".
|
|
||||||
"csdr fir_decimate_cc $decimate 0.005 $stderr_null| csdr bandpass_fir_fft_cc -$lp $lp 0.02 $stderr_null| ".
|
|
||||||
"csdr fmdemod_quadri_cf | csdr limit_ff | csdr convert_f_s16 | ".
|
|
||||||
"sox -t raw -r $if_sr -b 16 -e signed - -t wav - 2>/dev/null | $detect -t 10 2>/dev/null";
|
|
||||||
#if ($verbose) { print $cmd."\n"; }
|
#if ($verbose) { print $cmd."\n"; }
|
||||||
system("$cmd");
|
system("$cmd");
|
||||||
$ret = $? >> 8;
|
$ret = $? >> 8;
|
||||||
if ($ret & 0x80) {
|
if ($ret & 0x80) {
|
||||||
$ret = - (0x100 - $ret); # ($ret & 0x80) = core dump
|
$ret = - (0x100 - $ret); # ($ret & 0x80) = core dump
|
||||||
}
|
}
|
||||||
|
if (abs($ret) == 26) { $ret = 7; } # imet4
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
push @peakarray, $fq;
|
push @peakarray, $fq;
|
||||||
push @rs_array, $ret;
|
push @rs_array, $ret;
|
||||||
|
@ -163,20 +170,15 @@ for ($j = 0; $j < $num_peaks; $j++) {
|
||||||
$rs = $rs_matrix[$idx][0];
|
$rs = $rs_matrix[$idx][0];
|
||||||
$filter = $rs_matrix[$idx][1];
|
$filter = $rs_matrix[$idx][1];
|
||||||
my $inv = ($rs_array[$j] < 0 ? "-i" : "");
|
my $inv = ($rs_array[$j] < 0 ? "-i" : "");
|
||||||
if ($idx == 5 || $idx == 7) { $inv = ""; } # || $idx==8
|
if ($idx >= 5 && $idx <= 7) { $inv = ""; } # || $idx==8
|
||||||
$decoder = sprintf("%s %s", $rs_matrix[$idx][2], $inv);
|
$decoder = sprintf("%s", $rs_matrix[$idx][2]);
|
||||||
|
|
||||||
my $lp = $filter/($if_sr*2.0);
|
|
||||||
|
|
||||||
my $pid = fork();
|
my $pid = fork();
|
||||||
die if not defined $pid;
|
die if not defined $pid;
|
||||||
if (not $pid) {
|
if (not $pid) {
|
||||||
my $rs_str = sprintf("%s_%.0fkHz", $rs, ($center_freq+$band_sr*$peakarray[$j])*1e-3);
|
my $rs_str = sprintf("%s_%.0fkHz", $rs, ($center_freq+$band_sr*$peakarray[$j])*1e-3);
|
||||||
if ($verbose) { print "\nrs: <".$rs_str.">\n"; }
|
if ($verbose) { print "\nrs: <".$rs_str.">\n"; }
|
||||||
my $cmd = "cat $sdr.$j | csdr $b2f_conv | csdr shift_addition_cc ".(-$peakarray[$j])." $stderr_null| ".
|
my $cmd = "$decoder ".($peakarray[$j])." $inv - $band_sr $bps $sdr.$j 2>/dev/null > $log.$j";
|
||||||
"csdr fir_decimate_cc $decimate 0.005 $stderr_null| csdr bandpass_fir_fft_cc -$lp $lp 0.02 $stderr_null| ".
|
|
||||||
"csdr fmdemod_quadri_cf | csdr limit_ff | csdr convert_f_s16 | ".
|
|
||||||
"sox -t raw -r $if_sr -b 16 -e signed - -t wav - 2>/dev/null | $decoder 2>/dev/null > $log.$j";
|
|
||||||
if ($verbose) { print $cmd."\n"; }
|
if ($verbose) { print $cmd."\n"; }
|
||||||
system("$cmd");
|
system("$cmd");
|
||||||
exit;
|
exit;
|
||||||
|
@ -189,9 +191,12 @@ for ($j = 0; $j < $num_peaks; $j++) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
|
$ts = "-n ".(120*$band_sr);
|
||||||
|
#$ts = "";
|
||||||
|
|
||||||
if ($num_peaks > 0)
|
if ($num_peaks > 0)
|
||||||
{
|
{
|
||||||
my $cmd = "$str_rtlsdr -n ".(60*$band_sr)." - $tee";
|
my $cmd = "$str_rtlsdr $ts - $tee";
|
||||||
if ($verbose) { print $cmd."\n"; }
|
if ($verbose) { print $cmd."\n"; }
|
||||||
system("$cmd"); # timeout
|
system("$cmd"); # timeout
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue