From 8422bf21a61079f21a07d030ceb294145813c54e Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 15 Jan 2014 21:44:12 +0000 Subject: [PATCH] Working on adjustments for IQ amp and phase during Tx. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@3638 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 18 ++++---- soundout.cpp | 7 +-- txtune.cpp | 65 +++++++++++++++++---------- txtune.h | 14 +++--- txtune.ui | 120 ++++++++++++++++++++++++++++++++++--------------- 5 files changed, 147 insertions(+), 77 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index e4005ba2e..0709418f7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -19,9 +19,9 @@ int nwave; //Length of Tx waveform bool btxok; //True if OK to transmit bool bTune; double outputLatency; //Latency in seconds -double txPower; -double iqAmp; -double iqPhase; +int txPower; +int iqAmp; +int iqPhase; qint16 id[4*60*96000]; Astro* g_pAstro = NULL; @@ -152,9 +152,9 @@ MainWindow::MainWindow(QWidget *parent) : m_nfast=1; m_nsave=0; bTune=false; - txPower=1.0; - iqAmp=1.0; - iqPhase=0.0; + txPower=100; + iqAmp=0; + iqPhase=0; ui->xThermo->setFillBrush(Qt::green); ui->yThermo->setFillBrush(Qt::magenta); @@ -339,6 +339,7 @@ void MainWindow::writeSettings() settings.setValue("Editor",m_editorCommand); settings.setValue("DXCCpfx",m_dxccPfx); settings.setValue("Timeout",m_timeout); + settings.setValue("TxPower",txPower); settings.setValue("IQamp",iqAmp); settings.setValue("IQphase",iqPhase); settings.setValue("ApplyIQcal",m_applyIQcal); @@ -416,8 +417,9 @@ void MainWindow::readSettings() m_editorCommand=settings.value("Editor","notepad").toString(); m_dxccPfx=settings.value("DXCCpfx","").toString(); m_timeout=settings.value("Timeout",20).toInt(); - iqAmp=settings.value("IQamp",1.0000).toDouble(); - iqPhase=settings.value("IQphase",0.0).toDouble(); + txPower=settings.value("TxPower",100).toInt(); + iqAmp=settings.value("IQamp",0).toInt(); + iqPhase=settings.value("IQphase",0).toInt(); m_applyIQcal=settings.value("ApplyIQcal",0).toInt(); ui->actionApply_IQ_Calibration->setChecked(m_applyIQcal!=0); m_dPhi=settings.value("dPhi",0).toInt(); diff --git a/soundout.cpp b/soundout.cpp index 531f59efd..3543d8a51 100644 --- a/soundout.cpp +++ b/soundout.cpp @@ -12,10 +12,11 @@ extern short int iwave[2*60*11025]; //Wave file for Tx audio extern int nwave; extern bool btxok; extern bool bTune; +extern int iqAmp; +extern int iqPhase; +extern int txPower; extern double outputLatency; -extern double txPower; -extern double iqAmp; -extern double iqPhase; + typedef struct //Parameters sent to or received from callback function { diff --git a/txtune.cpp b/txtune.cpp index db5c70adc..a36788869 100644 --- a/txtune.cpp +++ b/txtune.cpp @@ -2,9 +2,9 @@ #include "ui_txtune.h" #include -extern double txPower; -extern double iqAmp; -extern double iqPhase; +extern int txPower; +extern int iqAmp; +extern int iqPhase; extern bool bTune; TxTune::TxTune(QWidget *parent) : @@ -26,48 +26,65 @@ void TxTune::on_pwrSlider_valueChanged(int n) void TxTune::on_ampSlider_valueChanged(int n) { - iqAmp=1.0 + 0.001*n; - ui->ampSpinBox->setValue(iqAmp); + m_iqAmp1=n; + iqAmp=10*m_iqAmp1 + m_iqAmp2; + QString t; + t.sprintf("%.4f",1.0 + 0.0001*iqAmp); + ui->labAmpReal->setText(t); } +void TxTune::on_fineAmpSlider_valueChanged(int n) +{ + m_iqAmp2=n; + iqAmp=10*m_iqAmp1 + m_iqAmp2; + QString t; + t.sprintf("%.4f",1.0 + 0.0001*iqAmp); + ui->labAmpReal->setText(t);} + void TxTune::on_phaSlider_valueChanged(int n) { - iqPhase=0.1*n; - ui->phaSpinBox->setValue(iqPhase); + m_iqPha1=n; + iqPhase=10*m_iqPha1 + m_iqPha2; + QString t; + t.sprintf("%.2f",0.01*iqPhase); + ui->labPhaReal->setText(t); } -void TxTune::on_ampSpinBox_valueChanged(double d) +void TxTune::on_finePhaSlider_valueChanged(int n) { - iqAmp=d; - int n=1000.0*(iqAmp-1.0); - ui->ampSlider->setValue(n); + m_iqPha2=n; + iqPhase=10*m_iqPha1 + m_iqPha2; + QString t; + t.sprintf("%.2f",0.01*iqPhase); + ui->labPhaReal->setText(t); } -void TxTune::on_phaSpinBox_valueChanged(double d) +void TxTune::set_iqAmp(int n) { - iqPhase=d; - int n=10.0*iqPhase; - ui->phaSlider->setValue(n); + m_iqAmp1=n/10; + m_iqAmp2=n%10; + ui->ampSlider->setValue(m_iqAmp1); + ui->fineAmpSlider->setValue(m_iqAmp2); } -void TxTune::set_iqAmp(double d) +void TxTune::set_iqPhase(int n) { - ui->ampSpinBox->setValue(d); -} - -void TxTune::set_iqPhase(double d) -{ - ui->phaSpinBox->setValue(d); + m_iqPha1=n/10; + m_iqPha2=n%10; + ui->phaSlider->setValue(m_iqPha1); + ui->finePhaSlider->setValue(m_iqPha2); } void TxTune::on_cbTxImage_toggled(bool b) { ui->ampSlider->setEnabled(b); - ui->ampSpinBox->setEnabled(b); + ui->fineAmpSlider->setEnabled(b); ui->labAmp->setEnabled(b); + ui->labFineAmp->setEnabled(b); ui->phaSlider->setEnabled(b); - ui->phaSpinBox->setEnabled(b); + ui->finePhaSlider->setEnabled(b); ui->labPha->setEnabled(b); + ui->labFinePha->setEnabled(b); } void TxTune::on_pbTune_clicked() diff --git a/txtune.h b/txtune.h index ff449e3a2..7f69c7b0c 100644 --- a/txtune.h +++ b/txtune.h @@ -19,17 +19,21 @@ private slots: void on_pwrSlider_valueChanged(int n); void on_ampSlider_valueChanged(int n); void on_phaSlider_valueChanged(int n); - void on_ampSpinBox_valueChanged(double d); - void on_phaSpinBox_valueChanged(double d); void on_cbTxImage_toggled(bool b); void on_pbTune_clicked(); + void on_fineAmpSlider_valueChanged(int n); + void on_finePhaSlider_valueChanged(int n); public: - void set_iqAmp(double d); - void set_iqPhase(double d); + void set_iqAmp(int n); + void set_iqPhase(int n); private: - Ui::TxTune *ui; + qint32 m_iqAmp1; + qint32 m_iqAmp2; + qint32 m_iqPha1; + qint32 m_iqPha2; + Ui::TxTune *ui; }; #endif // TXTUNE_H diff --git a/txtune.ui b/txtune.ui index 86f27a762..11a9c1ae4 100644 --- a/txtune.ui +++ b/txtune.ui @@ -35,10 +35,10 @@ - 12 - 64 - 371 - 141 + 13 + 38 + 351 + 191 @@ -81,10 +81,10 @@ - + - Enable Tx Image Adjustment + Enable Tx I/Q Adjustment @@ -104,29 +104,61 @@ - - + + false - - 3 - - 0.950000000000000 + -100 - 1.050000000000000 - - - 0.001000000000000 + 100 - 1.000000000000000 + 0 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + false + + + Fine: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + -100 + + + 100 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + + false @@ -140,9 +172,12 @@ I/Q Phase: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + - + false @@ -164,38 +199,29 @@ - - + + false - - 1 + + Fine: - - -10.000000000000000 - - - 10.000000000000000 - - - 0.100000000000000 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + false - -50 + -100 - 50 - - - 0 + 100 Qt::Horizontal @@ -205,6 +231,26 @@ + + + + 1.0000 + + + Qt::AlignCenter + + + + + + + 0.000 + + + Qt::AlignCenter + + +