Fix waterfall display by extracting global symspec vars and resetting the ja to the correct value after detector reset

This commit is contained in:
Jordan Sherer 2019-11-05 21:27:41 -05:00
parent e3ac4b22c3
commit e5f07e3a0d
5 changed files with 15 additions and 14 deletions

View File

@ -50,15 +50,8 @@ void Detector::clear ()
int prevKin = dec_data.params.kin;
dec_data.params.kin = qMin ((msInPeriod * m_frameRate) / 1000, static_cast<unsigned> (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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;