diff --git a/mainwindow.cpp b/mainwindow.cpp index b209f6fa1..e4005ba2e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -17,6 +17,7 @@ short int iwave[2*60*11025]; //Wave file for Tx audio int nwave; //Length of Tx waveform bool btxok; //True if OK to transmit +bool bTune; double outputLatency; //Latency in seconds double txPower; double iqAmp; @@ -150,6 +151,7 @@ MainWindow::MainWindow(QWidget *parent) : m_colors="000066ff0000ffff00969696646464"; m_nfast=1; m_nsave=0; + bTune=false; txPower=1.0; iqAmp=1.0; iqPhase=0.0; @@ -337,8 +339,8 @@ void MainWindow::writeSettings() settings.setValue("Editor",m_editorCommand); settings.setValue("DXCCpfx",m_dxccPfx); settings.setValue("Timeout",m_timeout); - settings.setValue("IQamp",m_IQamp); - settings.setValue("IQphase",m_IQphase); + settings.setValue("IQamp",iqAmp); + settings.setValue("IQphase",iqPhase); settings.setValue("ApplyIQcal",m_applyIQcal); settings.setValue("dPhi",m_dPhi); settings.setValue("Fcal",m_fCal); @@ -414,8 +416,8 @@ void MainWindow::readSettings() m_editorCommand=settings.value("Editor","notepad").toString(); m_dxccPfx=settings.value("DXCCpfx","").toString(); m_timeout=settings.value("Timeout",20).toInt(); - m_IQamp=settings.value("IQamp",1.0000).toDouble(); - m_IQphase=settings.value("IQphase",0.0).toDouble(); + iqAmp=settings.value("IQamp",1.0000).toDouble(); + iqPhase=settings.value("IQphase",0.0).toDouble(); m_applyIQcal=settings.value("ApplyIQcal",0).toInt(); ui->actionApply_IQ_Calibration->setChecked(m_applyIQcal!=0); m_dPhi=settings.value("dPhi",0).toInt(); @@ -2114,13 +2116,8 @@ void MainWindow::on_actionTx_Tune_triggered() { if(g_pTxTune==NULL) { g_pTxTune = new TxTune(0); - /* - g_pTxTune->setWindowTitle("Astronomical Data"); - Qt::WindowFlags flags = Qt::Dialog | Qt::WindowCloseButtonHint | - Qt::WindowMinimizeButtonHint; - g_pTxTune->setWindowFlags(flags); - g_pTxTune->setGeometry(m_astroGeom); - */ } + g_pTxTune->set_iqAmp(iqAmp); + g_pTxTune->set_iqPhase(iqPhase); g_pTxTune->show(); } diff --git a/mainwindow.h b/mainwindow.h index bf72ebd6a..fb6addcf8 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -164,8 +164,8 @@ private: qint32 m_TRperiod; double m_fAdd; - double m_IQamp; - double m_IQphase; +// double m_IQamp; +// double m_IQphase; double m_cal570; bool m_monitoring; diff --git a/map65.iss b/map65.iss index b7ff5f9d6..a695765f3 100644 --- a/map65.iss +++ b/map65.iss @@ -1,6 +1,6 @@ [Setup] AppName=MAP65 -AppVerName=MAP65 Version 2.5 r3597 +AppVerName=MAP65 Version 2.5 r3603 AppCopyright=Copyright (C) 2001-2013 by Joe Taylor, K1JT DefaultDirName=c:\MAP65 DefaultGroupName=MAP65 diff --git a/soundout.cpp b/soundout.cpp index fefa24cf9..531f59efd 100644 --- a/soundout.cpp +++ b/soundout.cpp @@ -11,6 +11,7 @@ extern float gran(); //Noise generator (for tests only) extern short int iwave[2*60*11025]; //Wave file for Tx audio extern int nwave; extern bool btxok; +extern bool bTune; extern double outputLatency; extern double txPower; extern double iqAmp; @@ -39,12 +40,18 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, int nsec; int nTRperiod=udata->nTRperiod; -// qDebug() << txPower << iqAmp << iqPhase; + // Get System time qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; tsec = 0.001*ms; nsec = ms/1000; + static int nsec0=0; + if(nsec!=nsec0) { + qDebug() << txPower << iqAmp << iqPhase << bTune; + nsec0=nsec; + } + if(btxok and !btxok0) { //Start (or re-start) a transmission n=nsec/nTRperiod; tstart=tsec - n*nTRperiod - 1.0; diff --git a/txtune.cpp b/txtune.cpp index 12b18c869..db5c70adc 100644 --- a/txtune.cpp +++ b/txtune.cpp @@ -5,6 +5,7 @@ extern double txPower; extern double iqAmp; extern double iqPhase; +extern bool bTune; TxTune::TxTune(QWidget *parent) : QDialog(parent), @@ -26,9 +27,56 @@ void TxTune::on_pwrSlider_valueChanged(int n) void TxTune::on_ampSlider_valueChanged(int n) { iqAmp=1.0 + 0.001*n; + ui->ampSpinBox->setValue(iqAmp); } void TxTune::on_phaSlider_valueChanged(int n) { iqPhase=0.1*n; + ui->phaSpinBox->setValue(iqPhase); +} + +void TxTune::on_ampSpinBox_valueChanged(double d) +{ + iqAmp=d; + int n=1000.0*(iqAmp-1.0); + ui->ampSlider->setValue(n); +} + +void TxTune::on_phaSpinBox_valueChanged(double d) +{ + iqPhase=d; + int n=10.0*iqPhase; + ui->phaSlider->setValue(n); +} + +void TxTune::set_iqAmp(double d) +{ + ui->ampSpinBox->setValue(d); +} + +void TxTune::set_iqPhase(double d) +{ + ui->phaSpinBox->setValue(d); +} + +void TxTune::on_cbTxImage_toggled(bool b) +{ + ui->ampSlider->setEnabled(b); + ui->ampSpinBox->setEnabled(b); + ui->labAmp->setEnabled(b); + ui->phaSlider->setEnabled(b); + ui->phaSpinBox->setEnabled(b); + ui->labPha->setEnabled(b); +} + +void TxTune::on_pbTune_clicked() +{ + bTune = !bTune; + if(bTune) { + QString style="QPushButton{background-color: red;}"; + ui->pbTune->setStyleSheet(style); + } else { + ui->pbTune->setStyleSheet(""); + } } diff --git a/txtune.h b/txtune.h index f9a448aa1..ff449e3a2 100644 --- a/txtune.h +++ b/txtune.h @@ -19,6 +19,14 @@ 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(); + +public: + void set_iqAmp(double d); + void set_iqPhase(double d); private: Ui::TxTune *ui; diff --git a/txtune.ui b/txtune.ui index 7345d35e1..86f27a762 100644 --- a/txtune.ui +++ b/txtune.ui @@ -35,9 +35,9 @@ - 20 - 40 - 331 + 12 + 64 + 371 141 @@ -55,67 +55,6 @@ - - - - - 70 - 0 - - - - I/Q Amplitude: - - - - - - - -100 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - - 70 - 0 - - - - I/Q Phase: - - - - - - - -100 - - - 100 - - - 0 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - @@ -135,6 +74,137 @@ + + + + Tune + + + + + + + Enable Tx Image Adjustment + + + + + + + false + + + + 70 + 0 + + + + I/Q Amplitude: + + + + + + + false + + + 3 + + + 0.950000000000000 + + + 1.050000000000000 + + + 0.001000000000000 + + + 1.000000000000000 + + + + + + + false + + + + 70 + 0 + + + + I/Q Phase: + + + + + + + false + + + -100 + + + 100 + + + 0 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + + + + + false + + + 1 + + + -10.000000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + + + + + false + + + -50 + + + 50 + + + 0 + + + Qt::Horizontal + + + QSlider::TicksBelow + + +