mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-07-26 10:42:26 -04:00
Store decodes in a struct and sort by frequency before printing.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5636 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
b5c77b40fc
commit
2bb1efab5e
@ -327,9 +327,9 @@ void sync_and_demodulate(double *id, double *qd, long np,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
symbol-by-symbol signal subtraction
|
symbol-by-symbol signal subtraction
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void subtract_signal(double *id, double *qd, long np,
|
void subtract_signal(double *id, double *qd, long np,
|
||||||
float f0, int shift0, float drift0, unsigned char* channel_symbols)
|
float f0, int shift0, float drift0, unsigned char* channel_symbols)
|
||||||
{
|
{
|
||||||
float dt=1.0/375.0, df=375.0/256.0;
|
float dt=1.0/375.0, df=375.0/256.0;
|
||||||
@ -384,7 +384,7 @@ symbol-by-symbol signal subtraction
|
|||||||
}
|
}
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
Fully coherent signal subtraction
|
Fully coherent signal subtraction
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void subtract_signal2(double *id, double *qd, long np,
|
void subtract_signal2(double *id, double *qd, long np,
|
||||||
float f0, int shift0, float drift0, unsigned char* channel_symbols)
|
float f0, int shift0, float drift0, unsigned char* channel_symbols)
|
||||||
{
|
{
|
||||||
@ -404,13 +404,13 @@ void subtract_signal2(double *id, double *qd, long np,
|
|||||||
|
|
||||||
twopidt=2.0*pi*dt;
|
twopidt=2.0*pi*dt;
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
Measured signal: s(t)=a(t)*exp( j*theta(t) )
|
Measured signal: s(t)=a(t)*exp( j*theta(t) )
|
||||||
Reference is: r(t) = exp( j*phi(t) )
|
Reference is: r(t) = exp( j*phi(t) )
|
||||||
Complex amplitude is estimated as: c(t)=LPF[s(t)*conjugate(r(t))]
|
Complex amplitude is estimated as: c(t)=LPF[s(t)*conjugate(r(t))]
|
||||||
so c(t) has phase angle theta-phi
|
so c(t) has phase angle theta-phi
|
||||||
Multiply r(t) by c(t) and subtract from s(t), i.e. s'(t)=s(t)-c(t)r(t)
|
Multiply r(t) by c(t) and subtract from s(t), i.e. s'(t)=s(t)-c(t)r(t)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
// create reference wspr signal vector, centered on f0.
|
// create reference wspr signal vector, centered on f0.
|
||||||
//
|
//
|
||||||
@ -574,6 +574,11 @@ int main(int argc, char *argv[])
|
|||||||
double tfano=0.0,treadwav=0.0,tcandidates=0.0,tsync0=0.0;
|
double tfano=0.0,treadwav=0.0,tcandidates=0.0,tsync0=0.0;
|
||||||
double tsync1=0.0,tsync2=0.0,ttotal=0.0;
|
double tsync1=0.0,tsync2=0.0,ttotal=0.0;
|
||||||
|
|
||||||
|
struct result { char date[7]; char time[5]; float sync; float snr;
|
||||||
|
float dt; double freq; char message[23]; float drift;
|
||||||
|
unsigned int cycles; int jitter; };
|
||||||
|
struct result decodes[50];
|
||||||
|
|
||||||
char hashtab[32768][13];
|
char hashtab[32768][13];
|
||||||
memset(hashtab,0,sizeof(char)*32768*13);
|
memset(hashtab,0,sizeof(char)*32768*13);
|
||||||
int nh;
|
int nh;
|
||||||
@ -1087,20 +1092,17 @@ int main(int argc, char *argv[])
|
|||||||
freq_print=dialfreq+(1500+f1)/1e6;
|
freq_print=dialfreq+(1500+f1)/1e6;
|
||||||
dt_print=shift1*dt-2.0;
|
dt_print=shift1*dt-2.0;
|
||||||
}
|
}
|
||||||
printf("%4s %3.0f %4.1f %10.6f %2d %-s \n",
|
|
||||||
uttime, snr0[j],dt_print,freq_print,
|
|
||||||
(int)drift1, call_loc_pow);
|
|
||||||
|
|
||||||
fprintf(fall_wspr,
|
strcpy(decodes[uniques-1].date,date);
|
||||||
"%6s %4s %3.0f %3.0f %4.1f %10.7f %-22s %2d %5u %4d\n",
|
strcpy(decodes[uniques-1].time,uttime);
|
||||||
date,uttime,sync1*10,snr0[j],
|
decodes[uniques-1].sync=sync1;
|
||||||
dt_print, freq_print,
|
decodes[uniques-1].snr=snr0[j];
|
||||||
call_loc_pow, (int)drift1, cycles/81, ii);
|
decodes[uniques-1].dt=dt_print;
|
||||||
|
decodes[uniques-1].freq=freq_print;
|
||||||
fprintf(fwsprd,"%6s %4s %3d %3.0f %4.1f %10.6f %-22s %2d %5u %4d\n",
|
strcpy(decodes[uniques-1].message,call_loc_pow);
|
||||||
date,uttime,(int)(sync1*10),snr0[j],
|
decodes[uniques-1].drift=drift1;
|
||||||
dt_print, freq_print,
|
decodes[uniques-1].cycles=cycles;
|
||||||
call_loc_pow, (int)drift1, cycles/81, ii);
|
decodes[uniques-1].jitter=ii;
|
||||||
|
|
||||||
/* For timing tests
|
/* For timing tests
|
||||||
|
|
||||||
@ -1123,6 +1125,37 @@ int main(int argc, char *argv[])
|
|||||||
writec2file(c2filename, wsprtype, carrierfreq, idat, qdat);
|
writec2file(c2filename, wsprtype, carrierfreq, idat, qdat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort the result in order of increasing frequency
|
||||||
|
struct result temp;
|
||||||
|
for (j = 1; j <= uniques - 1; j++) {
|
||||||
|
for (k = 0; k < uniques - j ; k++) {
|
||||||
|
if (decodes[k].freq > decodes[k+1].freq) {
|
||||||
|
temp = decodes[k];
|
||||||
|
decodes[k]=decodes[k+1];;
|
||||||
|
decodes[k+1] = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<uniques; i++) {
|
||||||
|
printf("%4s %3.0f %4.1f %10.6f %2d %-s \n",
|
||||||
|
decodes[i].time, decodes[i].snr,decodes[i].dt, decodes[i].freq,
|
||||||
|
(int)decodes[i].dt, decodes[i].message);
|
||||||
|
fprintf(fall_wspr,
|
||||||
|
"%6s %4s %3d %3.0f %4.1f %10.7f %-22s %2d %5u %4d\n",
|
||||||
|
decodes[i].date, decodes[i].time, (int)(10*decodes[i].sync),
|
||||||
|
decodes[i].snr, decodes[i].dt, decodes[i].freq,
|
||||||
|
decodes[i].message, (int)decodes[i].drift, decodes[i].cycles/81,
|
||||||
|
decodes[i].jitter);
|
||||||
|
fprintf(fwsprd,
|
||||||
|
"%6s %4s %3d %3.0f %4.1f %10.6f %-22s %2d %5u %4d\n",
|
||||||
|
decodes[i].date, decodes[i].time, (int)(10*decodes[i].sync),
|
||||||
|
decodes[i].snr, decodes[i].dt, decodes[i].freq,
|
||||||
|
decodes[i].message, (int)decodes[i].drift, decodes[i].cycles/81,
|
||||||
|
decodes[i].jitter);
|
||||||
|
|
||||||
|
}
|
||||||
printf("<DecodeFinished>\n");
|
printf("<DecodeFinished>\n");
|
||||||
|
|
||||||
fftw_free(fftin);
|
fftw_free(fftin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user