diff --git a/lib/refspectrum.f90 b/lib/refspectrum.f90 index 884e64cce..16b2600e7 100644 --- a/lib/refspectrum.f90 +++ b/lib/refspectrum.f90 @@ -1,4 +1,4 @@ -subroutine refspectrum(id2,brefspec,buseref,fname) +subroutine refspectrum(id2,bclear,brefspec,buseref,fname) ! Input: ! id2 i*2 Raw 16-bit integer data, 12000 Hz sample rate @@ -6,7 +6,7 @@ subroutine refspectrum(id2,brefspec,buseref,fname) parameter (NFFT=6912,NH=NFFT/2) integer*2 id2(NFFT) - logical*1 brefspec,buseref + logical*1 bclear,brefspec,buseref real x0(0:NH-1) !Input samples real x1(0:NH-1) !Output samples (delayed by one block) @@ -37,6 +37,7 @@ subroutine refspectrum(id2,brefspec,buseref,fname) x1s=0. first=.false. endif + if(bclear) s=0. if(brefspec) then x(0:NH-1)=0.001*id2(1:NH) @@ -96,7 +97,6 @@ subroutine refspectrum(id2,brefspec,buseref,fname) if(s(i).gt.0.0) filter(i)=20.0*log10(fil(i)) enddo -! open(16,file='refspec.dat',status='unknown') open(16,file=fname,status='unknown') do i=1,NH freq=i*df @@ -111,7 +111,6 @@ subroutine refspectrum(id2,brefspec,buseref,fname) if(buseref) then if(firstuse) then -! open(16,file='refspec.dat',status='unknown') fil=1.0 open(16,file=fname,status='old',err=10) do i=1,NH diff --git a/mainwindow.cpp b/mainwindow.cpp index 4e0c33104..5f4d3d5e8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -113,8 +113,8 @@ extern "C" { int len1, int len2, int len3); void degrade_snr_(short d2[], int* n, float* db, float* bandwidth); void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2); - void refspectrum_(short int d2[], bool* brefspec, bool* buseref, - const char* c_fname, int len); + void refspectrum_(short int d2[], bool* bclearrefspec, bool* brefspec, + bool* buseref, const char* c_fname, int len); } int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols @@ -248,6 +248,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_bFastDecodeCalled {false}, m_bDoubleClickAfterCQnnn {false}, m_bRefSpec {false}, + m_bClearRefSpec {false}, m_ihsym {0}, m_nzap {0}, m_px {0.0}, @@ -1091,7 +1092,9 @@ void MainWindow::dataSink(qint64 frames) } m_bUseRef=m_wideGraph->useRef(); - refspectrum_(&dec_data.d2[k-m_nsps/2],&m_bRefSpec,&m_bUseRef,c_fname,len); + refspectrum_(&dec_data.d2[k-m_nsps/2],&m_bClearRefSpec,&m_bRefSpec, + &m_bUseRef,c_fname,len); + m_bClearRefSpec=false; // Get power, spectrum, and ihsym int trmin=m_TRperiod/60; @@ -5874,6 +5877,11 @@ void MainWindow::on_actionSave_reference_spectrum_triggered() m_bRefSpec=true; } +void MainWindow::on_actionClear_reference_spectrum_triggered() +{ + m_bClearRefSpec=true; +} + void MainWindow::on_sbCQTxFreq_valueChanged(int) { setXIT (ui->TxFreqSpinBox->value ()); diff --git a/mainwindow.h b/mainwindow.h index 7cecb6d90..6eba4c228 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -241,6 +241,7 @@ private slots: void on_actionFast_Graph_triggered(); void fast_decode_done(); void on_actionSave_reference_spectrum_triggered(); + void on_actionClear_reference_spectrum_triggered(); void on_sbTR_valueChanged(int index); void on_sbFtol_valueChanged(int index); void on_cbFast9_clicked(bool b); @@ -414,6 +415,7 @@ private: bool m_bFastDecodeCalled; bool m_bDoubleClickAfterCQnnn; bool m_bRefSpec; + bool m_bClearRefSpec; bool m_bUseRef; bool m_bFastDone; bool m_bAltV; diff --git a/mainwindow.ui b/mainwindow.ui index 217787723..4f6521fe0 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2337,6 +2337,7 @@ QPushButton[state="ok"] { + @@ -2893,6 +2894,11 @@ QPushButton[state="ok"] { + + + Clear reference spectrum + +