From eb9a0d5e6702100c4ff2a005e0d96e964e37eac7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 6 Dec 2017 21:38:24 +0000 Subject: [PATCH] Working on Fox-mode code. Another intermediate commit -- much still TBD. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8292 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 129 +++++++++++++++++++++++++++---------------------- mainwindow.h | 3 +- 2 files changed, 73 insertions(+), 59 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index f4803412e..bf6e00369 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2872,7 +2872,7 @@ void MainWindow::readFromStdout() //readFromStdout // int snr=decodedtext.string().mid(6,4).toInt(); m_bDoubleClicked=true; m_bAutoReply = true; - processMessage (decodedtext); + if(!m_config.bFox()) processMessage (decodedtext); ui->cbFirst->setStyleSheet(""); } else { //### if(m_config.bFox() and for_us and (audioFreq<1000)) bDisplayRight=true; @@ -3534,7 +3534,7 @@ void MainWindow::guiUpdate() } m_iptt0=g_iptt; m_btxok0=m_btxok; -} //End of GUIupdate +} //End of guiUpdate void MainWindow::startTx2() @@ -7023,6 +7023,10 @@ void MainWindow::on_pbFoxReset_clicked() { ui->textBrowser3->setText(""); ui->textBrowser4->setText(""); + for(int i=0; i map; QStringList lines,lines2; @@ -7209,85 +7213,94 @@ void MainWindow::houndCallers() void MainWindow::foxRxSequencer(QString houndCall, QString houndGrid) { -// Called from "readFromStdOut()" for decoded messages of the form "MyCall HoundCall R+rpt" +/* Called from "readFromStdOut()" to process decoded messages of the form + * "myCall houndCall R+rpt". If houndCall matches a callsign in one of + * our active QSO slots, we prepare to send "houndCall RR73" to that caller. + * If no suitable message appears for slot i, we queue its message to be + * repeated. +*/ - QString inQSOmessages=ui->textBrowser3->toPlainText(); - if(inQSOmessages.contains(" " + houndCall + " ")) { - qDebug() << "Received:" << houndCall << houndGrid; - QStringList inQSOmessagesList=inQSOmessages.split("\n"); - ui->textBrowser3->setText(""); - for (int i=0; itextBrowser3->displayFoxToBeCalled(t,"#ff99ff"); - } else { - ui->textBrowser3->displayFoxToBeCalled(t,"#ffffff"); - } + ui->textBrowser3->setText(""); + for(int i=0; itextBrowser3->displayFoxToBeCalled(m_foxMsgToBeSent[i],"#ffffff"); } + qDebug() << " "; } void MainWindow::foxTxSequencer() { - QString msg[5]; - QString inQSO=""; +/* Called from guiUpdate at the point where an FT8 Fox-mode transmission + * is to be started. Here we determine what the Tx message(s) will be, + * and then call foxgen() to generate the corresponding waveform. +*/ + QString allQSOtext=""; QString nextTxMessages=ui->textBrowser3->toPlainText(); // int islots=nextTxMessages.split("\n").size() - 1; for(int i=0; i 10) { - QString txMsg=nextTxMessages.split("\n").at(i); - m_houndCall[i]=txMsg.mid(0,7); - qDebug() << "A1" << txMsg; - int i1=qMax(txMsg.indexOf('+'),txMsg.indexOf('-')); - msg[i]= m_houndCall[i] + " " + m_config.my_callsign() + txMsg.mid(i1-1,4); - } - qDebug() << "B" << i << msg[i]; - if(msg[i]=="") { + QString fm=m_foxMsgToBeSent[i]; //Fox message to be transmitted in this slot + if(fm=="") { if(!m_houndQueue.isEmpty()) { QString t=m_houndQueue.dequeue(); m_houndCall[i]=t.mid(0,6); QString rpt=t.mid(7,3); - msg[i]= m_houndCall[i] + " " + m_config.my_callsign() + " " + rpt; - m_bSendRR73[i]=false; + fm= m_houndCall[i] + " " + m_config.my_callsign() + " " + rpt; QString tb4=ui->textBrowser4->toPlainText(); tb4=tb4.remove(t+"\n"); ui->textBrowser4->setText(tb4); } else { - msg[i]=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign() + + fm=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign() + " " + m_config.my_grid().mid(0,4); } } - qDebug() << "C" << i << msg[i]; - msg[i] += " "; - msg[i]=msg[i].mid(0,32); - ui->decodedTextBrowser2->displayTransmittedText(msg[i], m_modeTx, + + if(fm.contains(" RR73")) { + qDebug() << "Logged:" << i << fm << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i]; + if(!m_houndQueue.isEmpty()) { + QString t=m_houndQueue.dequeue(); //Fetch next hound call + m_houndCall[i]=t.mid(0,6); + QString rpt=t.mid(7,3); + fm=fm.mid(0,7) + "RR73; " + m_houndCall[i] + " <" + m_config.my_callsign() + + "> " + rpt; + + QString tb4=ui->textBrowser4->toPlainText(); //Remove popped call from tb4 + tb4=tb4.remove(t+"\n"); + ui->textBrowser4->setText(tb4); + + //In case we might need to send a repeat: + m_foxMsgToBeSent[i]=m_houndCall[i] + " " + m_config.my_callsign() + " " + rpt; + + } else { + fm=m_houndCall[i] + " " + m_config.my_callsign() + " RR73"; + qDebug() << "a2" << i << fm; + } + } + + fm += " "; + fm=fm.mid(0,32); + ui->decodedTextBrowser2->displayTransmittedText(fm, m_modeTx, 300+60*i,m_config.color_TxMsg(),m_bFastMode); foxcom_.i3bit[i]=0; - if(msg[i].indexOf("<")>0) foxcom_.i3bit[i]=1; - qDebug() << "Transmitted:" << i << foxcom_.i3bit[i] << msg[i].trimmed(); - strncpy(&foxcom_.cmsg[i][0], msg[i].toLatin1(),32); - int i1=qMax(msg[i].indexOf("+"),msg[i].indexOf("-")); + if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1; + strncpy(&foxcom_.cmsg[i][0], fm.toLatin1(),32); //Copy this message into cmsg[i] + m_foxMsgSent[i]=fm.trimmed(); //What was actually sent + qDebug() << "Tx:" << i << foxcom_.i3bit[i] << m_foxMsgSent[i] << m_foxMsgToBeSent[i]; + + int i1=qMax(fm.indexOf("+"),fm.indexOf("-")); if(i1>6) { - m_houndRptSent[i]=msg[i].mid(i1,3); - qDebug() << "zz" << i << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i]; + m_houndRptSent[i]=fm.mid(i1,3); //Active hound call for slot i } - if(m_bSendRR73[i]) { - qDebug() << "Logged:" << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i]; - msg[i]="CQ"; - m_bSendRR73[i]=false; - } - inQSO += (msg[i] + "\n"); + allQSOtext += (fm + "\n"); } -// qDebug() << "TxSeq:" << inQSO; - ui->textBrowser3->setText(inQSO); + qDebug() << " "; + ui->textBrowser3->setText(allQSOtext); foxcom_.nslots=m_Nslots; foxgen_(); } diff --git a/mainwindow.h b/mainwindow.h index 020f55ba1..4586617d3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -475,7 +475,6 @@ private: bool m_bAutoReply; bool m_bCheckedContest; bool m_bDXped; - bool m_bSendRR73[5]; enum { @@ -563,6 +562,8 @@ private: QString m_houndGrid[5]; QString m_houndRptSent[5]; QString m_houndRptRcvd[5]; + QString m_foxMsgToBeSent[5]; + QString m_foxMsgSent[5]; QSet m_pfx; QSet m_sfx;