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
This commit is contained in:
Joe Taylor 2014-01-15 21:44:12 +00:00
parent 93b6755e4b
commit 8422bf21a6
5 changed files with 147 additions and 77 deletions

View File

@ -19,9 +19,9 @@ int nwave; //Length of Tx waveform
bool btxok; //True if OK to transmit bool btxok; //True if OK to transmit
bool bTune; bool bTune;
double outputLatency; //Latency in seconds double outputLatency; //Latency in seconds
double txPower; int txPower;
double iqAmp; int iqAmp;
double iqPhase; int iqPhase;
qint16 id[4*60*96000]; qint16 id[4*60*96000];
Astro* g_pAstro = NULL; Astro* g_pAstro = NULL;
@ -152,9 +152,9 @@ MainWindow::MainWindow(QWidget *parent) :
m_nfast=1; m_nfast=1;
m_nsave=0; m_nsave=0;
bTune=false; bTune=false;
txPower=1.0; txPower=100;
iqAmp=1.0; iqAmp=0;
iqPhase=0.0; iqPhase=0;
ui->xThermo->setFillBrush(Qt::green); ui->xThermo->setFillBrush(Qt::green);
ui->yThermo->setFillBrush(Qt::magenta); ui->yThermo->setFillBrush(Qt::magenta);
@ -339,6 +339,7 @@ void MainWindow::writeSettings()
settings.setValue("Editor",m_editorCommand); settings.setValue("Editor",m_editorCommand);
settings.setValue("DXCCpfx",m_dxccPfx); settings.setValue("DXCCpfx",m_dxccPfx);
settings.setValue("Timeout",m_timeout); settings.setValue("Timeout",m_timeout);
settings.setValue("TxPower",txPower);
settings.setValue("IQamp",iqAmp); settings.setValue("IQamp",iqAmp);
settings.setValue("IQphase",iqPhase); settings.setValue("IQphase",iqPhase);
settings.setValue("ApplyIQcal",m_applyIQcal); settings.setValue("ApplyIQcal",m_applyIQcal);
@ -416,8 +417,9 @@ void MainWindow::readSettings()
m_editorCommand=settings.value("Editor","notepad").toString(); m_editorCommand=settings.value("Editor","notepad").toString();
m_dxccPfx=settings.value("DXCCpfx","").toString(); m_dxccPfx=settings.value("DXCCpfx","").toString();
m_timeout=settings.value("Timeout",20).toInt(); m_timeout=settings.value("Timeout",20).toInt();
iqAmp=settings.value("IQamp",1.0000).toDouble(); txPower=settings.value("TxPower",100).toInt();
iqPhase=settings.value("IQphase",0.0).toDouble(); iqAmp=settings.value("IQamp",0).toInt();
iqPhase=settings.value("IQphase",0).toInt();
m_applyIQcal=settings.value("ApplyIQcal",0).toInt(); m_applyIQcal=settings.value("ApplyIQcal",0).toInt();
ui->actionApply_IQ_Calibration->setChecked(m_applyIQcal!=0); ui->actionApply_IQ_Calibration->setChecked(m_applyIQcal!=0);
m_dPhi=settings.value("dPhi",0).toInt(); m_dPhi=settings.value("dPhi",0).toInt();

View File

@ -12,10 +12,11 @@ extern short int iwave[2*60*11025]; //Wave file for Tx audio
extern int nwave; extern int nwave;
extern bool btxok; extern bool btxok;
extern bool bTune; extern bool bTune;
extern int iqAmp;
extern int iqPhase;
extern int txPower;
extern double outputLatency; extern double outputLatency;
extern double txPower;
extern double iqAmp;
extern double iqPhase;
typedef struct //Parameters sent to or received from callback function typedef struct //Parameters sent to or received from callback function
{ {

View File

@ -2,9 +2,9 @@
#include "ui_txtune.h" #include "ui_txtune.h"
#include <QDebug> #include <QDebug>
extern double txPower; extern int txPower;
extern double iqAmp; extern int iqAmp;
extern double iqPhase; extern int iqPhase;
extern bool bTune; extern bool bTune;
TxTune::TxTune(QWidget *parent) : TxTune::TxTune(QWidget *parent) :
@ -26,48 +26,65 @@ void TxTune::on_pwrSlider_valueChanged(int n)
void TxTune::on_ampSlider_valueChanged(int n) void TxTune::on_ampSlider_valueChanged(int n)
{ {
iqAmp=1.0 + 0.001*n; m_iqAmp1=n;
ui->ampSpinBox->setValue(iqAmp); 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) void TxTune::on_phaSlider_valueChanged(int n)
{ {
iqPhase=0.1*n; m_iqPha1=n;
ui->phaSpinBox->setValue(iqPhase); 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; m_iqPha2=n;
int n=1000.0*(iqAmp-1.0); iqPhase=10*m_iqPha1 + m_iqPha2;
ui->ampSlider->setValue(n); 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; m_iqAmp1=n/10;
int n=10.0*iqPhase; m_iqAmp2=n%10;
ui->phaSlider->setValue(n); 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); m_iqPha1=n/10;
} m_iqPha2=n%10;
ui->phaSlider->setValue(m_iqPha1);
void TxTune::set_iqPhase(double d) ui->finePhaSlider->setValue(m_iqPha2);
{
ui->phaSpinBox->setValue(d);
} }
void TxTune::on_cbTxImage_toggled(bool b) void TxTune::on_cbTxImage_toggled(bool b)
{ {
ui->ampSlider->setEnabled(b); ui->ampSlider->setEnabled(b);
ui->ampSpinBox->setEnabled(b); ui->fineAmpSlider->setEnabled(b);
ui->labAmp->setEnabled(b); ui->labAmp->setEnabled(b);
ui->labFineAmp->setEnabled(b);
ui->phaSlider->setEnabled(b); ui->phaSlider->setEnabled(b);
ui->phaSpinBox->setEnabled(b); ui->finePhaSlider->setEnabled(b);
ui->labPha->setEnabled(b); ui->labPha->setEnabled(b);
ui->labFinePha->setEnabled(b);
} }
void TxTune::on_pbTune_clicked() void TxTune::on_pbTune_clicked()

View File

@ -19,17 +19,21 @@ private slots:
void on_pwrSlider_valueChanged(int n); void on_pwrSlider_valueChanged(int n);
void on_ampSlider_valueChanged(int n); void on_ampSlider_valueChanged(int n);
void on_phaSlider_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_cbTxImage_toggled(bool b);
void on_pbTune_clicked(); void on_pbTune_clicked();
void on_fineAmpSlider_valueChanged(int n);
void on_finePhaSlider_valueChanged(int n);
public: public:
void set_iqAmp(double d); void set_iqAmp(int n);
void set_iqPhase(double d); void set_iqPhase(int n);
private: private:
Ui::TxTune *ui; qint32 m_iqAmp1;
qint32 m_iqAmp2;
qint32 m_iqPha1;
qint32 m_iqPha2;
Ui::TxTune *ui;
}; };
#endif // TXTUNE_H #endif // TXTUNE_H

120
txtune.ui
View File

@ -35,10 +35,10 @@
<widget class="QWidget" name=""> <widget class="QWidget" name="">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>12</x> <x>13</x>
<y>64</y> <y>38</y>
<width>371</width> <width>351</width>
<height>141</height> <height>191</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
@ -81,10 +81,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="3"> <item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="cbTxImage"> <widget class="QCheckBox" name="cbTxImage">
<property name="text"> <property name="text">
<string>Enable Tx Image Adjustment</string> <string>Enable Tx I/Q Adjustment</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -104,29 +104,61 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="1">
<widget class="QDoubleSpinBox" name="ampSpinBox"> <widget class="QSlider" name="ampSlider">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum"> <property name="minimum">
<double>0.950000000000000</double> <number>-100</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>1.050000000000000</double> <number>100</number>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>1.000000000000000</double> <number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="labFineAmp">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Fine:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSlider" name="fineAmpSlider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labPha"> <widget class="QLabel" name="labPha">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -140,9 +172,12 @@
<property name="text"> <property name="text">
<string>I/Q Phase:</string> <string>I/Q Phase:</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QSlider" name="phaSlider"> <widget class="QSlider" name="phaSlider">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -164,38 +199,29 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="5" column="0">
<widget class="QDoubleSpinBox" name="phaSpinBox"> <widget class="QLabel" name="labFinePha">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="decimals"> <property name="text">
<number>1</number> <string>Fine:</string>
</property> </property>
<property name="minimum"> <property name="alignment">
<double>-10.000000000000000</double> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="5" column="1">
<widget class="QSlider" name="ampSlider"> <widget class="QSlider" name="finePhaSlider">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>-50</number> <number>-100</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>50</number> <number>100</number>
</property>
<property name="value">
<number>0</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -205,6 +231,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2">
<widget class="QLabel" name="labAmpReal">
<property name="text">
<string>1.0000</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="labPhaReal">
<property name="text">
<string>0.000</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>