Added "Tune" button.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3168 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-04-14 14:11:20 +00:00
parent 2277827bb3
commit fa29bab31d
5 changed files with 54 additions and 15 deletions

View File

@ -38,12 +38,6 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) :
"QLabel { background-color : black; color : yellow; }");
ui->labDialFreq->setStyleSheet( \
"QLabel { background-color : black; color : yellow; }");
/*
ui->labTol1->setStyleSheet( \
"QLabel { background-color : white; color : black; }");
ui->labTol1->setFrameStyle(QFrame::Panel | QFrame::Sunken);
ui->dxStationGroupBox->setStyleSheet("QFrame{border: 5px groove red}");
*/
QActionGroup* paletteGroup = new QActionGroup(this);
ui->actionCuteSDR->setActionGroup(paletteGroup);
ui->actionLinrad->setActionGroup(paletteGroup);
@ -181,6 +175,7 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) :
m_msErase=0;
m_sent73=false;
m_watchdogLimit=5;
m_tune=false;
decodeBusy(false);
ui->xThermo->setFillBrush(Qt::green);
@ -222,6 +217,10 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) :
m_pbAutoOn_style="QPushButton{background-color: red; \
border-style: outset; border-width: 1px; border-radius: 5px; \
border-color: black; min-width: 5em; padding: 3px;}";
m_pbTune_style="QPushButton{background-color: red; \
border-style: outset; border-width: 1px; border-radius: 5px; \
border-color: black; min-width: 5em; padding: 3px;}";
genStdMsgs(m_rpt);
on_actionWide_Waterfall_triggered(); //###
g_pWideGraph->setTxFreq(m_txFreq);
@ -710,6 +709,7 @@ void MainWindow::on_autoButton_clicked() //Auto
void MainWindow::on_stopTxButton_clicked() //Stop Tx
{
if(m_tune) on_tuneButton_clicked();
if(m_auto) on_autoButton_clicked();
btxok=false;
}
@ -1386,9 +1386,9 @@ void MainWindow::guiUpdate()
int nsec=ms/1000;
double tsec=0.001*ms;
double t2p=fmod(tsec,2*m_TRperiod);
bool bTxTime = (t2p >= tx1) && (t2p < tx2);
bool bTxTime = ((t2p >= tx1) and (t2p < tx2)) or m_tune;
if(m_auto) {
if(m_auto or m_tune) {
QFile f("txboth");
if(f.exists() and fmod(tsec,m_TRperiod) < (1.0 + 85.0*m_nsps/12000.0)) {
@ -1396,7 +1396,8 @@ void MainWindow::guiUpdate()
}
float fTR=float((nsec%m_TRperiod))/m_TRperiod;
if(bTxTime and m_iptt==0 and !btxMute and fTR<0.4) {
// if(bTxTime and m_iptt==0 and !btxMute and fTR<0.4) {
if(m_iptt==0 and ((bTxTime and !btxMute and fTR<0.4) or m_tune )) {
icw[0]=m_ncw;
//Raise PTT
@ -1439,6 +1440,7 @@ void MainWindow::guiUpdate()
genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1);
msgsent[22]=0;
QString t=QString::fromAscii(msgsent);
if(m_tune) t="TUNE";
lab5->setText("Last Tx: " + t);
if(m_restart) {
QFile f("ALL.TXT");
@ -1519,7 +1521,7 @@ void MainWindow::guiUpdate()
out << QDateTime::currentDateTimeUtc().toString("hhmm")
<< " Transmitting: " << t << endl;
f.close();
if(m_tx2QSO) displayTxMsg(t);
if(m_tx2QSO and !m_tune) displayTxMsg(t);
}
if(!btxok && btxok0 && m_iptt==1) stopTx();
@ -1594,11 +1596,11 @@ void MainWindow::guiUpdate()
m_hsym0=khsym;
m_sec0=nsec;
//###
m_cmnd=rig_command() + " f";
p3.start(m_cmnd);
p3.waitForFinished();
//###
if(m_catEnabled) {
m_cmnd=rig_command() + " f";
p3.start(m_cmnd);
p3.waitForFinished();
}
}
iptt0=m_iptt;
@ -2538,3 +2540,16 @@ void MainWindow::on_actionTx2QSO_triggered(bool checked)
{
m_tx2QSO=checked;
}
void MainWindow::on_tuneButton_clicked()
{
m_tune=!m_tune;
soundOutThread.setTune(m_tune);
if(m_tune) {
ui->tuneButton->setStyleSheet(m_pbTune_style);
} else {
btxok=false;
ui->tuneButton->setStyleSheet("");
on_monitorButton_clicked();
}
}

View File

@ -151,6 +151,7 @@ private slots:
void on_actionRunaway_Tx_watchdog_triggered(bool checked);
void on_actionTx2QSO_triggered(bool checked);
void killFile();
void on_tuneButton_clicked();
private:
Ui::MainWindow *ui;
@ -245,6 +246,7 @@ private:
bool m_sent73;
bool m_runaway;
bool m_tx2QSO;
bool m_tune;
char m_decoded[80];
@ -281,6 +283,7 @@ private:
QString m_pbdecoding_style1;
QString m_pbmonitor_style;
QString m_pbAutoOn_style;
QString m_pbTune_style;
QString m_myCall;
QString m_myGrid;
QString m_baseCall;

View File

@ -458,6 +458,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="tuneButton">
<property name="text">
<string>&amp;Tune</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="autoButton">
<property name="sizePolicy">

View File

@ -22,6 +22,7 @@ typedef struct //Parameters sent to or received from callback function
int ncall;
bool txMute;
bool bRestart;
bool btune;
} paUserData;
//--------------------------------------------------------------- d2aCallback
@ -57,6 +58,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
srand(mstr); //Initialize random seed
}
isym=ic/(4*udata->nsps); //Actual fsample=48000
if(udata->btune) isym=0; //If tuning, send pure tone
if(udata->txsnrdb < 0.0) {
snr=pow(10.0,0.05*(udata->txsnrdb-6.0));
fac=3000.0;
@ -100,6 +102,10 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
amp=32767.0;
int i0=84.983*4.0*udata->nsps;
int i1=85*4*udata->nsps;
if(udata->btune) { //If tuning, no ramp down
i0=999*udata->nsps;
i1=i0;
}
for(uint i=0 ; i<framesToProcess; i++ ) {
phi += dphi;
if(phi>twopi) phi -= twopi;
@ -154,6 +160,7 @@ void SoundOutThread::run()
udata.ncall=0;
udata.txMute=m_txMute;
udata.bRestart=true;
udata.btune=m_tune;
paerr=Pa_OpenStream(&outStream, //Output stream
NULL, //No input parameters
@ -219,6 +226,11 @@ void SoundOutThread::setTxSNR(double snr)
m_txsnrdb=snr;
}
void SoundOutThread::setTune(bool b)
{
m_tune=b;
}
double SoundOutThread::samFacOut()
{
return m_SamFacOut;

View File

@ -28,6 +28,7 @@ public:
void setPeriod(int ntrperiod, int nsps);
void setTxFreq(int n);
void setTxSNR(double snr);
void setTune(bool b);
double samFacOut();
bool quitExecution; //If true, thread exits gracefully
@ -41,6 +42,7 @@ private:
qint32 m_txFreq;
bool m_txOK; //Enable Tx audio
bool m_txMute; //Mute temporarily
bool m_tune;
};
#endif