diff --git a/lib/wsprd/wsprd_exp.c b/lib/wsprd/wsprd_exp.c index e0935ee47..f3ef8f68c 100644 --- a/lib/wsprd/wsprd_exp.c +++ b/lib/wsprd/wsprd_exp.c @@ -327,9 +327,9 @@ void sync_and_demodulate(double *id, double *qd, long np, return; } /*************************************************************************** -symbol-by-symbol signal subtraction -****************************************************************************/ - void subtract_signal(double *id, double *qd, long np, + symbol-by-symbol signal subtraction + ****************************************************************************/ +void subtract_signal(double *id, double *qd, long np, float f0, int shift0, float drift0, unsigned char* channel_symbols) { float dt=1.0/375.0, df=375.0/256.0; @@ -371,7 +371,7 @@ symbol-by-symbol signal subtraction i0=i0/256.0; //will be wrong for partial symbols at the edges... q0=q0/256.0; - + for (j=0; j<256; j++) { k=shift0+i*256+j; if( (k>0) & (k0) & (k minsync2) && (rms > minrms)) { deinterleave(symbols); t0 = clock(); @@ -1053,11 +1058,11 @@ int main(int argc, char *argv[]) // sanity checks on grid and power, and return // call_loc_pow string and also callsign (for de-duping). noprint=unpk_(message,hashtab,call_loc_pow,callsign); - + if( subtraction && (ipass == 0) && !noprint ) { unsigned char channel_symbols[162]; - + if( get_wspr_channel_symbols(call_loc_pow, channel_symbols) ) { subtract_signal2(idat, qdat, npoints, f1, shift1, drift1, channel_symbols); } else { @@ -1087,20 +1092,17 @@ int main(int argc, char *argv[]) freq_print=dialfreq+(1500+f1)/1e6; 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, - "%6s %4s %3.0f %3.0f %4.1f %10.7f %-22s %2d %5u %4d\n", - date,uttime,sync1*10,snr0[j], - dt_print, freq_print, - call_loc_pow, (int)drift1, cycles/81, ii); - - fprintf(fwsprd,"%6s %4s %3d %3.0f %4.1f %10.6f %-22s %2d %5u %4d\n", - date,uttime,(int)(sync1*10),snr0[j], - dt_print, freq_print, - call_loc_pow, (int)drift1, cycles/81, ii); + strcpy(decodes[uniques-1].date,date); + strcpy(decodes[uniques-1].time,uttime); + decodes[uniques-1].sync=sync1; + decodes[uniques-1].snr=snr0[j]; + decodes[uniques-1].dt=dt_print; + decodes[uniques-1].freq=freq_print; + strcpy(decodes[uniques-1].message,call_loc_pow); + decodes[uniques-1].drift=drift1; + decodes[uniques-1].cycles=cycles; + decodes[uniques-1].jitter=ii; /* For timing tests @@ -1123,6 +1125,37 @@ int main(int argc, char *argv[]) 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\n"); fftw_free(fftin);