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:
Steven Franke 2015-06-28 14:01:23 +00:00
parent b5c77b40fc
commit 2bb1efab5e

View File

@ -574,6 +574,11 @@ int main(int argc, char *argv[])
double tfano=0.0,treadwav=0.0,tcandidates=0.0,tsync0=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];
memset(hashtab,0,sizeof(char)*32768*13);
int nh;
@ -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<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");
fftw_free(fftin);