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 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();

View File

@ -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
{

View File

@ -2,9 +2,9 @@
#include "ui_txtune.h"
#include <QDebug>
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()

View File

@ -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

120
txtune.ui
View File

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