From 407eb2c514da0c7dc1b03d778cf76dbe9c780a72 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 10 Jul 2017 00:01:20 +0000 Subject: [PATCH] Correct issues with UDP messages and screen layout for MSK144 and FT8 modes git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7830 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/mskrtd.f90 | 8 ++++---- mainwindow.cpp | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/lib/mskrtd.f90 b/lib/mskrtd.f90 index 34a4e7848..26517bec4 100644 --- a/lib/mskrtd.f90 +++ b/lib/mskrtd.f90 @@ -12,7 +12,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & parameter (NRECENT=10) !Number of recent calls to remember parameter (NSHMEM=50) !Number of recent SWL messages to remember - character*3 decsym !"&" for mskspd or "^" for long averages + character*4 decsym !"&" for mskspd or "^" for long averages character*22 msgreceived !Decoded message character*22 msglast,msglastswl !Used for dupechecking character*80 line !Formatted line with UTC dB T Freq Msg @@ -190,8 +190,8 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & btrain,datadir,ncorrected,eyeopening,pcoeffs) endif - decsym=' & ' - if( btrain ) decsym=' ^ ' + decsym=' & ' + if( btrain ) decsym=' ^ ' if( msgreceived(1:1).eq.'<') then ncorrected=0 eyeopening=0.0 @@ -213,7 +213,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & endif write(line,1020) nutc0,nsnr,tdec,nint(fest),decsym,msgreceived, & navg,ncorrected,eyeopening,char(0) -1020 format(i6.6,i4,f5.1,i5,a3,a22,i2,i3,f5.1,a1) +1020 format(i6.6,i4,f5.1,i5,a4,a22,i2,i3,f5.1,a1) elseif(bswl .and. ndecodesuccess.ge.2) then seenb4=.false. do i=1,nshmem diff --git a/mainwindow.cpp b/mainwindow.cpp index 5c248cb67..ae7482e06 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3526,6 +3526,19 @@ void MainWindow::processMessage(QString const& messages, int position, bool ctrl int i1=t1.lastIndexOf(QChar::LineFeed) + 1; //points to first char of line DecodedText decodedtext; QString t2 = messages.mid(i1,position-i1); //selected line + + // basic mode sanity checks + auto const& parts = t2.split (' ', QString::SkipEmptyParts); + if (parts.size () < 5) return; + auto const& mode = parts[4]; + if (("JT9+JT65" == m_mode && !("@" == mode || "#" == mode)) + || ("JT65" == m_mode && mode != "#") + || ("JT9" == m_mode && mode != "@") + || ("MSK144" == m_mode && !("&" == mode || "^" == mode)) + || ("QRA64" == m_mode && mode.left (1) != ":")) { + return; + } + QString t2a; int ntsec=3600*t2.mid(0,2).toInt() + 60*t2.mid(2,2).toInt(); if(m_bFastMode or m_mode=="FT8") { @@ -4354,8 +4367,8 @@ void MainWindow::on_actionFT8_triggered() m_TRperiod=15; m_fastGraph->hide(); m_wideGraph->show(); - ui->decodedTextLabel->setText( " UTC dB DT Freq Message"); - ui->decodedTextLabel2->setText(" UTC dB DT Freq Message"); + ui->decodedTextLabel->setText( " UTC dB DT Freq Message"); + ui->decodedTextLabel2->setText(" UTC dB DT Freq Message"); m_wideGraph->setPeriod(m_TRperiod,m_nsps); m_modulator->setPeriod(m_TRperiod); // TODO - not thread safe m_detector->setPeriod(m_TRperiod); // TODO - not thread safe @@ -5837,18 +5850,21 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de { // a message we are willing to accept QString format_string {"%1 %2 %3 %4 %5 %6"}; - auto cqtext = format_string.arg (time.toString ("hhmm")) - .arg (snr, 3) - .arg (delta_time, 4, 'f', 1) - .arg (delta_frequency, 4) - .arg (mode) - .arg (message_text); + auto const& time_string = time.toString ("~" == mode || "&" == mode ? "hhmmss" : "hhmm"); + auto cqtext = format_string + .arg (time_string) + .arg (snr, 3) + .arg (delta_time, 4, 'f', 1) + .arg (delta_frequency, 4) + .arg (mode) + .arg (message_text); auto messages = ui->decodedTextBrowser->toPlainText (); auto position = messages.lastIndexOf (cqtext); if (position < 0) { // try again with with -0.0 delta time - position = messages.lastIndexOf (format_string.arg (time.toString ("hhmm")) + position = messages.lastIndexOf (format_string + .arg (time_string) .arg (snr, 3) .arg ('-' + QString::number (delta_time, 'f', 1), 4) .arg (delta_frequency, 4) @@ -5870,6 +5886,7 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de } // find the linefeed at the end of the line position = ui->decodedTextBrowser->toPlainText().indexOf(QChar::LineFeed,position); + m_bDoubleClicked = true; processMessage (messages, position, false); tx_watchdog (false); QApplication::alert (this); @@ -5924,10 +5941,12 @@ void MainWindow::postDecode (bool is_new, QString const& message) auto const& parts = decode.left (22).split (' ', QString::SkipEmptyParts); if (parts.size () >= 5) { + auto has_seconds = parts[0].size () > 4; m_messageClient->decode (is_new - , QTime::fromString (parts[0], parts[0].size () > 4 ? "hhmmss" : "hhmm") + , QTime::fromString (parts[0], has_seconds ? "hhmmss" : "hhmm") , parts[1].toInt () - , parts[2].toFloat (), parts[3].toUInt (), parts[4][0], decode.mid (22)); + , parts[2].toFloat (), parts[3].toUInt (), parts[4][0] + , decode.mid (has_seconds ? 24 : 22)); } }