From 9858403a9521fbda24f9986e6d59cfa91c8cae0f Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Wed, 6 Nov 2019 14:11:39 -0500 Subject: [PATCH] Fix spectrum display to reset cumulative display every period --- mainwindow.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 2172640..f682e10 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2618,8 +2618,22 @@ void MainWindow::dataSink(qint64 frames) /// END IHSYM #else - m_ihsym=m_ihsym%(m_TRperiod*RX_SAMPLE_RATE/m_nsps*2); + // make sure the ssum global is reset every period cycle + static int lastCycle = -1; + int cycle = computeCurrentCycle(m_TRperiod); + if(cycle != lastCycle){ + qDebug() << "period loop, resetting ssum"; + memset(ssum, 0, sizeof(ssum)); + } + lastCycle = cycle; + + // cap ihsym based on the period max + m_ihsym = m_ihsym%(m_TRperiod*RX_SAMPLE_RATE/m_nsps*2); + + // compute the symbol spectra for the waterfall display symspec_(&dec_data,&k,&k0,&ja,ssum,&trmin,&nsps,&m_inGain,&nsmo,&m_px,s,&m_df3,&m_ihsym,&m_npts8,&m_pxmax); + + // make sure ja is equal to k so if we jump ahead in the buffer, everything resolves correctly ja = k; #endif