From b41c813259fe68a837194c5149743d6a57f5a1ad Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Tue, 16 Jun 2015 02:47:51 +0000 Subject: [PATCH] Fix some bugs uncovered by the signal subtraction project. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5619 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/wsprd/wsprd_exp.c | 18 ++++++++++-------- lib/wsprd/wsprd_utils.c | 13 ++++++++----- lib/wsprd/wsprd_utils.h | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/wsprd/wsprd_exp.c b/lib/wsprd/wsprd_exp.c index 51cf07e8d..926870436 100644 --- a/lib/wsprd/wsprd_exp.c +++ b/lib/wsprd/wsprd_exp.c @@ -359,6 +359,7 @@ void subtract_signal(double *id, double *qd, long np, for (j=0; j<256; j++) { k=shift0+i*256+j; if( (k>0) & (k0) & (k minsync2) && (rms > minrms)) { deinterleave(symbols); t0 = clock(); + not_decoded = fano(&metric,&cycles,&maxnp,decdata,symbols,nbits, mettab,delta,maxcycles); tfano += (double)(clock()-t0)/CLOCKS_PER_SEC; @@ -942,11 +943,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 ) { + + if( subtraction && !noprint ) { unsigned char channel_symbols[162]; - + if( get_wspr_channel_symbols(call_loc_pow, channel_symbols) ) { subtract_signal(idat, qdat, npoints, f1, shift1, drift1, channel_symbols); } else { @@ -962,9 +963,10 @@ int main(int argc, char *argv[]) (fabs(f1-allfreqs[i]) <3.0)) dupe=1; } if( (verbose || !dupe) && !noprint) { - uniques++; strcpy(allcalls[uniques],callsign); allfreqs[uniques]=f1; + uniques++; + // Add an extra space at the end of each line so that wspr-x doesn't // truncate the power (TNX to DL8FCL!) diff --git a/lib/wsprd/wsprd_utils.c b/lib/wsprd/wsprd_utils.c index 806ad190b..9cd757b62 100644 --- a/lib/wsprd/wsprd_utils.c +++ b/lib/wsprd/wsprd_utils.c @@ -142,14 +142,13 @@ void unpackgrid( int32_t ngrid, char *grid) } } -void unpackpfx( int32_t nprefix, char *call) +int unpackpfx( int32_t nprefix, char *call) { char nc, pfx[4]="", tmpcall[7]=""; int i; int32_t n; strcpy(tmpcall,call); - if( nprefix < 60000 ) { // add a prefix of 1 to 3 characters n=nprefix; @@ -193,7 +192,11 @@ void unpackpfx( int32_t nprefix, char *call) strncat(call,"/",1); strncat(call,pfx,2); } - } + else { + return 0; + } + } + return 1; } void deinterleave(unsigned char *sym) @@ -248,7 +251,7 @@ int unpk_(signed char *message, char hashtab[32768][13], char *call_loc_pow, cha * Type 3: hash, 6 digit grid, power - ntype is negative. */ - + if( (ntype >= 0) && (ntype <= 62) ) { int nu=ntype%10; if( nu == 0 || nu == 3 || nu == 7 ) { @@ -268,7 +271,7 @@ int unpk_(signed char *message, char hashtab[32768][13], char *call_loc_pow, cha if( nu > 3 ) nadd=nu-3; if( nu > 7 ) nadd=nu-7; n3=n2/128+32768*(nadd-1); - unpackpfx(n3,callsign); + if( !unpackpfx(n3,callsign) ) return 1; ndbm=ntype-nadd; memset(call_loc_pow,0,sizeof(char)*23); sprintf(cdbm,"%2d",ndbm); diff --git a/lib/wsprd/wsprd_utils.h b/lib/wsprd/wsprd_utils.h index 6384999b8..71299b330 100644 --- a/lib/wsprd/wsprd_utils.h +++ b/lib/wsprd/wsprd_utils.h @@ -16,7 +16,7 @@ void unpackcall( int32_t ncall, char *call ); void unpackgrid( int32_t ngrid, char *grid); -void unpackpfx( int32_t nprefix, char *call); +int unpackpfx( int32_t nprefix, char *call); void deinterleave(unsigned char *sym);