diff --git a/devsetup.ui b/devsetup.ui index 935cf2abf..33f671456 100644 --- a/devsetup.ui +++ b/devsetup.ui @@ -17,7 +17,7 @@ - 2 + 0 @@ -948,249 +948,6 @@ - - - Si570 - - - - - 40 - 40 - 272 - 220 - - - - - - - - - LO Selection: - - - - - - - IQ+, Generic Si570 - - - true - - - - - - - IQ+ Rx/XT - - - false - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 40 - - - - - - - - - - Rx frequency multiplier: - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 47 - 20 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 1 - - - 8 - - - 2 - - - - - - - - - - - false - - - Tx frequency multiplier: - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 47 - 20 - - - - - - - - false - - - - 0 - 0 - - - - - 80 - 0 - - - - 1 - - - - - - - - - - - Frequency correction (ppm): - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 10 - 20 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 3 - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 40 - - - - - - - - Initialize IQ+ on startup - - - - - - Colors @@ -1700,6 +1457,249 @@ + + + Si570 Control + + + + + 40 + 40 + 272 + 220 + + + + + + + + + LO Selection: + + + + + + + IQ+, Generic Si570 + + + true + + + + + + + IQ+ Rx/XT + + + false + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + + + Rx frequency multiplier: + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 47 + 20 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 1 + + + 8 + + + 2 + + + + + + + + + + + false + + + Tx frequency multiplier: + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 47 + 20 + + + + + + + + false + + + + 0 + 0 + + + + + 80 + 0 + + + + 1 + + + + + + + + + + + Frequency correction (ppm): + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 3 + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + Initialize IQ+ on startup + + + + + + diff --git a/plotter.cpp b/plotter.cpp index 7e86b6a38..f7abff1f1 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -32,6 +32,7 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor m_line = 0; m_fSample = 96000; m_paintAllZoom = false; + m_TxDF=0; } CPlotter::~CPlotter() { } // Destructor @@ -317,6 +318,10 @@ void CPlotter::DrawOverlay() //DrawOverlay() painter0.setPen(pen0); x = XfromFreq(float(fQSO())); painter0.drawLine(x,15,x,30); + QPen pen3(Qt::red, 3); //Mark Tx freq (kHz) with red tick + painter0.setPen(pen3); + x = XfromFreq(float(m_TXkHz)); + painter0.drawLine(x,0,x,15); } // Now make the zoomed scale, using m_ZoomScalePixmap and painter3 @@ -352,7 +357,7 @@ void CPlotter::DrawOverlay() //DrawOverlay() df=m_fSample/32768.0; x = (m_DF + m_mode65*66*11025.0/4096.0 - m_ZoomStartFreq)/df; - QPen pen2(Qt::red, 3); //Mark top JT65B tone with red tick + QPen pen2(Qt::darkGreen, 3); //Mark top JT65B tone with dark Green tick painter3.setPen(pen2); painter3.drawLine(x,15,x,30); x = (m_DF - m_ZoomStartFreq)/df; @@ -367,6 +372,12 @@ void CPlotter::DrawOverlay() //DrawOverlay() int x2=(m_DF + m_tol - m_ZoomStartFreq)/df; pen1.setWidth(6); painter3.drawLine(x1,28,x2,28); + + pen1.setWidth(3); + pen1.setColor(Qt::red); //Mark Tx DF with red tick + painter3.setPen(pen1); + x = (m_TxDF - m_ZoomStartFreq)/df; + painter3.drawLine(x,0,x,15); } void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs @@ -549,16 +560,30 @@ void CPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent int y=event->y(); int button=event->button(); if(y < h+30) { // Wideband waterfall - if(button==1) setFQSO(x,false); + if(button==1) { + setFQSO(x,false); + if(m_bLockTxRx) m_TXkHz=m_fQSO; + qDebug() << "c" << m_bLockTxRx << m_fQSO << m_TXkHz; + } + if(button==2 and !m_bLockTxRx) { + if(x<0) x=0; // x is pixel number + if(x>m_Size.width()) x=m_Size.width(); + m_TXkHz = int(FreqfromX(x)+0.5); + m_TXfreq = floor(datcom_.fcenter) + 0.001*m_TXkHz; + setTxFreq(m_TXfreq); + } } else { // Zoomed waterfall if(button==1) m_DF=int(m_ZoomStartFreq + x*m_fSample/32768.0); - DrawOverlay(); - update(); + if(button==2 and !m_bLockTxRx) m_TxDF=int(m_ZoomStartFreq + x*m_fSample/32768.0); + if(m_bLockTxRx) m_TxDF=m_DF; } + DrawOverlay(); + update(); } void CPlotter::mouseDoubleClickEvent(QMouseEvent *event) //mouse2click { + if(event->button()!=1) return; //Act only on left double-click int h = (m_Size.height()-60)/2; int x=event->x(); int y=event->y(); @@ -715,3 +740,20 @@ double CPlotter::fGreen() { return m_fGreen; } + +void CPlotter::setTxFreq(double dfreq) +{ + qDebug() << "SetTxFreq()" << dfreq; +} + +void CPlotter::setLockTxRx(bool b) +{ + m_bLockTxRx=b; + if(m_bLockTxRx) { + m_TXkHz=m_fQSO; + m_TXfreq=floor(m_TXfreq) + 0.001*m_TXkHz; + m_TxDF=m_DF; + DrawOverlay(); //Redraw scales and ticks + update(); //trigger a new paintEvent} + } +} diff --git a/plotter.h b/plotter.h index 3432d26e3..387e61bcd 100644 --- a/plotter.h +++ b/plotter.h @@ -56,7 +56,7 @@ public: void setBinsPerPixel(int n); int binsPerPixel(); void setFQSO(int n, bool bf); -// void setTxFreq(int) + void setTxFreq(double dfreq); void setFcal(int n); void setNkhz(int n); void DrawOverlay(); @@ -68,6 +68,7 @@ public: void setMode65(int n); void set2Dspec(bool b); double fGreen(); + void setLockTxRx(bool b); signals: void freezeDecode0(int n); @@ -99,8 +100,10 @@ private: bool m_paintEventBusy; bool m_2Dspec; bool m_paintAllZoom; + bool m_bLockTxRx; double m_CenterFreq; double m_fGreen; + double m_TXfreq; qint64 m_StartFreq; qint64 m_ZoomStartFreq; qint64 m_FreqOffset; @@ -119,6 +122,8 @@ private: qint32 m_mode65; qint32 m_i0; qint32 m_xClick; + qint32 m_TXkHz; + qint32 m_TxDF; private slots: void mousePressEvent(QMouseEvent *event); diff --git a/widegraph.cpp b/widegraph.cpp index bef91367f..ff5409e30 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -40,7 +40,10 @@ WideGraph::WideGraph(QWidget *parent) : m_bForceCenterFreq=settings.value("ForceCenterFreqBool",false).toBool(); m_dForceCenterFreq=settings.value("ForceCenterFreqMHz",144.125).toDouble(); ui->cbFcenter->setChecked(m_bForceCenterFreq); + ui->cbLockTxRx->setChecked(m_bLockTxRx); ui->fCenterLineEdit->setText(QString::number(m_dForceCenterFreq)); + m_bLockTxRx=settings.value("LockTxRx",false).toBool(); + ui->cbLockTxRx->setChecked(m_bLockTxRx); settings.endGroup(); } @@ -67,6 +70,7 @@ void WideGraph::saveSettings() settings.setValue("FreqOffset",ui->widePlot->freqOffset()); settings.setValue("ForceCenterFreqBool",m_bForceCenterFreq); settings.setValue("ForceCenterFreqMHz",m_dForceCenterFreq); + settings.setValue("LockTxRx",m_bLockTxRx); settings.endGroup(); } @@ -321,3 +325,9 @@ void WideGraph::setPeriod(int n) { m_TRperiod=n; } + +void WideGraph::on_cbLockTxRx_stateChanged(int n) +{ + m_bLockTxRx = (n!=0); + ui->widePlot->setLockTxRx(m_bLockTxRx); +} diff --git a/widegraph.h b/widegraph.h index 3750d92b6..1521a4815 100644 --- a/widegraph.h +++ b/widegraph.h @@ -15,6 +15,7 @@ public: ~WideGraph(); bool m_bForceCenterFreq; + bool m_bLockTxRx; qint32 m_mult570; qint32 m_mult570Tx; double m_dForceCenterFreq; @@ -63,6 +64,8 @@ private slots: void on_pbSetRxHardware_clicked(); void on_cbSpec2d_toggled(bool checked); + void on_cbLockTxRx_stateChanged(int arg1); + private: qint32 m_waterfallAvg; qint32 m_fCal; diff --git a/widegraph.ui b/widegraph.ui index a7b46dda8..96eb439f7 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -347,6 +347,29 @@ + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Lock Tx=Rx Freq + + +