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
This commit is contained in:
Joe Taylor 2017-12-06 21:38:24 +00:00
parent cac7b7c363
commit eb9a0d5e67
2 changed files with 73 additions and 59 deletions

View File

@ -2872,7 +2872,7 @@ void MainWindow::readFromStdout() //readFromStdout
// int snr=decodedtext.string().mid(6,4).toInt(); // int snr=decodedtext.string().mid(6,4).toInt();
m_bDoubleClicked=true; m_bDoubleClicked=true;
m_bAutoReply = true; m_bAutoReply = true;
processMessage (decodedtext); if(!m_config.bFox()) processMessage (decodedtext);
ui->cbFirst->setStyleSheet(""); ui->cbFirst->setStyleSheet("");
} else { } else {
//### if(m_config.bFox() and for_us and (audioFreq<1000)) bDisplayRight=true; //### if(m_config.bFox() and for_us and (audioFreq<1000)) bDisplayRight=true;
@ -3534,7 +3534,7 @@ void MainWindow::guiUpdate()
} }
m_iptt0=g_iptt; m_iptt0=g_iptt;
m_btxok0=m_btxok; m_btxok0=m_btxok;
} //End of GUIupdate } //End of guiUpdate
void MainWindow::startTx2() void MainWindow::startTx2()
@ -7023,6 +7023,10 @@ void MainWindow::on_pbFoxReset_clicked()
{ {
ui->textBrowser3->setText(""); ui->textBrowser3->setText("");
ui->textBrowser4->setText(""); ui->textBrowser4->setText("");
for(int i=0; i<m_Nslots; i++) {
m_foxMsgSent[i]="";
m_foxMsgToBeSent[i]="";
}
} }
void MainWindow::on_comboBoxHoundSort_activated(int index) void MainWindow::on_comboBoxHoundSort_activated(int index)
@ -7036,11 +7040,11 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
/* Called from "houndCallers()" to sort the list of calling stations by /* Called from "houndCallers()" to sort the list of calling stations by
* specified criteria. * specified criteria.
* QString "t" contains a list of Hound callers read from file "houndcallers.txt". * QString "t" contains a list of Hound callers read from file "houndcallers.txt".
* isort=0: random (shuffled) order * isort=0: random (shuffled order)
* 1: call * 1: call
* 2: grid * 2: grid
* 3: SNR (top down) * 3: SNR (reverse order)
* 4: distance (top down) * 4: distance (reverse order)
*/ */
QMap<QString,QString> map; QMap<QString,QString> map;
QStringList lines,lines2; QStringList lines,lines2;
@ -7209,85 +7213,94 @@ void MainWindow::houndCallers()
void MainWindow::foxRxSequencer(QString houndCall, QString houndGrid) 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(); ui->textBrowser3->setText("");
if(inQSOmessages.contains(" " + houndCall + " ")) { for(int i=0; i<m_Nslots; i++) {
qDebug() << "Received:" << houndCall << houndGrid; if(m_foxMsgSent[i].contains(houndCall + " ")) {
QStringList inQSOmessagesList=inQSOmessages.split("\n"); m_houndRptRcvd[i]=houndGrid.mid(1);
ui->textBrowser3->setText(""); int i1=qMax(m_foxMsgSent[i].indexOf("+"), m_foxMsgSent[i].indexOf("-"));
for (int i=0; i<inQSOmessagesList.length(); i++) { m_foxMsgToBeSent[i]=m_foxMsgSent[i].mid(0,i1-1) + " RR73";
QString t=inQSOmessagesList.at(i); qDebug() << "Rx:" << i << houndCall << houndGrid;
if(t.contains(" " + houndCall + " ")) { } else {
m_houndRptRcvd[i]=houndGrid.mid(1); m_foxMsgToBeSent[i]=m_foxMsgSent[i];
int i1=qMax(t.indexOf("+"), t.indexOf("-"));
qDebug() << "yy" << i << i1 << m_houndRptRcvd[i] << t.trimmed();
m_bSendRR73[i]=true;
t=t.mid(0,i1-1) + " RR73";
ui->textBrowser3->displayFoxToBeCalled(t,"#ff99ff");
} else {
ui->textBrowser3->displayFoxToBeCalled(t,"#ffffff");
}
} }
ui->textBrowser3->displayFoxToBeCalled(m_foxMsgToBeSent[i],"#ffffff");
} }
qDebug() << " ";
} }
void MainWindow::foxTxSequencer() void MainWindow::foxTxSequencer()
{ {
QString msg[5]; /* Called from guiUpdate at the point where an FT8 Fox-mode transmission
QString inQSO=""; * 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(); QString nextTxMessages=ui->textBrowser3->toPlainText();
// int islots=nextTxMessages.split("\n").size() - 1; // int islots=nextTxMessages.split("\n").size() - 1;
for(int i=0; i<m_Nslots; i++) { for(int i=0; i<m_Nslots; i++) {
msg[i]=""; QString fm=m_foxMsgToBeSent[i]; //Fox message to be transmitted in this slot
int iz=nextTxMessages.split("\n").size(); if(fm=="") {
qDebug() << "A" << i << iz << nextTxMessages.length();
if(i<iz and nextTxMessages.length() > 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]=="") {
if(!m_houndQueue.isEmpty()) { if(!m_houndQueue.isEmpty()) {
QString t=m_houndQueue.dequeue(); QString t=m_houndQueue.dequeue();
m_houndCall[i]=t.mid(0,6); m_houndCall[i]=t.mid(0,6);
QString rpt=t.mid(7,3); QString rpt=t.mid(7,3);
msg[i]= m_houndCall[i] + " " + m_config.my_callsign() + " " + rpt; fm= m_houndCall[i] + " " + m_config.my_callsign() + " " + rpt;
m_bSendRR73[i]=false;
QString tb4=ui->textBrowser4->toPlainText(); QString tb4=ui->textBrowser4->toPlainText();
tb4=tb4.remove(t+"\n"); tb4=tb4.remove(t+"\n");
ui->textBrowser4->setText(tb4); ui->textBrowser4->setText(tb4);
} else { } 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); " " + m_config.my_grid().mid(0,4);
} }
} }
qDebug() << "C" << i << msg[i];
msg[i] += " "; if(fm.contains(" RR73")) {
msg[i]=msg[i].mid(0,32); qDebug() << "Logged:" << i << fm << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i];
ui->decodedTextBrowser2->displayTransmittedText(msg[i], m_modeTx, 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); 300+60*i,m_config.color_TxMsg(),m_bFastMode);
foxcom_.i3bit[i]=0; foxcom_.i3bit[i]=0;
if(msg[i].indexOf("<")>0) foxcom_.i3bit[i]=1; if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1;
qDebug() << "Transmitted:" << i << foxcom_.i3bit[i] << msg[i].trimmed(); strncpy(&foxcom_.cmsg[i][0], fm.toLatin1(),32); //Copy this message into cmsg[i]
strncpy(&foxcom_.cmsg[i][0], msg[i].toLatin1(),32); m_foxMsgSent[i]=fm.trimmed(); //What was actually sent
int i1=qMax(msg[i].indexOf("+"),msg[i].indexOf("-")); qDebug() << "Tx:" << i << foxcom_.i3bit[i] << m_foxMsgSent[i] << m_foxMsgToBeSent[i];
int i1=qMax(fm.indexOf("+"),fm.indexOf("-"));
if(i1>6) { if(i1>6) {
m_houndRptSent[i]=msg[i].mid(i1,3); m_houndRptSent[i]=fm.mid(i1,3); //Active hound call for slot i
qDebug() << "zz" << i << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i];
} }
if(m_bSendRR73[i]) { allQSOtext += (fm + "\n");
qDebug() << "Logged:" << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i];
msg[i]="CQ";
m_bSendRR73[i]=false;
}
inQSO += (msg[i] + "\n");
} }
// qDebug() << "TxSeq:" << inQSO; qDebug() << " ";
ui->textBrowser3->setText(inQSO); ui->textBrowser3->setText(allQSOtext);
foxcom_.nslots=m_Nslots; foxcom_.nslots=m_Nslots;
foxgen_(); foxgen_();
} }

View File

@ -475,7 +475,6 @@ private:
bool m_bAutoReply; bool m_bAutoReply;
bool m_bCheckedContest; bool m_bCheckedContest;
bool m_bDXped; bool m_bDXped;
bool m_bSendRR73[5];
enum enum
{ {
@ -563,6 +562,8 @@ private:
QString m_houndGrid[5]; QString m_houndGrid[5];
QString m_houndRptSent[5]; QString m_houndRptSent[5];
QString m_houndRptRcvd[5]; QString m_houndRptRcvd[5];
QString m_foxMsgToBeSent[5];
QString m_foxMsgSent[5];
QSet<QString> m_pfx; QSet<QString> m_pfx;
QSet<QString> m_sfx; QSet<QString> m_sfx;