diff --git a/Detector.cpp b/Detector.cpp index 751cdf2..822d8d4 100644 --- a/Detector.cpp +++ b/Detector.cpp @@ -50,15 +50,8 @@ void Detector::clear () int prevKin = dec_data.params.kin; dec_data.params.kin = qMin ((msInPeriod * m_frameRate) / 1000, static_cast (sizeof (dec_data.d2) / sizeof (dec_data.d2[0]))); m_bufferPos = m_samplesPerFFT; - -#if 0 - // erase everything after kin. - //memset(dec_data.d2 + dec_data.params.kin, 0, sizeof(dec_data.d2) - (sizeof(dec_data.d2[0]) * dec_data.params.kin)); -#else - // erase everything + m_ns=secondInPeriod(); memset(dec_data.d2, 0, sizeof(dec_data.d2) - (sizeof(dec_data.d2[0]))); -#endif - qDebug() << "advancing detector buffer from" << prevKin << "to" << dec_data.params.kin << "delta" << dec_data.params.kin - prevKin; #else dec_data.params.kin = 0; diff --git a/commons.h b/commons.h index 138b0b6..3e002b5 100644 --- a/commons.h +++ b/commons.h @@ -6,7 +6,7 @@ #define RX_SAMPLE_RATE 12000 -#define JS8_USE_REFSPEC 1 // compute the signal refspec +#define JS8_USE_REFSPEC 0 // compute the signal refspec #define JS8_USE_IHSYM 0 // compute ihsym manually instead of from symspec #define JS8_RING_BUFFER 1 // use a ring buffer instead of clearing the decode frames #define JS8_DECODER_E2S 0 // decode every 2 seconds instead of at the half symbol stop @@ -128,6 +128,7 @@ extern struct dec_data { char mygrid[6]; char hiscall[12]; char hisgrid[6]; + int ndebug; } params; } dec_data; diff --git a/lib/jt9com.f90 b/lib/jt9com.f90 index e5d9e6a..13861c1 100644 --- a/lib/jt9com.f90 +++ b/lib/jt9com.f90 @@ -55,6 +55,7 @@ character(kind=c_char) :: mygrid(6) character(kind=c_char) :: hiscall(12) character(kind=c_char) :: hisgrid(6) + integer(c_int) :: ndebug end type params_block type, bind(C) :: dec_data diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 803beef..d356870 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -1,4 +1,4 @@ -subroutine symspec(shared_data,k,k0,ntrperiod,nsps,ingain,nminw,pxdb,s, & +subroutine symspec(shared_data,k,k0,ja,ssum,ntrperiod,nsps,ingain,nminw,pxdb,s, & df3,ihsym,npts8,pxdbmax) ! Input: @@ -84,7 +84,9 @@ subroutine symspec(shared_data,k,k0,ntrperiod,nsps,ingain,nminw,pxdb,s, & do i=0,nfft3-1 !Copy data into cx j=ja+i-(nfft3-1) xc(i)=0. - if(j.ge.1 .and.j.le.NMAX) xc(i)=fac0*shared_data%id2(j) + if(j.ge.1 .and. j.le.NMAX) then + xc(i)=fac0*shared_data%id2(j) + endif enddo ihsym=ihsym+1 diff --git a/mainwindow.cpp b/mainwindow.cpp index 1a55b76..b8ad431 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -79,7 +79,7 @@ extern "C" { //----------------------------------------------------- C and Fortran routines - void symspec_(struct dec_data *, int* k, int* k0, int* ntrperiod, int* nsps, int* ingain, + void symspec_(struct dec_data *, int* k, int* k0, int *ja, float ssum[], int* ntrperiod, int* nsps, int* ingain, int* minw, float* px, float s[], float* df3, int* nhsym, int* npts8, float *m_pxmax); @@ -2542,13 +2542,17 @@ int MainWindow::computeFramesNeededForDecode(int submode, int period){ //-------------------------------------------------------------- dataSink() void MainWindow::dataSink(qint64 frames) { + // symspec global vars + static int ja = 0; static int k0 = 999999999; + static float ssum[NSMAX]; static float s[NSMAX]; char line[80]; int k (frames); if(k0 == 999999999){ m_ihsym = int((float)frames/(float)m_nsps)*2; + ja = k; k0 = k; } @@ -2615,8 +2619,8 @@ void MainWindow::dataSink(qint64 frames) /// END IHSYM #else m_ihsym=m_ihsym%(m_TRperiod*RX_SAMPLE_RATE/m_nsps*2); - qDebug() << "k" << k << "k0" << k0 << "ihsym" << m_ihsym; - symspec_(&dec_data,&k,&k0,&trmin,&nsps,&m_inGain,&nsmo,&m_px,s,&m_df3,&m_ihsym,&m_npts8,&m_pxmax); + symspec_(&dec_data,&k,&k0,&ja,ssum,&trmin,&nsps,&m_inGain,&nsmo,&m_px,s,&m_df3,&m_ihsym,&m_npts8,&m_pxmax); + ja = k; #endif if(m_ihsym <= 0) return;