From 574c2511f5cf43842f658a33854b249fc23eec66 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 8 Apr 2013 18:31:21 +0000 Subject: [PATCH] 1. New controls for selecting Tx messages now functioning correctly? 2. Double-click on decoded message sets Tx Enable. 3. Implemented a runaway Tx watchdog. 4. Added a spinbox for S/N report. 5. Implemented correct message formats for compound callsigns. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3135 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- devsetup.ui | 4 +- lib/getpfx1.f | 1 + mainwindow.cpp | 119 ++++++++++++++++++++++++++++++++++--------------- mainwindow.h | 20 +++------ mainwindow.ui | 63 ++++++++++++++++++++++---- widegraph.ui | 2 +- 6 files changed, 148 insertions(+), 61 deletions(-) diff --git a/devsetup.ui b/devsetup.ui index e773fee7d..bd400cc0d 100644 --- a/devsetup.ui +++ b/devsetup.ui @@ -6,8 +6,8 @@ 0 0 - 548 - 521 + 503 + 463 diff --git a/lib/getpfx1.f b/lib/getpfx1.f index 8f5985e97..88636a62a 100644 --- a/lib/getpfx1.f +++ b/lib/getpfx1.f @@ -13,6 +13,7 @@ if(iz.lt.0) iz=12 islash=index(callsign(1:iz),'/') k=0 + if(k.eq.0) go to 10 !### Always use JT65v2 ### c=' ' if(islash.gt.0 .and. islash.le.(iz-4)) then ! Add-on prefix diff --git a/mainwindow.cpp b/mainwindow.cpp index fa40ec882..4018f2442 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -158,6 +158,7 @@ MainWindow::MainWindow(QWidget *parent) : m_nutc0=9999; m_NB=false; m_mode="JT9-1"; + m_rpt="-15"; m_TRperiod=60; m_inGain=0; m_dataAvailable=false; @@ -169,10 +170,8 @@ MainWindow::MainWindow(QWidget *parent) : m_insertBlank=false; m_clearCallGrid=false; m_bMiles=false; - //m_fMin=1000; m_decodedText2=false; - //ui->fMinSpinBox->setValue(m_fMin); - + m_freeText=false; decodeBusy(false); ui->xThermo->setFillBrush(Qt::green); @@ -227,7 +226,7 @@ MainWindow::MainWindow(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;}"; - genStdMsgs("-30"); + genStdMsgs(m_rpt); on_actionWide_Waterfall_triggered(); //### g_pWideGraph->setTxFreq(m_txFreq); @@ -382,6 +381,8 @@ void MainWindow::writeSettings() settings.setValue("InsertBlank",m_insertBlank); settings.setValue("ClearCallGrid",m_clearCallGrid); settings.setValue("Miles",m_bMiles); + settings.setValue("GUItab",ui->tabWidget->currentIndex()); + settings.setValue("QuickCall",m_quickCall); settings.endGroup(); } @@ -478,8 +479,12 @@ void MainWindow::readSettings() ui->actionBlank_line_between_decoding_periods->setChecked(m_insertBlank); m_clearCallGrid=settings.value("ClearCallGrid",false).toBool(); ui->actionClear_DX_Call_and_Grid_after_logging->setChecked(m_clearCallGrid); - m_bMiles=settings.value("Miles",false).toBool(); + m_bMiles=settings.value("Miles",false).toBool(); ui->actionDisplay_distance_in_miles->setChecked(m_bMiles); + int n=settings.value("GUItab",0).toInt(); + ui->tabWidget->setCurrentIndex(n); + m_quickCall=settings.value("QuickCall",false).toBool(); + ui->actionDouble_click_on_call_sets_Tx_Enable->setChecked(m_quickCall); if(!ui->actionLinrad->isChecked() && !ui->actionCuteSDR->isChecked() && !ui->actionAFMHot->isChecked() && !ui->actionBlue->isChecked()) { @@ -687,11 +692,9 @@ void MainWindow::on_autoButton_clicked() //Auto m_auto = !m_auto; if(m_auto) { ui->autoButton->setStyleSheet(m_pbAutoOn_style); -// ui->autoButton->setText("Auto is ON"); } else { btxok=false; ui->autoButton->setStyleSheet(""); -// ui->autoButton->setText("Auto is OFF"); on_monitorButton_clicked(); } } @@ -734,13 +737,13 @@ void MainWindow::keyPressEvent( QKeyEvent *e ) //keyPressEvent break; case Qt::Key_G: if(e->modifiers() & Qt::AltModifier) { - genStdMsgs("-30"); + genStdMsgs(m_rpt); break; } case Qt::Key_L: if(e->modifiers() & Qt::ControlModifier) { lookup(); - genStdMsgs("-30"); + genStdMsgs(m_rpt); break; } } @@ -1362,8 +1365,8 @@ void MainWindow::guiUpdate() int ichk=0,itext=0; genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1); msgsent[22]=0; - lab5->setText("Last Tx: " + QString::fromAscii(msgsent)); QString t=QString::fromAscii(msgsent); + lab5->setText("Last Tx: " + t); if(m_restart) { QFile f("ALL.TXT"); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); @@ -1421,6 +1424,17 @@ void MainWindow::guiUpdate() nc1++; } if(nc1 == 0) { + QString t=QString::fromAscii(msgsent); + if(t==m_msgSent0) { + m_repeatMsg++; + if(m_repeatMsg>5) { + msgBox("Runaway Tx watchdog"); + m_repeatMsg=0; + } + } else { + m_repeatMsg=0; + m_msgSent0=t; + } ui->xThermo->setValue(0.0); //Set Thermo to zero m_monitoring=false; soundInThread.setMonitoring(false); @@ -1430,11 +1444,10 @@ void MainWindow::guiUpdate() f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); QTextStream out(&f); out << QDateTime::currentDateTimeUtc().toString("hhmm") - << " Transmitting: " << QString::fromAscii(msgsent) << endl; + << " Transmitting: " << t << endl; f.close(); } -//### if(!btxok && btxok0 && m_iptt==1) stopTx(); // If btxok was just lowered, start a countdown for lowering PTT @@ -1532,23 +1545,12 @@ void MainWindow::startTx2() if(snr>0.0 or snr < -50.0) snr=99.0; soundOutThread.setTxSNR(snr); soundOutThread.start(QThread::HighPriority); - //qDebug() << "soundOutThread.start()"; } - - ui->xThermo->setValue(0.0); //Set Thermo to zero + ui->xThermo->setValue(0.0); //Set Thermo to zero m_monitoring=false; soundInThread.setMonitoring(false); btxok=true; m_transmitting=true; -/* - QFile f("ALL.TXT"); - f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); - QTextStream out(&f); - out << QDateTime::currentDateTimeUtc().toString("hhmm") - << " Transmitting: " << QString::fromAscii(msgsent) << endl; - f.close(); -*/ - m_transmitting=true; } } @@ -1702,6 +1704,7 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl) if(nr>=-9 and nr<=-1) rpt="-0" + rpt.mid(1); if(nr>=0 and nr<=9) rpt="+0" + rpt; if(nr>=10) rpt="+" + rpt; + ui->rptSpinBox->setValue(rpt.toInt()); genStdMsgs(rpt); if(t2.indexOf(m_myCall)>0) { m_ntx=2; @@ -1718,14 +1721,21 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl) m_ntx=7; } } + if(m_quickCall) { + m_auto=true; + ui->autoButton->setStyleSheet(m_pbAutoOn_style); + } } void MainWindow::genStdMsgs(QString rpt) //genStdMsgs() { - QString hiscall=ui->dxCallEntry->text().toUpper().trimmed(); - ui->dxCallEntry->setText(hiscall); - QString t0=hiscall + " " + m_myCall + " "; + QString hisCall=ui->dxCallEntry->text().toUpper().trimmed(); + ui->dxCallEntry->setText(hisCall); + QString hisBase=baseCall(hisCall); + QString myBase=baseCall(m_myCall); + QString t0=hisBase + " " + myBase + " "; QString t=t0 + m_myGrid.mid(0,4); + if(myBase!=m_myCall) t="DE " + m_myCall + " " + m_myGrid.mid(0,4); msgtype(t, ui->tx1); if(rpt == "") { t=t+" OOO"; @@ -1741,6 +1751,7 @@ void MainWindow::genStdMsgs(QString rpt) //genStdMsgs() t=t0 + "RRR"; msgtype(t, ui->tx4); t=t0 + "73"; + if(myBase!=m_myCall) t="DE " + m_myCall + " 73"; msgtype(t, ui->tx5); } @@ -1751,10 +1762,19 @@ void MainWindow::genStdMsgs(QString rpt) //genStdMsgs() m_rpt=rpt; } +QString MainWindow::baseCall(QString t) +{ + int n1=t.indexOf("/"); + if(n1<0) return t; + int n2=t.length()-n1-1; + if(n2>=n1) return t.mid(n1+1); + return t.mid(0,n1); +} + void MainWindow::lookup() //lookup() { - QString hiscall=ui->dxCallEntry->text().toUpper().trimmed(); - ui->dxCallEntry->setText(hiscall); + QString hisCall=ui->dxCallEntry->text().toUpper().trimmed(); + ui->dxCallEntry->setText(hisCall); QString call3File = m_appDir + "/CALL3.TXT"; QFile f(call3File); if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -1770,7 +1790,7 @@ void MainWindow::lookup() //lookup() break; } QString t=QString(c); - if(t.indexOf(hiscall)==0) { + if(t.indexOf(hisCall)==0) { int i1=t.indexOf(","); QString hisgrid=t.mid(i1+1,6); i1=hisgrid.indexOf(","); @@ -1798,9 +1818,9 @@ void MainWindow::on_addButton_clicked() //Add button return; } m_call3Modified=false; - QString hiscall=ui->dxCallEntry->text().toUpper().trimmed(); + QString hisCall=ui->dxCallEntry->text().toUpper().trimmed(); QString hisgrid=ui->dxGridEntry->text().trimmed(); - QString newEntry=hiscall + "," + hisgrid; + QString newEntry=hisCall + "," + hisgrid; // int ret = QMessageBox::warning(this, "Add", // newEntry + "\n" + "Is this station known to be active on EME?", @@ -1833,7 +1853,7 @@ void MainWindow::on_addButton_clicked() //Add button } QTextStream in(&f1); QTextStream out(&f2); - QString hc=hiscall; + QString hc=hisCall; QString hc1=""; QString hc2="AAAAAA"; QString s; @@ -1991,7 +2011,7 @@ void MainWindow::on_dxGridEntry_textChanged(const QString &t) //dxGrid changed void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button { - genStdMsgs("-30"); + genStdMsgs(m_rpt); } void MainWindow::on_logQSOButton_clicked() //Log QSO button @@ -2327,53 +2347,78 @@ void MainWindow::on_pbCallCQ_clicked() { genStdMsgs(m_rpt); ui->genMsg->setText(ui->tx6->text()); + m_ntx=7; + if(m_freeText) m_ntx=8; } void MainWindow::on_pbAnswerCaller_clicked() { genStdMsgs(m_rpt); ui->genMsg->setText(ui->tx2->text()); + m_ntx=7; + if(m_freeText) m_ntx=8; } void MainWindow::on_pbSendRRR_clicked() { genStdMsgs(m_rpt); ui->genMsg->setText(ui->tx4->text()); + m_ntx=7; + if(m_freeText) m_ntx=8; } void MainWindow::on_pbAnswerCQ_clicked() { genStdMsgs(m_rpt); ui->genMsg->setText(ui->tx1->text()); + m_ntx=7; + if(m_freeText) m_ntx=8; } void MainWindow::on_pbSendReport_clicked() { genStdMsgs(m_rpt); ui->genMsg->setText(ui->tx3->text()); + m_ntx=7; + if(m_freeText) m_ntx=8; } void MainWindow::on_pbSend73_clicked() { genStdMsgs(m_rpt); ui->genMsg->setText(ui->tx5->text()); + m_ntx=7; + if(m_freeText) m_ntx=8; } void MainWindow::on_rbGenMsg_toggled(bool checked) { m_freeText=false; + m_ntx=7; + if(m_transmitting) m_restart=true; } void MainWindow::on_rbFreeText_toggled(bool checked) { m_freeText=true; - m_ntx=7; + m_ntx=8; + if(m_transmitting) m_restart=true; + } void MainWindow::on_freeTextMsg_editingFinished() { QString t=ui->freeTextMsg->text(); msgtype(t, ui->freeTextMsg); - m_ntx=8; - qDebug() << m_ntx; +} + +void MainWindow::on_actionDouble_click_on_call_sets_Tx_Enable_triggered(bool checked) +{ + m_quickCall=checked; +} + +void MainWindow::on_rptSpinBox_valueChanged(int n) +{ + m_rpt=QString::number(n); + genStdMsgs(m_rpt); } diff --git a/mainwindow.h b/mainwindow.h index 90270ced7..207c5703f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -132,30 +132,19 @@ private slots: void on_bandComboBox_currentIndexChanged(int index); void on_actionPrompt_to_log_QSO_triggered(bool checked); void on_actionBlank_line_between_decoding_periods_triggered(bool checked); - //void on_fMinSpinBox_valueChanged(int n); - //void on_fMaxSpinBox_valueChanged(int n); - void on_actionClear_DX_Call_and_Grid_after_logging_triggered(bool checked); - void on_actionDisplay_distance_in_miles_triggered(bool checked); - void on_pbCallCQ_clicked(); - void on_pbAnswerCaller_clicked(); - void on_pbSendRRR_clicked(); - void on_pbAnswerCQ_clicked(); - void on_pbSendReport_clicked(); - void on_pbSend73_clicked(); - void on_rbGenMsg_toggled(bool checked); - void on_rbFreeText_toggled(bool checked); - void on_freeTextMsg_editingFinished(); + void on_actionDouble_click_on_call_sets_Tx_Enable_triggered(bool checked); + void on_rptSpinBox_valueChanged(int n); private: Ui::MainWindow *ui; @@ -205,6 +194,7 @@ private: qint32 m_COMportOpen; qint32 m_iptt; qint32 m_band; + qint32 m_repeatMsg; bool m_monitoring; bool m_transmitting; @@ -241,6 +231,7 @@ private: bool m_bMiles; bool m_decodedText2; bool m_freeText; + bool m_quickCall; char m_decoded[80]; @@ -277,6 +268,7 @@ private: QString m_pbAutoOn_style; QString m_myCall; QString m_myGrid; + QString m_baseCall; QString m_hisCall; QString m_hisGrid; QString m_appDir; @@ -294,6 +286,7 @@ private: QString m_catPort; QString m_handshake; QString m_cmnd; + QString m_msgSent0; QStringList m_macro; QStringList m_dFreq; @@ -317,6 +310,7 @@ private: void freeText(); bool gridOK(QString g); QString rig_command(); + QString baseCall(QString t); }; extern void getfile(QString fname, int ntrperiod); diff --git a/mainwindow.ui b/mainwindow.ui index e233ad7d5..368f60874 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -643,8 +643,8 @@ p, li { white-space: pre-wrap; } - 43 - 200 + 40 + 180 @@ -675,13 +675,13 @@ p, li { white-space: pre-wrap; } 0 - 200 + 180 16777215 - 200 + 180 @@ -1318,15 +1318,21 @@ p, li { white-space: pre-wrap; } 0 - 260 + 230 + + QTabWidget::West + + + QTabWidget::Triangular + 0 - WSJT Traditional + 1 @@ -1743,7 +1749,7 @@ p, li { white-space: pre-wrap; } - New Message Controls + 2 @@ -1829,6 +1835,38 @@ p, li { white-space: pre-wrap; } + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + -50 + + + 49 + + + -15 + + + + + + + Report + + + @@ -1873,6 +1911,7 @@ p, li { white-space: pre-wrap; } + @@ -1943,7 +1982,7 @@ p, li { white-space: pre-wrap; } - true + false Options @@ -2390,6 +2429,14 @@ p, li { white-space: pre-wrap; } Display distance in miles + + + true + + + Double-click on call sets Tx Enable + + diff --git a/widegraph.ui b/widegraph.ui index f6718f836..c7af74fbd 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -80,7 +80,7 @@ true - FFT B/P + FFT Bins/Pixel 2