Starting to add "Tx Tune" functions.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@3603 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-11-11 17:02:37 +00:00
parent e34cbfead7
commit ba4f27518a
10 changed files with 282 additions and 13 deletions

View File

@ -8,6 +8,7 @@
#include "widegraph.h" #include "widegraph.h"
#include "messages.h" #include "messages.h"
#include "bandmap.h" #include "bandmap.h"
#include "txtune.h"
#include "sleep.h" #include "sleep.h"
#include <portaudio.h> #include <portaudio.h>
@ -17,12 +18,16 @@ short int iwave[2*60*11025]; //Wave file for Tx audio
int nwave; //Length of Tx waveform int nwave; //Length of Tx waveform
bool btxok; //True if OK to transmit bool btxok; //True if OK to transmit
double outputLatency; //Latency in seconds double outputLatency; //Latency in seconds
double txPower;
double iqAmp;
double iqPhase;
qint16 id[4*60*96000]; qint16 id[4*60*96000];
Astro* g_pAstro = NULL; Astro* g_pAstro = NULL;
WideGraph* g_pWideGraph = NULL; WideGraph* g_pWideGraph = NULL;
Messages* g_pMessages = NULL; Messages* g_pMessages = NULL;
BandMap* g_pBandMap = NULL; BandMap* g_pBandMap = NULL;
TxTune* g_pTxTune = NULL;
QSharedMemory mem_m65("mem_m65"); QSharedMemory mem_m65("mem_m65");
QString rev="$Rev$"; QString rev="$Rev$";
@ -145,6 +150,9 @@ MainWindow::MainWindow(QWidget *parent) :
m_colors="000066ff0000ffff00969696646464"; m_colors="000066ff0000ffff00969696646464";
m_nfast=1; m_nfast=1;
m_nsave=0; m_nsave=0;
txPower=1.0;
iqAmp=1.0;
iqPhase=0.0;
ui->xThermo->setFillBrush(Qt::green); ui->xThermo->setFillBrush(Qt::green);
ui->yThermo->setFillBrush(Qt::magenta); ui->yThermo->setFillBrush(Qt::magenta);
@ -2101,3 +2109,18 @@ void MainWindow::on_actionEdit_wsjt_log_triggered()
QString cmnd=m_editorCommand + " " + m_appDir + "/wsjt.log"; QString cmnd=m_editorCommand + " " + m_appDir + "/wsjt.log";
proc_editor.start(QDir::toNativeSeparators(cmnd)); proc_editor.start(QDir::toNativeSeparators(cmnd));
} }
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->show();
}

View File

@ -118,18 +118,13 @@ private slots:
void on_NBslider_valueChanged(int value); void on_NBslider_valueChanged(int value);
void on_actionAdjust_IQ_Calibration_triggered(); void on_actionAdjust_IQ_Calibration_triggered();
void on_actionApply_IQ_Calibration_triggered(); void on_actionApply_IQ_Calibration_triggered();
void on_actionAFMHot_triggered(); void on_actionAFMHot_triggered();
void on_actionBlue_triggered(); void on_actionBlue_triggered();
void on_actionFUNcube_Dongle_triggered(); void on_actionFUNcube_Dongle_triggered();
void on_actionJT65B2_triggered(); void on_actionJT65B2_triggered();
void on_actionJT65C2_triggered(); void on_actionJT65C2_triggered();
void on_actionEdit_wsjt_log_triggered(); void on_actionEdit_wsjt_log_triggered();
void on_actionTx_Tune_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;

View File

@ -1167,6 +1167,7 @@ p, li { white-space: pre-wrap; }
<addaction name="actionAdjust_IQ_Calibration"/> <addaction name="actionAdjust_IQ_Calibration"/>
<addaction name="actionApply_IQ_Calibration"/> <addaction name="actionApply_IQ_Calibration"/>
<addaction name="actionFind_Delta_Phi"/> <addaction name="actionFind_Delta_Phi"/>
<addaction name="actionTx_Tune"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionF4_sets_Tx6"/> <addaction name="actionF4_sets_Tx6"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -1540,7 +1541,7 @@ p, li { white-space: pre-wrap; }
</action> </action>
<action name="actionAdjust_IQ_Calibration"> <action name="actionAdjust_IQ_Calibration">
<property name="text"> <property name="text">
<string>Adjust I/Q Calibration</string> <string>Adjust Rx I/Q Calibration</string>
</property> </property>
</action> </action>
<action name="actionApply_IQ_Calibration"> <action name="actionApply_IQ_Calibration">
@ -1548,7 +1549,7 @@ p, li { white-space: pre-wrap; }
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Apply I/Q Calibration</string> <string>Apply Rx I/Q Calibration</string>
</property> </property>
</action> </action>
<action name="actionAFMHot"> <action name="actionAFMHot">
@ -1596,6 +1597,14 @@ p, li { white-space: pre-wrap; }
<string>Alt+Shift+E</string> <string>Alt+Shift+E</string>
</property> </property>
</action> </action>
<action name="actionTx_Tune">
<property name="text">
<string>Tx Tune</string>
</property>
<property name="shortcut">
<string>Alt+T</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>

View File

@ -35,7 +35,8 @@ QMAKE_EXTRA_COMPILERS += gfortran
SOURCES += main.cpp mainwindow.cpp plotter.cpp about.cpp \ SOURCES += main.cpp mainwindow.cpp plotter.cpp about.cpp \
soundin.cpp soundout.cpp devsetup.cpp \ soundin.cpp soundout.cpp devsetup.cpp \
widegraph.cpp getfile.cpp messages.cpp bandmap.cpp \ widegraph.cpp getfile.cpp messages.cpp bandmap.cpp \
astro.cpp displaytext.cpp getdev.cpp astro.cpp displaytext.cpp getdev.cpp \
txtune.cpp
win32 { win32 {
SOURCES += killbyname.cpp set570.cpp SOURCES += killbyname.cpp set570.cpp
@ -44,11 +45,13 @@ SOURCES += killbyname.cpp set570.cpp
HEADERS += mainwindow.h plotter.h soundin.h soundout.h \ HEADERS += mainwindow.h plotter.h soundin.h soundout.h \
about.h devsetup.h widegraph.h getfile.h messages.h \ about.h devsetup.h widegraph.h getfile.h messages.h \
bandmap.h commons.h sleep.h astro.h displaytext.h \ bandmap.h commons.h sleep.h astro.h displaytext.h \
txtune.h
DEFINES += __cplusplus DEFINES += __cplusplus
FORMS += mainwindow.ui about.ui devsetup.ui widegraph.ui \ FORMS += mainwindow.ui about.ui devsetup.ui widegraph.ui \
messages.ui bandmap.ui astro.ui messages.ui bandmap.ui astro.ui \
txtune.ui
RC_FILE = map65.rc RC_FILE = map65.rc

View File

@ -357,6 +357,7 @@ void CPlotter::DrawOverlay() //DrawOverlay()
} }
df=m_fSample/32768.0; df=m_fSample/32768.0;
if(m_bLockTxRx) m_TxDF=m_DF;
x = (m_DF + m_mode65*66*11025.0/4096.0 - m_ZoomStartFreq)/df; x = (m_DF + m_mode65*66*11025.0/4096.0 - m_ZoomStartFreq)/df;
QPen pen2(Qt::darkGreen, 3); //Mark top JT65B tone with dark Green tick QPen pen2(Qt::darkGreen, 3); //Mark top JT65B tone with dark Green tick
painter3.setPen(pen2); painter3.setPen(pen2);

View File

@ -12,6 +12,9 @@ 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 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
{ {
@ -36,6 +39,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
int nsec; int nsec;
int nTRperiod=udata->nTRperiod; int nTRperiod=udata->nTRperiod;
// qDebug() << txPower << iqAmp << iqPhase;
// Get System time // Get System time
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
tsec = 0.001*ms; tsec = 0.001*ms;

34
txtune.cpp Normal file
View File

@ -0,0 +1,34 @@
#include "txtune.h"
#include "ui_txtune.h"
#include <QDebug>
extern double txPower;
extern double iqAmp;
extern double iqPhase;
TxTune::TxTune(QWidget *parent) :
QDialog(parent),
ui(new Ui::TxTune)
{
ui->setupUi(this);
}
TxTune::~TxTune()
{
delete ui;
}
void TxTune::on_pwrSlider_valueChanged(int n)
{
txPower=0.01*n;
}
void TxTune::on_ampSlider_valueChanged(int n)
{
iqAmp=1.0 + 0.001*n;
}
void TxTune::on_phaSlider_valueChanged(int n)
{
iqPhase=0.1*n;
}

27
txtune.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef TXTUNE_H
#define TXTUNE_H
#include <QDialog>
namespace Ui {
class TxTune;
}
class TxTune : public QDialog
{
Q_OBJECT
public:
explicit TxTune(QWidget *parent = 0);
~TxTune();
private slots:
void on_pwrSlider_valueChanged(int n);
void on_ampSlider_valueChanged(int n);
void on_phaSlider_valueChanged(int n);
private:
Ui::TxTune *ui;
};
#endif // TXTUNE_H

176
txtune.ui Normal file
View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TxTune</class>
<widget class="QDialog" name="TxTune">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Tx Tune</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>331</width>
<height>141</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Tx Power:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>I/Q Amplitude:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="ampSlider">
<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="2" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>I/Q Phase:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSlider" name="phaSlider">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSlider" name="pwrSlider">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>TxTune</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>TxTune</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -58,12 +58,9 @@ WideGraph::~WideGraph()
void WideGraph::resizeEvent(QResizeEvent* ) //resizeEvent() void WideGraph::resizeEvent(QResizeEvent* ) //resizeEvent()
{ {
if(!size().isValid()) return; if(!size().isValid()) return;
// m_Size = size();
int w = size().width(); int w = size().width();
int h = size().height(); int h = size().height();
// qDebug() << "A" << w << h << ui->labFreq->geometry();
ui->labFreq->setGeometry(QRect(w-160,h-100,131,41)); ui->labFreq->setGeometry(QRect(w-160,h-100,131,41));
// qDebug() << "B" << w << h << ui->labFreq->geometry();
} }
void WideGraph::saveSettings() void WideGraph::saveSettings()