diff --git a/lib/flat4.f90 b/lib/flat4.f90 index e689825a1..faf154598 100644 --- a/lib/flat4.f90 +++ b/lib/flat4.f90 @@ -17,35 +17,37 @@ subroutine flat4(s,npts0,nflatten) do i=1,npts s(i)=10.0*log10(s(i)) !Convert to dB scale enddo - if(nflatten.eq.0) go to 900 - nlen=npts/nseg !Length of test segment - i0=npts/2 !Midpoint - k=0 - do n=1,nseg !Skip first segment, likely rolloff here - ib=n*nlen - ia=ib-nlen+1 - if(n.eq.nseg) ib=npts - call pctile(s(ia),ib-ia+1,npct,base) !Find lowest npct of points in segment - do i=ia,ib - if(s(i).le.base) then - if (k.lt.1000) k=k+1 !Save these "lower envelope" points - x(k)=i-i0 - y(k)=s(i) - endif + if(nflatten.gt.0) then + nterms=5 + if(nflatten.eq.2) nterms=1 + nlen=npts/nseg !Length of test segment + i0=npts/2 !Midpoint + k=0 + do n=1,nseg !Skip first segment, likely rolloff here + ib=n*nlen + ia=ib-nlen+1 + if(n.eq.nseg) ib=npts + call pctile(s(ia),ib-ia+1,npct,base) !Find lowest npct of points + do i=ia,ib + if(s(i).le.base) then + if (k.lt.1000) k=k+1 !Save these "lower envelope" points + x(k)=i-i0 + y(k)=s(i) + endif + enddo enddo - enddo - kz=k - a=0. - nterms=5 + kz=k + a=0. - call polyfit(x,y,y,kz,nterms,0,a,chisqr) !Fit a low-order polynomial + call polyfit(x,y,y,kz,nterms,0,a,chisqr) !Fit a low-order polynomial - do i=1,npts - t=i-i0 - yfit=a(1)+t*(a(2)+t*(a(3)+t*(a(4)+t*(a(5))))) - s(i)=s(i)-yfit !Subtract the fitted baseline - enddo + do i=1,npts + t=i-i0 + yfit=a(1)+t*(a(2)+t*(a(3)+t*(a(4)+t*(a(5))))) + s(i)=s(i)-yfit !Subtract the fitted baseline + enddo + endif 900 return end subroutine flat4 diff --git a/mainwindow.cpp b/mainwindow.cpp index 2c6b2b96f..11f703814 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2167,6 +2167,7 @@ void MainWindow::on_EraseButton_clicked() //Erase void MainWindow::decodeBusy(bool b) //decodeBusy() { +/* ### Temporarily(?) disable the long-decode progress bar. bool showProgress = false; if (b && m_firstDecode < 65 && ("JT65" == m_mode || "JT9+JT65" == m_mode)) { @@ -2180,7 +2181,6 @@ void MainWindow::decodeBusy(bool b) //decodeBusy() m_firstDecode += 9; showProgress = true; } -/* ### Temporarily(?) disable the long-decode progress bar. if (showProgress) { // this sequence is needed to create an indeterminate progress diff --git a/plotter.cpp b/plotter.cpp index 69e3fd7c9..0c77f011c 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -408,7 +408,7 @@ void CPlotter::DrawOverlay() //DrawOverlay() painter0.drawLine(x1,8,x1,28); } - if(m_dialFreq>10.13 and m_dialFreq< 10.15) { + if(m_dialFreq>10.13 and m_dialFreq< 10.15 and m_mode.mid(0,4)!="WSPR") { float f1=1.0e6*(10.1401 - m_dialFreq); float f2=f1+200.0; x1=XfromFreq(f1); @@ -625,10 +625,11 @@ void CPlotter::setRxBand(QString band) m_rxBand=band; } -void CPlotter::setFlatten(bool b) +void CPlotter::setFlatten(bool b1, bool b2) { m_Flatten=0; - if(b) m_Flatten=1; + if(b1) m_Flatten=1; + if(b2) m_Flatten=2; } void CPlotter::setTol(int n) //setTol() diff --git a/plotter.h b/plotter.h index 4d00bcf14..d9288caf7 100644 --- a/plotter.h +++ b/plotter.h @@ -77,7 +77,7 @@ public: float fSpan() const {return m_fSpan;} void setLockTxFreq(bool b) {m_lockTxFreq = b;} void setColours(QVector const& cl); - void setFlatten(bool b); + void setFlatten(bool b1, bool b2); void setTol(int n); void setRxBand(QString band); void setReference(bool b) {m_bReference = b;} diff --git a/widegraph.cpp b/widegraph.cpp index 546804239..3cc7a741b 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -50,8 +50,8 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : int n = m_settings->value("BinsPerPixel",2).toInt(); m_bFlatten=m_settings->value("Flatten",true).toBool(); ui->cbFlatten->setChecked(m_bFlatten); - ui->widePlot->setFlatten(m_bFlatten); m_bRef=m_settings->value("UseRef",false).toBool(); + ui->widePlot->setFlatten(m_bFlatten,m_bRef); ui->cbRef->setChecked(m_bRef); ui->widePlot->setBreadth(m_settings->value("PlotWidth",1000).toInt()); ui->bppSpinBox->setValue(n); @@ -384,7 +384,7 @@ void WideGraph::on_cbFlatten_toggled(bool b) //Flatten m_bRef=false; ui->cbRef->setChecked(false); } - ui->widePlot->setFlatten(m_bFlatten); + ui->widePlot->setFlatten(m_bFlatten,m_bRef); } void WideGraph::on_cbRef_toggled(bool b) @@ -394,6 +394,7 @@ void WideGraph::on_cbRef_toggled(bool b) m_bFlatten=false; ui->cbFlatten->setChecked(false); } + ui->widePlot->setFlatten(m_bFlatten,m_bRef); } void WideGraph::on_adjust_palette_push_button_clicked (bool) //Adjust Palette