Fix several Fox bugs.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8511 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2018-02-20 16:44:11 +00:00
parent 319d639e98
commit 692fa93501
3 changed files with 67 additions and 22 deletions

View File

@ -1006,7 +1006,7 @@ void MainWindow::writeSettings()
m_settings->setValue("FoxNlist",ui->sbNlist->value()); m_settings->setValue("FoxNlist",ui->sbNlist->value());
m_settings->setValue("FoxNslots",ui->sbNslots->value()); m_settings->setValue("FoxNslots",ui->sbNslots->value());
m_settings->setValue("FoxMaxDB",ui->sbMax_dB->value()); m_settings->setValue("FoxMaxDB",ui->sbMax_dB->value());
m_settings->setValue("FoxMaxTime",ui->sbMaxTime->value()); m_settings->setValue("FoxMaxCalls",ui->sbMaxCalls->value());
m_settings->endGroup(); m_settings->endGroup();
m_settings->beginGroup("Common"); m_settings->beginGroup("Common");
@ -1080,7 +1080,7 @@ void MainWindow::readSettings()
ui->sbNlist->setValue(m_settings->value("FoxNlist",12).toInt()); ui->sbNlist->setValue(m_settings->value("FoxNlist",12).toInt());
ui->sbNslots->setValue(m_settings->value("FoxNslots",5).toInt()); ui->sbNslots->setValue(m_settings->value("FoxNslots",5).toInt());
ui->sbMax_dB->setValue(m_settings->value("FoxMaxDB",30).toInt()); ui->sbMax_dB->setValue(m_settings->value("FoxMaxDB",30).toInt());
ui->sbMaxTime->setValue(m_settings->value("FoxMaxTime",3).toInt()); ui->sbMaxCalls->setValue(m_settings->value("FoxMaxCalls",4).toInt());
m_settings->endGroup(); m_settings->endGroup();
// do this outside of settings group because it uses groups internally // do this outside of settings group because it uses groups internally
@ -1821,6 +1821,11 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
bumpFqso(n); bumpFqso(n);
} }
return; return;
case Qt::Key_X:
if(e->modifiers() & Qt::AltModifier) {
foxTest();
return;
}
case Qt::Key_E: case Qt::Key_E:
if(e->modifiers() & Qt::ShiftModifier) { if(e->modifiers() & Qt::ShiftModifier) {
ui->txFirstCheckBox->setChecked(false); ui->txFirstCheckBox->setChecked(false);
@ -7229,7 +7234,7 @@ void MainWindow::write_transmit_entry (QString const& file_name)
} }
} }
// -------------------------- Code for DXpedition Fox Mode --------------------------- // -------------------------- Code for FT8 DXpedition Mode ---------------------------
void MainWindow::on_sbNlist_valueChanged(int n) void MainWindow::on_sbNlist_valueChanged(int n)
{ {
@ -7362,7 +7367,7 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
void MainWindow::selectHound(QString line) void MainWindow::selectHound(QString line)
{ {
/* Called from doubleClickOnCall() in DXpedition Fox mode. /* Called from doubleClickOnCall() in DXpedition Fox mode.
* QString "line" is a user-selected selected line from left text window. * QString "line" is a user-selected line from left text window.
* The line may be selected by double-clicking; alternatively, hitting * The line may be selected by double-clicking; alternatively, hitting
* <Enter> is equivalent to double-clicking on the top-most line. * <Enter> is equivalent to double-clicking on the top-most line.
*/ */
@ -7469,13 +7474,13 @@ void MainWindow::foxRxSequencer(QString msg, QString houndCall, QString rptRcvd)
* "myCall houndCall R+rpt". * "myCall houndCall R+rpt".
* *
* If houndCall matches a callsign in one of our active QSO slots, we * If houndCall matches a callsign in one of our active QSO slots, we
* prepare to send "houndCall RR73" to that caller. If no suitable * prepare to send "houndCall RR73" to that caller.
* message appears for slot i, we queue its message to be repeated.
*/ */
if(m_foxQSO.contains(houndCall)) {
m_foxQSO[houndCall].rcvd=rptRcvd.mid(1); //Save Fox's report for the log m_foxQSO[houndCall].rcvd=rptRcvd.mid(1); //Save Fox's report for the log
m_foxRR73Queue.enqueue(houndCall); //Request RR73 to be sent to Hound m_foxRR73Queue.enqueue(houndCall); //Request RR73 to be sent to Hound
writeFoxQSO(" " + msg.trimmed()); writeFoxQSO(" " + msg.trimmed());
}
} }
void MainWindow::foxTxSequencer() void MainWindow::foxTxSequencer()
@ -7491,30 +7496,33 @@ void MainWindow::foxTxSequencer()
QString fm; //Fox message to be transmitted QString fm; //Fox message to be transmitted
QString hc1,hc2; //Hound calls QString hc1,hc2; //Hound calls
QString t,rpt; QString t,rpt;
QStringList sentTo;
int islot=0; int islot=0;
while(!m_foxRR73Queue.isEmpty()) { while(!m_foxRR73Queue.isEmpty()) {
hc1=m_foxRR73Queue.dequeue(); //First priority is to send RR73 messages hc1=m_foxRR73Queue.dequeue(); //First priority is to send RR73 messages
sentTo << hc1;
m_foxQSO[hc1].ncall++; //Number of times called
if(m_houndQueue.isEmpty()) { if(m_houndQueue.isEmpty()) {
fm = hc1 + " " + m_baseCall + " RR73"; //Send a standard FT8 message fm = hc1 + " " + m_baseCall + " RR73"; //Send a standard FT8 message
} else { } else {
t=m_houndQueue.dequeue(); //Fetch new hound from queue t=m_houndQueue.dequeue(); //Fetch new hound from queue
hc2=t.mid(0,6).trimmed(); //hound call hc2=t.mid(0,6).trimmed(); //hound call
sentTo << hc2;
m_foxQSOqueue.enqueue(hc2); //Put him in the QSO queue m_foxQSOqueue.enqueue(hc2); //Put him in the QSO queue
m_foxQSO[hc2].grid=t.mid(11,4); //hound grid m_foxQSO[hc2].grid=t.mid(11,4); //hound grid
rpt=t.mid(7,3); rpt=t.mid(7,3);
m_foxQSO[hc2].sent=rpt; //Report to send him m_foxQSO[hc2].sent=rpt; //Report to send him
m_foxQSO[hc2].t0=now; //QSO start time m_foxQSO[hc2].ncall=1; //number of calls
rm_tb4(hc2); //Remove this hound from tb4 rm_tb4(hc2); //Remove this hound from tb4
fm = hc1 + " RR73; " + hc2 + " <" + m_config.my_callsign() + "> " + rpt; //Tx msg fm = hc1 + " RR73; " + hc2 + " <" + m_config.my_callsign() + "> " + rpt; //Tx msg
} }
// Log this QSO!
// Log this QSO!
m_hisCall=hc1; m_hisCall=hc1;
m_hisGrid=m_foxQSO[hc1].grid; m_hisGrid=m_foxQSO[hc1].grid;
m_rptSent=m_foxQSO[hc1].sent; m_rptSent=m_foxQSO[hc1].sent;
m_rptRcvd=m_foxQSO[hc1].rcvd; m_rptRcvd=m_foxQSO[hc1].rcvd;
// qDebug() << "Fox Logged :" << islot << m_hisCall << m_hisGrid << m_rptSent
// << m_rptRcvd << m_lastBand;
QDateTime logTime {QDateTime::currentDateTimeUtc ()}; QDateTime logTime {QDateTime::currentDateTimeUtc ()};
QString logLine=logTime.toString("yyyy-MM-dd hh:mm") + " " + m_hisCall + QString logLine=logTime.toString("yyyy-MM-dd hh:mm") + " " + m_hisCall +
" " + m_hisGrid + " " + m_rptSent + " " + m_rptRcvd + " " + m_lastBand; " " + m_hisGrid + " " + m_rptSent + " " + m_rptRcvd + " " + m_lastBand;
@ -7522,6 +7530,7 @@ void MainWindow::foxTxSequencer()
m_msgAvgWidget->foxAddLog(logLine); m_msgAvgWidget->foxAddLog(logLine);
} }
on_logQSOButton_clicked(); on_logQSOButton_clicked();
m_foxRateQueue.enqueue(now); //Add present time in seconds to Rate queue. m_foxRateQueue.enqueue(now); //Add present time in seconds to Rate queue.
m_loggedByFox[hc1] += (m_lastBand + " "); m_loggedByFox[hc1] += (m_lastBand + " ");
if(m_foxQSOqueue.contains(hc1)) m_foxQSOqueue.removeOne(hc1); if(m_foxQSOqueue.contains(hc1)) m_foxQSOqueue.removeOne(hc1);
@ -7536,6 +7545,11 @@ void MainWindow::foxTxSequencer()
//should limit repeat transmissions here ? //should limit repeat transmissions here ?
hc1=m_foxQSOqueue.dequeue(); //Recover hound callsign from QSO queue hc1=m_foxQSOqueue.dequeue(); //Recover hound callsign from QSO queue
m_foxQSOqueue.enqueue(hc1); //Put him back in, at the end m_foxQSOqueue.enqueue(hc1); //Put him back in, at the end
if(islot>0 and sentTo.contains(hc1)) {
break;
}
sentTo << hc1;
m_foxQSO[hc1].ncall++; //Number of times called
fm = hc1 + " " + m_baseCall + " " + m_foxQSO[hc1].sent; //Tx msg fm = hc1 + " " + m_baseCall + " " + m_foxQSO[hc1].sent; //Tx msg
if(islot>0 and fm==m_fm0) break; //Suppress duplicate Fox signals if(islot>0 and fm==m_fm0) break; //Suppress duplicate Fox signals
islot++; islot++;
@ -7552,7 +7566,7 @@ void MainWindow::foxTxSequencer()
m_foxQSO[hc1].grid=t.mid(11,4); //hound grid m_foxQSO[hc1].grid=t.mid(11,4); //hound grid
rpt=t.mid(7,3); rpt=t.mid(7,3);
m_foxQSO[hc1].sent=rpt; //Report to send him m_foxQSO[hc1].sent=rpt; //Report to send him
m_foxQSO[hc1].t0=now; //QSO start time m_foxQSO[hc1].ncall++; //Number of times called
rm_tb4(hc1); //Remove this hound from tb4 rm_tb4(hc1); //Remove this hound from tb4
fm = hc1 + " " + m_baseCall + " " + rpt; //Tx msg fm = hc1 + " " + m_baseCall + " " + rpt; //Tx msg
islot++; islot++;
@ -7579,10 +7593,9 @@ Transmit:
strncpy(&foxcom_.mycall[0], foxCall.toLatin1(),12); //Copy Fox callsign into foxcom_ strncpy(&foxcom_.mycall[0], foxCall.toLatin1(),12); //Copy Fox callsign into foxcom_
foxgen_(); foxgen_();
int maxAge=30*ui->sbMaxTime->value(); //60 ==> max 4 calls (0 30 60 90) to a new Fox
for(auto a: m_foxQSO.keys()) { for(auto a: m_foxQSO.keys()) {
int ageSec=now-m_foxQSO[a].t0; int ncalls=m_foxQSO[a].ncall;
if(ageSec > maxAge) { if(ncalls > ui->sbMaxCalls->value()) {
m_foxQSO.remove(a); m_foxQSO.remove(a);
m_foxQSOqueue.removeOne(a); m_foxQSOqueue.removeOne(a);
} }
@ -7661,3 +7674,31 @@ void MainWindow::writeFoxQSO(QString msg)
tr("Cannot open \"%1\" for append: %2").arg(f.fileName()).arg(f.errorString())); tr("Cannot open \"%1\" for append: %2").arg(f.fileName()).arg(f.errorString()));
} }
} }
void MainWindow::foxTest()
{
QFile f("steps.txt");
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) return;
QTextStream s(&f);
QString line;
while(!s.atEnd()) {
line=s.readLine();
selectHound(line);
if(line.contains("N7QT ")) break;
}
while(!s.atEnd()) {
line=s.readLine();
if(line.length()==0) {
foxTxSequencer();
continue;
}
QString msg=line.mid(24);
QString hc1=line.mid(29);
int i0=hc1.indexOf(" ");
hc1=hc1.mid(0,i0);
i0=qMax(line.indexOf("R+"),line.indexOf("R-"));
QString rptRcvd=line.mid(i0,4);
foxRxSequencer(msg,hc1,rptRcvd);
}
}

View File

@ -322,6 +322,7 @@ private:
void writeAllTxt(QString message); void writeAllTxt(QString message);
void auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance); void auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance);
void hideMenus(bool b); void hideMenus(bool b);
void foxTest();
NetworkAccessManager m_network_manager; NetworkAccessManager m_network_manager;
bool m_valid; bool m_valid;
@ -577,7 +578,7 @@ private:
QString grid; QString grid;
QString sent; QString sent;
QString rcvd; QString rcvd;
qint64 t0; qint32 ncall;
}; };
QMap<QString,FoxQSO> m_foxQSO; QMap<QString,FoxQSO> m_foxQSO;

View File

@ -1874,7 +1874,7 @@ list. The list can be maintained in Settings (F2).</string>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QSpinBox" name="sbMaxTime"> <widget class="QSpinBox" name="sbMaxCalls">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1888,7 +1888,7 @@ list. The list can be maintained in Settings (F2).</string>
</size> </size>
</property> </property>
<property name="prefix"> <property name="prefix">
<string>Max Time </string> <string>Max Calls </string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
@ -1897,12 +1897,15 @@ list. The list can be maintained in Settings (F2).</string>
<number>10</number> <number>10</number>
</property> </property>
<property name="value"> <property name="value">
<number>3</number> <number>4</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="7" column="0">
<widget class="QCheckBox" name="cbNoDupes"> <widget class="QCheckBox" name="cbNoDupes">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>No Dupes</string> <string>No Dupes</string>
</property> </property>