OK, we have a functioning TUNE button. Needs testing.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@3641 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2014-01-16 19:28:52 +00:00
parent fecbe8a7fc
commit 22af47db87
2 changed files with 32 additions and 9 deletions

View File

@ -1385,6 +1385,7 @@ void MainWindow::guiUpdate()
static int iptt0=0;
static int iptt=0;
static bool btxok0=false;
static bool bTune0=false;
static int nc0=1;
static int nc1=1;
static char msgsent[23];
@ -1402,10 +1403,13 @@ void MainWindow::guiUpdate()
int nsec=ms/1000;
double tsec=0.001*ms;
double t2p=fmod(tsec,120.0/m_nfast);
bool bTxTime = t2p >= tx1 && t2p < tx2;
bool bTxTime = (t2p >= tx1) and (t2p < tx2);
if(m_auto) {
if(bTxTime and iptt==0 and !m_txMute) {
if(bTune0 and !bTune) btxok=false;
bTune0=bTune;
if(m_auto or bTune) {
if((bTxTime or bTune) and iptt==0 and !m_txMute) {
int itx=1;
int ierr = ptt_(&m_pttPort,&itx,&iptt); // Raise PTT
if(ierr != 0) {
@ -1421,7 +1425,7 @@ void MainWindow::guiUpdate()
soundOutThread.start(QThread::HighPriority);
}
}
if(!bTxTime || m_txMute) {
if((!bTxTime and !bTune) or m_txMute) {
btxok=false;
}
}
@ -1485,7 +1489,10 @@ void MainWindow::guiUpdate()
if(m_bIQxt) g_pWideGraph->rx570(); // Set Si570 back to Rx Freq
int itx=0;
ptt_(&m_pttPort,&itx,&iptt); // Lower PTT
if(!m_txMute) soundOutThread.quitExecution=true;
if(!m_txMute) {
// qDebug() << "C";
soundOutThread.quitExecution=true;\
}
m_transmitting=false;
g_pWideGraph->enableSetRxHardware(true);
if(m_auto) {
@ -1517,6 +1524,7 @@ void MainWindow::guiUpdate()
if(nsec != m_sec0) { //Once per second
// qDebug() << txPower << iqAmp << iqPhase;
// qDebug() << "B" << bTune << bTxTime << btxok;
soundInThread.setForceCenterFreqMHz(g_pWideGraph->m_dForceCenterFreq);
soundInThread.setForceCenterFreqBool(g_pWideGraph->m_bForceCenterFreq);

View File

@ -36,8 +36,10 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
static int n;
static int ic=0;
static bool btxok0=false;
static bool bTune0=false;
static int nStart=0;
double tsec,tstart;
static double phi=0.;
double tsec,tstart,dphi;
int nsec;
int nTRperiod=udata->nTRperiod;
@ -49,10 +51,19 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
qreal amp=1.0 + 0.0001*iqAmp;
qreal xAmp=txPower*295.00*qSqrt(2.0 - amp*amp);
qreal yAmp=txPower*295.00*amp;
static int nsec0=0;
if(bTune) {
ic=0;
dphi=6.28318530718*1270.46/11025.0;
}
if(bTune0 and !bTune) btxok=false;
bTune0=bTune;
if(nsec!=nsec0) {
// qDebug() << txPower << iqAmp << iqPhase << amp << xAmp << yAmp << dPhase << bTune;
// qDebug() << "A" << nsec%60 << bTune << btxok;
ic=0;
nsec0=nsec;
}
@ -81,9 +92,13 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
// i2 = 500.0*(i2/32767.0 + 5.0*gran()); //Add noise (tests only!)
// if(bIQxt) {
if(1) {
qreal phi=qAtan2(qreal(i2a),qreal(i2b)) + dPhase;
if(bTune) {
phi += dphi;
} else {
phi=qAtan2(qreal(i2a),qreal(i2b));
}
i2a=xAmp*qCos(phi);
i2b=yAmp*qSin(phi);
i2b=yAmp*qSin(phi + dPhase);
// qDebug() << xAmp << yAmp << phi << i2a << i2b;
}
// i2a=0.01*txPower*i2a;