From 17f420b48b01d752032992ad2d5726bf0c64c408 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 7 Apr 2020 18:25:35 -0400 Subject: [PATCH 01/12] Allow generation of messages with EME-style 'OOO' report. --- lib/jt65sim.f90 | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/jt65sim.f90 b/lib/jt65sim.f90 index 6f7030cf4..67f33acfb 100644 --- a/lib/jt65sim.f90 +++ b/lib/jt65sim.f90 @@ -169,23 +169,17 @@ program jt65sim if(csubmode.eq.'B' .and. snrdb.eq.0.0) xsnr=-21 - isig if(csubmode.eq.'C' .and. snrdb.eq.0.0) xsnr=-21 - isig -!### -! call1="K1ABC" -! ic3=65+mod(isig-1,26) -! ic2=65+mod((isig-1)/26,26) -! ic1=65 -! call2="W9"//char(ic1)//char(ic2)//char(ic3) -! write(msg,1010) call1,call2,nint(xsnr) -!1010 format(a5,1x,a5,1x,i3.2) -!### call packmsg(msg,dgen,itype) !Pack message into 12 six-bit bytes call rs_encode(dgen,sent) !Encode using RS(63,12) call interleave63(sent,1) !Interleave channel symbols call graycode65(sent,63,1) !Apply Gray code + nprc_test=0 + i1=len(trim(msg)) + if(msg(i1-3:i1).eq.' OOO') nprc_test=1 k=0 do j=1,nsym !Insert sync and data into itone() - if(nprc(j).eq.0) then + if(nprc(j).eq.nprc_test) then k=k+1 itone(j)=sent(k)+2 else From d69da851c1973c06fbd132717aade639d4a0a35e Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 7 Apr 2020 18:26:30 -0400 Subject: [PATCH 02/12] Fix the 'OO O' display problem for some JT65 decodes. --- widgets/mainwindow.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 8f09e2c58..cf6cf818c 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3086,17 +3086,6 @@ void MainWindow::decodeDone () if(dec_data.params.nzhsym==m_earlyDecode2) m_blankLine=false; } if(SpecOp::FOX == m_config.special_op_id()) houndCallers(); - -/* - auto now = QDateTime::currentDateTimeUtc(); - double tsec = fmod(double(now.toMSecsSinceEpoch()),86400000.0)/1000.0; - double tseq = fmod(double(now.toMSecsSinceEpoch() ),1000.0*m_TRperiod)/1000.0; - if(tseq < 0.5*m_TRperiod) tseq+= m_TRperiod; - QString t=""; - t.sprintf("ee decodeDone %11.3f %5d %5d %7.3f ",tsec,m_ihsym,m_ihsym,tseq); - qDebug().noquote() << t << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz"); -*/ - to_jt9(m_ihsym,-1,1); //Tell jt9 we know it has finished } @@ -3104,19 +3093,18 @@ void MainWindow::readFromStdout() //readFromStdout { while(proc_jt9.canReadLine()) { auto line_read = proc_jt9.readLine (); - if (auto p = std::strpbrk (line_read.constData (), "\n\r")) - { - // truncate before line ending chars - line_read = line_read.left (p - line_read.constData ()); - } + if (auto p = std::strpbrk (line_read.constData (), "\n\r")) { + // truncate before line ending chars + line_read = line_read.left (p - line_read.constData ()); + } if(m_mode!="FT8" and m_mode!="FT4") { //Pad 22-char msg to at least 37 chars - line_read = line_read.left(43) + " " + line_read.mid(43); + line_read = line_read.left(44) + " " + line_read.mid(44); } bool bAvgMsg=false; int navg=0; + if(line_read.indexOf("") >= 0) { -// qDebug() << "bb" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz") << line_read; if(m_mode!="FT8" or dec_data.params.nzhsym==50) m_nDecodes=0; if(m_mode=="QRA64") m_wideGraph->drawRed(0,0); m_bDecoded = line_read.mid(20).trimmed().toInt() > 0; From 9d2b2b1a564ea8bda5294ef8f5eaf63af6fe7cb0 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 8 Apr 2020 10:56:11 -0400 Subject: [PATCH 03/12] Maintain visibility of AvgMsg window when it has been activated. --- widgets/mainwindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index cf6cf818c..90ed6133d 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -2593,15 +2593,15 @@ void MainWindow::on_actionColors_triggered() void MainWindow::on_actionMessage_averaging_triggered() { - if(!m_msgAvgWidget) { + if(m_msgAvgWidget == NULL) { m_msgAvgWidget.reset (new MessageAveraging {m_settings, m_config.decoded_text_font ()}); // Connect signals from Message Averaging window connect (this, &MainWindow::finished, m_msgAvgWidget.data (), &MessageAveraging::close); } m_msgAvgWidget->showNormal(); - m_msgAvgWidget->raise (); - m_msgAvgWidget->activateWindow (); + m_msgAvgWidget->raise(); + m_msgAvgWidget->activateWindow(); } void MainWindow::on_actionOpen_triggered() //Open File @@ -4013,9 +4013,7 @@ void MainWindow::guiUpdate() //Once per second: if(nsec != m_sec0) { -// qDebug() << "onesec" << m_config.force_call_1st(); - // if((!m_msgAvgWidget or (m_msgAvgWidget and !m_msgAvgWidget->isVisible())) - // and (SpecOp::NONE < m_config.special_op_id()) and (SpecOp::HOUND > m_config.special_op_id())) on_actionFox_Log_triggered(); +// qDebug() << "onesec" << m_mode; if(m_freqNominal!=0 and m_freqNominal<50000000 and m_config.enable_VHF_features()) { if(!m_bVHFwarned) vhfWarning(); } else { @@ -7281,8 +7279,11 @@ void::MainWindow::VHF_features_enabled(bool b) ui->actionMessage_averaging->setEnabled(b); ui->actionEnable_AP_DXcall->setVisible (m_mode=="QRA64"); ui->actionEnable_AP_JT65->setVisible (b && m_mode=="JT65"); + if(!b && m_msgAvgWidget and (SpecOp::FOX != m_config.special_op_id()) and !m_config.autoLog()) { - if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->close(); + if(m_msgAvgWidget->isVisible() and m_mode!="JT4" and m_mode!="JT9" and m_mode!="JT65") { + m_msgAvgWidget->close(); + } } } From 039079109044baf68bad29537ce591d43ada42a3 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 8 Apr 2020 16:56:28 -0400 Subject: [PATCH 04/12] Fix some problems with message averaging, etc., in JT65 with VHF features enabled. Needs further testing! --- lib/decoder.f90 | 2 +- lib/jt65_decode.f90 | 49 +++++++++++++++++++++++------------------- widgets/mainwindow.cpp | 13 ++++++++++- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 6902c3a58..a5025f04a 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -426,7 +426,7 @@ contains endif nap=ishft(ft,-2) if(nap.ne.0) then - write(cflags(1:3),'(a1,i1)') 'a',nap + write(cflags(1:3),'(a1,2i1)') 'a',nap,nsum endif endif csync='# ' diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index 6d0bd6243..1e87c03a5 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -210,13 +210,13 @@ contains nsave=0 endif - if(bVHF) then +! if(bVHF) then ! Be sure to search for shorthand message at nfqso +/- ntol - if(ncand.lt.300) ncand=ncand+1 - ca(ncand)%sync=5.0 - ca(ncand)%dt=2.5 - ca(ncand)%freq=nfqso - endif +! if(ncand.lt.300) ncand=ncand+1 +! ca(ncand)%sync=5.0 +! ca(ncand)%dt=2.5 +! ca(ncand)%freq=nfqso +! endif do icand=1,ncand sync1=ca(icand)%sync dtx=ca(icand)%dt @@ -242,12 +242,12 @@ contains if(sync1.lt.float(minsync) .and. & decoded.eq.' ') nflip=0 if(nft.ne.0) nsum=1 - + nhard_min=param(1) nrtt1000=param(4) ntotal_min=param(5) nsmo=param(9) - + nfreq=nint(freq+a(1)) ndrift=nint(2.0*a(2)) if(bVHF) then @@ -262,9 +262,9 @@ contains if(nsnr.lt.-30) nsnr=-30 if(nsnr.gt.-1) nsnr=-1 nftt=0 - !********* DOES THIS STILL WORK WHEN NFT INCLUDES # OF AP SYMBOLS USED?? - if(nft.ne.1 .and. iand(ndepth,16).eq.16 .and. (.not.prtavg)) then + if(nft.ne.1 .and. iand(ndepth,16).eq.16 .and. & + sync1.ge.float(minsync) .and. (.not.prtavg)) then ! Single-sequence FT decode failed, so try for an average FT decode. if(nutc.ne.nutc0 .or. abs(nfreq-nfreq0).gt.ntol) then ! This is a new minute or a new frequency, so call avg65. @@ -279,7 +279,8 @@ contains nsmo=param(9) nqave=int(qave) - if (associated(this%callback) .and. nsum.ge.2) then + if (associated(this%callback) .and.nftt.ge.1 .and. nsum.ge.2) then +! Display a decoded message obtained by averaging 2 or more transmissions call this%callback(sync1,nsnr,dtx-1.0,nfreq,ndrift, & nflip,width,avemsg,nftt,nqave,nsmo,nsum,minsync) prtavg=.true. @@ -288,14 +289,15 @@ contains endif endif - if(nftt.eq.1) then -! nft=1 - decoded=avemsg - go to 5 - endif + if(nftt.eq.0) go to 5 +! if(nftt.eq.1) then +!! nft=1 +! decoded=avemsg +! go to 5 +! endif n=naggressive rtt=0.001*nrtt1000 - if(nft.lt.2 .and. minsync.ge.0 .and. nspecial.eq.0) then + if(nft.lt.2 .and. minsync.ge.0 .and. nspecial.eq.0 .and. .not.bVHF) then if(nhard_min.gt.50) cycle if(nhard_min.gt.h0(n)) cycle if(ntotal_min.gt.d0(n)) cycle @@ -305,7 +307,8 @@ contains 5 continue if(decoded.eq.decoded0 .and. abs(freq-freq0).lt. 3.0 .and. & minsync.ge.0) cycle !Don't display dupes - if(decoded.ne.' ' .or. minsync.lt.0) then +! if(decoded.ne.' ' .or. minsync.lt.0) then + if(decoded.ne.' ' .or. bVHF) then if(nsubtract.eq.1) then call timer('subtr65 ',0) call subtract65(dd,npts,freq,dtx) @@ -319,7 +322,7 @@ contains exit endif enddo - if(ndupe.ne.1 .and. sync1.ge.float(minsync)) then + if(ndupe.ne.1 .and. ((sync1.ge.float(minsync)) .or. bVHF)) then if(ipass.eq.1) n65a=n65a + 1 if(ipass.eq.2) n65b=n65b + 1 if(ndecoded.lt.50) ndecoded=ndecoded+1 @@ -329,7 +332,7 @@ contains dec(ndecoded)%decoded=decoded nqual=min(int(qual),9999) - if (associated(this%callback)) then + if(associated(this%callback)) then call this%callback(sync1,nsnr,dtx-1.0,nfreq,ndrift, & nflip,width,decoded,nft,nqual,nsmo,1,minsync) end if @@ -377,12 +380,13 @@ contains iutc=-1 nfsave=0 dtdiff=0.2 - first=.false. s3save=0. s1save=0. nsave=1 !### ??? ! Silence compiler warnings if(nagain .and. ndeepave.eq.-99 .and. neme.eq.-99) stop + first=.false. +! print*,'Clear avg',nutc endif do i=1,64 @@ -398,7 +402,8 @@ contains nflipsave(nsave)=nflip s1save(-255:256,1:126,nsave)=s1 s3save(1:64,1:63,nsave)=s3a - +! print*,'nsave:',nsave + 10 syncsum=0. dtsum=0. nfsum=0 diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 90ed6133d..54e7bfa36 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3139,6 +3139,16 @@ void MainWindow::readFromStdout() //readFromStdout } if(navg>1 or line_read.indexOf("f*")>0) bAvgMsg=true; } + if(m_mode=="JT65") { + if(n<0) n=line_read.indexOf("a"); + if(n>0) { + int i=line_read.mid(n+1,2).toInt(); +// int nap=i/10; + navg=0; + if(i>10) navg=i%10; + if(navg >= 2) bAvgMsg=true; + } + } } write_all("Rx",line_read.trimmed()); if (m_config.insert_blank () && m_blankLine && SpecOp::FOX != m_config.special_op_id()) { @@ -3225,7 +3235,8 @@ void MainWindow::readFromStdout() //readFromStdout if(SpecOp::FOX!=m_config.special_op_id() and (for_us or (abs(audioFreq - m_wideGraph->rxFreq()) <= 10))) bDisplayRight=true; } } else { - if(abs(audioFreq - m_wideGraph->rxFreq()) <= 10) bDisplayRight=true; + if((abs(audioFreq - m_wideGraph->rxFreq()) <= 10) and + !m_config.enable_VHF_features()) bDisplayRight=true; } if (bDisplayRight) { From 11e1f78647aa6b77bfbf3e7a7e172c8fafe8ba6a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 8 Apr 2020 21:47:10 -0400 Subject: [PATCH 05/12] Fix a problem with turning DS on/off in JT65. --- lib/decode65a.f90 | 5 +++-- lib/decode65b.f90 | 2 +- lib/jt65_decode.f90 | 2 -- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/decode65a.f90 b/lib/decode65a.f90 index 777031e69..b307bc330 100644 --- a/lib/decode65a.f90 +++ b/lib/decode65a.f90 @@ -93,6 +93,7 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & call timer('dec65b ',0) qualbest=0. + nftbest=0 qual0=-1.e30 minsmo=0 maxsmo=0 @@ -126,7 +127,6 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & call decode65b(s2,nflip,nadd,mode65,ntrials,naggressive,ndepth, & mycall,hiscall,hisgrid,nQSOProgress,ljt65apon,nqd,nft,qual, & nhist,decoded) - if(nft.eq.1) then nsmo=ismo param(9)=nsmo @@ -138,13 +138,14 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & qualbest=qual nnbest=nn nsmobest=ismo + nftbest=nft endif endif if(qual.lt.qual0) exit qual0=qual enddo - if(nft.eq.2) then + if(nftbest.eq.2) then decoded=decoded_best qual=qualbest nsmo=nsmobest diff --git a/lib/decode65b.f90 b/lib/decode65b.f90 index 2be808145..0ff169bc7 100644 --- a/lib/decode65b.f90 +++ b/lib/decode65b.f90 @@ -21,7 +21,7 @@ subroutine decode65b(s2,nflip,nadd,mode65,ntrials,naggressive,ndepth, & call extract(s3,nadd,mode65,ntrials,naggressive,ndepth,nflip,mycall, & hiscall,hisgrid,nQSOProgress,ljt65apon,ncount, & - nhist,decoded,ltext,nft,qual) + nhist,decoded,ltext,nft,qual) ! Suppress "birdie messages" and other garbage decodes: if(decoded(1:7).eq.'000AAA ') ncount=-1 diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index 1e87c03a5..fb21fc34e 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -386,7 +386,6 @@ contains ! Silence compiler warnings if(nagain .and. ndeepave.eq.-99 .and. neme.eq.-99) stop first=.false. -! print*,'Clear avg',nutc endif do i=1,64 @@ -402,7 +401,6 @@ contains nflipsave(nsave)=nflip s1save(-255:256,1:126,nsave)=s1 s3save(1:64,1:63,nsave)=s3a -! print*,'nsave:',nsave 10 syncsum=0. dtsum=0. From eafaa1ce2829285ebce3a34bbb6635e6c5c86fb2 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 9 Apr 2020 10:40:21 -0400 Subject: [PATCH 06/12] Fix a bug in generating EME shorthand messages in JT65sim. --- lib/jt65sim.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jt65sim.f90 b/lib/jt65sim.f90 index 67f33acfb..26e558f44 100644 --- a/lib/jt65sim.f90 +++ b/lib/jt65sim.f90 @@ -176,7 +176,9 @@ program jt65sim nprc_test=0 i1=len(trim(msg)) - if(msg(i1-3:i1).eq.' OOO') nprc_test=1 + if(i1.gt.10) then + if(msg(i1-3:i1).eq.' OOO') nprc_test=1 + endif k=0 do j=1,nsym !Insert sync and data into itone() if(nprc(j).eq.nprc_test) then From 899d0e71ce596e087d3aacb06e74e7b220484a43 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 9 Apr 2020 10:51:35 -0400 Subject: [PATCH 07/12] Re-establish improved decoding for JT65 shorthand messages. --- lib/jt65_decode.f90 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index fb21fc34e..dcf5120c7 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -210,13 +210,13 @@ contains nsave=0 endif -! if(bVHF) then + if(bVHF) then ! Be sure to search for shorthand message at nfqso +/- ntol -! if(ncand.lt.300) ncand=ncand+1 -! ca(ncand)%sync=5.0 -! ca(ncand)%dt=2.5 -! ca(ncand)%freq=nfqso -! endif + if(ncand.lt.300) ncand=ncand+1 + ca(ncand)%sync=5.0 + ca(ncand)%dt=2.5 + ca(ncand)%freq=nfqso + endif do icand=1,ncand sync1=ca(icand)%sync dtx=ca(icand)%dt @@ -238,6 +238,10 @@ contains if(nspecial.eq.2) decoded='RO' if(nspecial.eq.3) decoded='RRR' if(nspecial.eq.4) decoded='73' + if(nspecial.eq.0 .and. sync1.eq.5.0 .and. dtx.eq.2.5) then + nft=0 + decoded=' ' + endif call timer('decod65a',1) if(sync1.lt.float(minsync) .and. & decoded.eq.' ') nflip=0 From c188f8ee89f64de322c3c592c05dbfb0a819ee46 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 9 Apr 2020 13:56:35 -0400 Subject: [PATCH 08/12] More cleanup of the display of special JT65 decoding modes: avg, deep, AP. --- lib/decode65a.f90 | 1 + lib/decoder.f90 | 23 ++++++++++++++++------- lib/jt65_decode.f90 | 11 ++++------- widgets/mainwindow.cpp | 33 ++++++++++++++++----------------- 4 files changed, 37 insertions(+), 31 deletions(-) diff --git a/lib/decode65a.f90 b/lib/decode65a.f90 index b307bc330..ec9fbd311 100644 --- a/lib/decode65a.f90 +++ b/lib/decode65a.f90 @@ -151,6 +151,7 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & nsmo=nsmobest param(9)=nsmo nn=nnbest + nft=nftbest endif call timer('dec65b ',1) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index a5025f04a..9e06c649d 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -407,7 +407,9 @@ contains 1011 format(i4.4,i4,i5,f6.2,f8.0,i4,3x,a22,' QRA64',i3) go to 100 endif - + +! write(*,3001) ft,nsum,qual,sync,bVHF +!3001 format('a',3i3,f5.1,L3) if(ft.eq.0 .and. minsync.ge.0 .and. int(sync).lt.minsync) then write(*,1010) params%nutc,snr,dt,freq else @@ -415,18 +417,19 @@ contains if(bVHF .and. ft.gt.0) then cflags='f ' if(is_deep) then - cflags(1:2)='d1' - write(cflags(3:3),'(i1)') min(qual,9) - if(qual.ge.10) cflags(3:3)='*' + cflags='d ' + write(cflags(2:2),'(i1)') min(qual,9) + if(qual.ge.10) cflags(2:2)='*' if(qual.lt.3) decoded(22:22)='?' endif if(is_average) then - write(cflags(2:2),'(i1)') min(nsum,9) - if(nsum.ge.10) cflags(2:2)='*' + write(cflags(3:3),'(i1)') min(nsum,9) + if(nsum.ge.10) cflags(3:3)='*' endif nap=ishft(ft,-2) if(nap.ne.0) then - write(cflags(1:3),'(a1,2i1)') 'a',nap,nsum + if(nsum.lt.2) write(cflags(1:3),'(a1,i1," ")') 'a',nap + if(nsum.ge.2) write(cflags(1:3),'(a1,2i1)') 'a',nap,min(nsum,9) endif endif csync='# ' @@ -445,6 +448,12 @@ contains endif endif endif + n=len(trim(decoded)) + if(n.eq.2 .or. n.eq.3) csync='# ' + if(cflags(1:1).eq.'f') then + cflags(2:2)=cflags(3:3) + cflags(3:3)=' ' + endif write(*,1010) params%nutc,snr,dt,freq,csync,decoded,cflags 1010 format(i4.4,i4,f5.1,i5,1x,a2,1x,a22,1x,a3) endif diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index dcf5120c7..551577db3 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -235,14 +235,11 @@ contains naggressive,ndepth,ntol,mycall,hiscall,hisgrid,nQSOProgress, & ljt65apon,bVHF,sync2,a,dtx,nft,nspecial,qual, & nhist,nsmo,decoded) + call timer('decod65a',1) + if(nspecial.eq.0 .and. sync1.eq.5.0 .and. dtx.eq.2.5) cycle if(nspecial.eq.2) decoded='RO' if(nspecial.eq.3) decoded='RRR' if(nspecial.eq.4) decoded='73' - if(nspecial.eq.0 .and. sync1.eq.5.0 .and. dtx.eq.2.5) then - nft=0 - decoded=' ' - endif - call timer('decod65a',1) if(sync1.lt.float(minsync) .and. & decoded.eq.' ') nflip=0 if(nft.ne.0) nsum=1 @@ -449,7 +446,6 @@ contains enddo if(nsum.lt.2) go to 900 - nftt=0 df=1378.125/512.0 ! Do the smoothing loop @@ -462,6 +458,7 @@ contains endif nn=0 do ismo=minsmo,maxsmo + nftt=0 if(ismo.gt.0) then do j=1,126 call smo121(s1b(-255,j),512) @@ -499,7 +496,7 @@ contains nsmo=ismo param(9)=nsmo go to 900 - else if(nftt.eq.2) then + else if(nftt.ge.2) then if(qual.gt.qualbest) then deepbest=avemsg qualbest=qual diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 54e7bfa36..5e27f2fb5 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3128,27 +3128,26 @@ void MainWindow::readFromStdout() //readFromStdout m_nDecodes+=1; ndecodes_label.setText(QString::number(m_nDecodes)); if(m_mode=="JT4" or m_mode=="JT65" or m_mode=="QRA64") { - int n=line_read.indexOf("f"); - if(n<0) n=line_read.indexOf("d"); - if(n>0) { - QString tt=line_read.mid(n+1,1); - navg=tt.toInt(); - if(navg==0) { - char c = tt.data()->toLatin1(); - if(int(c)>=65 and int(c)<=90) navg=int(c)-54; - } - if(navg>1 or line_read.indexOf("f*")>0) bAvgMsg=true; + int nf=line_read.indexOf("f"); + if(nf>0) { + navg=line_read.mid(nf+1,1).toInt(); + if(line_read.indexOf("f*")>0) navg=10; + } + int nd=-1; + if(nf<0) nd=line_read.indexOf("d"); + if(nd>0) { + navg=line_read.mid(nd+2,1).toInt(); + if(line_read.mid(nd+2,1)=="*") navg=10; } if(m_mode=="JT65") { - if(n<0) n=line_read.indexOf("a"); - if(n>0) { - int i=line_read.mid(n+1,2).toInt(); -// int nap=i/10; - navg=0; - if(i>10) navg=i%10; - if(navg >= 2) bAvgMsg=true; + int na=-1; + if(nf<0 and nd<0) na=line_read.indexOf("a"); + if(na>0) { + navg=line_read.mid(na+2,1).toInt(); + if(line_read.mid(na+2,1)=="*") navg=10; } } + if(navg>=2) bAvgMsg=true; } write_all("Rx",line_read.trimmed()); if (m_config.insert_blank () && m_blankLine && SpecOp::FOX != m_config.special_op_id()) { From e3d2d5d65a748e007149a21b6620c5a4c1f448e1 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 9 Apr 2020 15:30:12 -0400 Subject: [PATCH 09/12] Fix another piece of flaky behavior with Deep Search average decodes. --- lib/extract.f90 | 1 - lib/jt65_decode.f90 | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/extract.f90 b/lib/extract.f90 index 197448fe5..234f51370 100644 --- a/lib/extract.f90 +++ b/lib/extract.f90 @@ -179,7 +179,6 @@ subroutine extract(s3,nadd,mode65,ntrials,naggressive,ndepth,nflip, & if(nft.gt.0) exit enddo -!write(*,*) nft if(nft.eq.0 .and. iand(ndepth,32).eq.32) then qmin=2.0 - 0.1*naggressive call timer('hint65 ',0) diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index 551577db3..ed12a3f3a 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -76,7 +76,7 @@ contains character*22 decoded end type accepted_decode type(accepted_decode) dec(50) - logical :: first_time,prtavg,single_decode,bVHF + logical :: first_time,prtavg,single_decode,bVHF,clear_avg65 integer h0(0:11),d0(0:11) real r0(0:11) @@ -90,7 +90,7 @@ contains ! 0 1 2 3 4 5 6 7 8 9 10 11 data r0/0.70,0.72,0.74,0.76,0.78,0.80,0.82,0.84,0.86,0.88,0.90,0.90/ - data nutc0/-999/,nfreq0/-999/,nsave/0/ + data nutc0/-999/,nfreq0/-999/,nsave/0/,clear_avg65/.true./ save this%callback => callback @@ -208,6 +208,7 @@ contains if(clearave) then nsum=0 nsave=0 + clear_avg65=.true. endif if(bVHF) then @@ -274,9 +275,9 @@ contains nsave=nsave+1 nsave=mod(nsave-1,64)+1 call avg65(nutc,nsave,sync1,dtx,nflip,nfreq,mode65,ntol, & - ndepth,nagain,ntrials,naggressive,clearave,neme,mycall, & - hiscall,hisgrid,nftt,avemsg,qave,deepave,nsum,ndeepave, & - nQSOProgress,ljt65apon) + ndepth,nagain,ntrials,naggressive,clear_avg65,neme, & + mycall,hiscall,hisgrid,nftt,avemsg,qave,deepave,nsum, & + ndeepave,nQSOProgress,ljt65apon) nsmo=param(9) nqave=int(qave) @@ -349,8 +350,8 @@ contains end subroutine decode subroutine avg65(nutc,nsave,snrsync,dtxx,nflip,nfreq,mode65,ntol,ndepth, & - nagain, ntrials,naggressive,clearave,neme,mycall,hiscall,hisgrid,nftt, & - avemsg,qave,deepave,nsum,ndeepave,nQSOProgress,ljt65apon) + nagain, ntrials,naggressive,clear_avg65,neme,mycall,hiscall,hisgrid, & + nftt,avemsg,qave,deepave,nsum,ndeepave,nQSOProgress,ljt65apon) ! Decodes averaged JT65 data @@ -373,11 +374,11 @@ contains real s3c(64,63) real dtsave(MAXAVE) real syncsave(MAXAVE) - logical first,clearave,ljt65apon + logical first,clear_avg65,ljt65apon data first/.true./ save - if(first .or. clearave) then + if(first .or. clear_avg65) then iutc=-1 nfsave=0 dtdiff=0.2 @@ -387,6 +388,7 @@ contains ! Silence compiler warnings if(nagain .and. ndeepave.eq.-99 .and. neme.eq.-99) stop first=.false. + clear_avg65=.false. endif do i=1,64 @@ -402,6 +404,9 @@ contains nflipsave(nsave)=nflip s1save(-255:256,1:126,nsave)=s1 s3save(1:64,1:63,nsave)=s3a + avemsg=' ' + deepbest=' ' + nfttbest=0 10 syncsum=0. dtsum=0. @@ -413,7 +418,7 @@ contains do i=1,MAXAVE !Consider all saved spectra cused(i)='.' - if(iutc(i).lt.0) cycle + if(iutc(i).lt.0) exit if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only same (odd/even) seq if(abs(dtxx-dtsave(i)).gt.dtdiff) cycle !DT must match if(abs(nfreq-nfsave(i)).gt.ntol) cycle !Freq must match @@ -506,7 +511,6 @@ contains endif endif enddo - if(nfttbest.eq.2) then avemsg=deepbest !### ??? deepave=deepbest @@ -516,7 +520,7 @@ contains nftt=nfttbest endif 900 continue - + return end subroutine avg65 From 811218ea23c253a6b4895bc8edc7a73aeebac702 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 9 Apr 2020 15:44:06 -0400 Subject: [PATCH 10/12] Updte description of AP decoding to account for changes in JT65 message averaging. --- doc/user_guide/en/decoder_notes.adoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/user_guide/en/decoder_notes.adoc b/doc/user_guide/en/decoder_notes.adoc index cdae09a01..214f0bb17 100644 --- a/doc/user_guide/en/decoder_notes.adoc +++ b/doc/user_guide/en/decoder_notes.adoc @@ -59,8 +59,10 @@ be attempted in each state. |CALLING CQ | 1, 2 |=========================================== -Decoding with _a priori_ information behaves slightly differently -in JT65. Some details are provided in Tables 3 and 4. +Decoding with _a priori_ information behaves slightly differently in +JT65. Some details are provided in Tables 3 and 4. Notations such as +`a63`, use a second digit to indicate the number of Rx intervals +averaged to obtain the decode. [[JT65_AP_INFO_TABLE]] .JT65 AP information types From b6e2fa82c0dc098adad19074593050adbcc5c8e0 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 10 Apr 2020 11:19:42 -0400 Subject: [PATCH 11/12] Update copyright notice to 2020. --- widgets/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 5e27f2fb5..1fe392178 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -2468,7 +2468,7 @@ void MainWindow::on_actionCopyright_Notice_triggered() "\"The algorithms, source code, look-and-feel of WSJT-X and related " "programs, and protocol specifications for the modes FSK441, FT8, JT4, " "JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144 are Copyright (C) " - "2001-2019 by one or more of the following authors: Joseph Taylor, " + "2001-2020 by one or more of the following authors: Joseph Taylor, " "K1JT; Bill Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, " "IV3NWV; Greg Beam, KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; " "Philip Karn, KA9Q; and other members of the WSJT Development Group.\""); From ad4e196d139b3ce4157a7de85d1d7bd79ee8bc92 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sun, 12 Apr 2020 22:09:06 +0100 Subject: [PATCH 12/12] Handle attempts to use Omni-Rig when not installed more gracefully --- Transceiver/OmniRigTransceiver.cpp | 30 +++++++++++++++++++----------- Transceiver/OmniRigTransceiver.hpp | 1 + 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Transceiver/OmniRigTransceiver.cpp b/Transceiver/OmniRigTransceiver.cpp index 00d76546a..48219ecde 100644 --- a/Transceiver/OmniRigTransceiver.cpp +++ b/Transceiver/OmniRigTransceiver.cpp @@ -107,6 +107,12 @@ OmniRigTransceiver::OmniRigTransceiver (std::unique_ptr wrapped , send_update_signal_ {false} , reversed_ {false} { + CoInitializeEx (nullptr, 0 /*COINIT_APARTMENTTHREADED*/); // required because Qt only does this for GUI thread +} + +OmniRigTransceiver::~OmniRigTransceiver () +{ + CoUninitialize (); } // returns false on time out @@ -121,9 +127,8 @@ bool OmniRigTransceiver::await_notification_with_timeout (int timeout) int OmniRigTransceiver::do_start () { TRACE_CAT ("OmniRigTransceiver", "starting"); - if (wrapped_) wrapped_->start (0); - CoInitializeEx (nullptr, 0 /*COINIT_APARTMENTTHREADED*/); // required because Qt only does this for GUI thread + if (wrapped_) wrapped_->start (0); omni_rig_.reset (new OmniRig::OmniRigX {this}); if (omni_rig_->isNull ()) @@ -315,18 +320,19 @@ void OmniRigTransceiver::do_stop () port_->clear (); port_.reset (); } - if (omni_rig_) + if (omni_rig_ && !omni_rig_->isNull ()) { - if (rig_) + if (rig_ && !rig_->isNull ()) { rig_->clear (); rig_.reset (); } omni_rig_->clear (); omni_rig_.reset (); - CoUninitialize (); } + if (wrapped_) wrapped_->stop (); + TRACE_CAT ("OmniRigTransceiver", "stopped"); } @@ -344,7 +350,6 @@ void OmniRigTransceiver::handle_visible_change () void OmniRigTransceiver::handle_rig_type_change (int rig_number) { - if (!omni_rig_ || omni_rig_->isNull ()) return; TRACE_CAT ("OmniRigTransceiver", "rig type change: rig =" << rig_number); if (rig_number_ == rig_number) { @@ -361,7 +366,6 @@ void OmniRigTransceiver::handle_rig_type_change (int rig_number) void OmniRigTransceiver::handle_status_change (int rig_number) { - if (!omni_rig_ || omni_rig_->isNull ()) return; TRACE_CAT ("OmniRigTransceiver", QString {"status change for rig %1"}.arg (rig_number).toLocal8Bit ()); if (rig_number_ == rig_number) { @@ -394,7 +398,6 @@ void OmniRigTransceiver::handle_status_change (int rig_number) void OmniRigTransceiver::handle_params_change (int rig_number, int params) { - if (!omni_rig_ || omni_rig_->isNull ()) return; TRACE_CAT ("OmniRigTransceiver", QString {"params change: params = 0x%1 for rig %2"} .arg (params, 8, 16, QChar ('0')) .arg (rig_number).toLocal8Bit () @@ -647,7 +650,6 @@ void OmniRigTransceiver::handle_custom_reply (int rig_number, QVariant const& co (void)command; (void)reply; - if (!omni_rig_ || omni_rig_->isNull ()) return; if (rig_number_ == rig_number) { if (!rig_ || rig_->isNull ()) return; @@ -664,11 +666,14 @@ void OmniRigTransceiver::do_ptt (bool on) if (use_for_ptt_ && TransceiverFactory::PTT_method_CAT == ptt_type_) { TRACE_CAT ("OmniRigTransceiver", "set PTT"); - rig_->SetTx (on ? OmniRig::PM_TX : OmniRig::PM_RX); + if (rig_ && !rig_->isNull ()) + { + rig_->SetTx (on ? OmniRig::PM_TX : OmniRig::PM_RX); + } } else { - if (port_) + if (port_ && !port_->isNull ()) { if (TransceiverFactory::PTT_method_RTS == ptt_type_) { @@ -695,6 +700,7 @@ void OmniRigTransceiver::do_ptt (bool on) void OmniRigTransceiver::do_frequency (Frequency f, MODE m, bool /*no_ignore*/) { TRACE_CAT ("OmniRigTransceiver", f << state ()); + if (!rig_ || rig_->isNull ()) return; if (UNK != m) { do_mode (m); @@ -723,6 +729,7 @@ void OmniRigTransceiver::do_frequency (Frequency f, MODE m, bool /*no_ignore*/) void OmniRigTransceiver::do_tx_frequency (Frequency tx, MODE m, bool /*no_ignore*/) { TRACE_CAT ("OmniRigTransceiver", tx << state ()); + if (!rig_ || rig_->isNull ()) return; bool split {tx != 0}; if (split) { @@ -787,6 +794,7 @@ void OmniRigTransceiver::do_tx_frequency (Frequency tx, MODE m, bool /*no_ignore void OmniRigTransceiver::do_mode (MODE mode) { TRACE_CAT ("OmniRigTransceiver", mode << state ()); + if (!rig_ || rig_->isNull ()) return; // TODO: G4WJS OmniRig doesn't seem to have any capability of tracking/setting VFO B mode auto mapped = map_mode (mode); if (mapped & writable_params_) diff --git a/Transceiver/OmniRigTransceiver.hpp b/Transceiver/OmniRigTransceiver.hpp index 4269a3346..30c46348b 100644 --- a/Transceiver/OmniRigTransceiver.hpp +++ b/Transceiver/OmniRigTransceiver.hpp @@ -32,6 +32,7 @@ public: // takes ownership of wrapped Transceiver explicit OmniRigTransceiver (std::unique_ptr wrapped, RigNumber, TransceiverFactory::PTTMethod ptt_type, QString const& ptt_port, QObject * parent = nullptr); + ~OmniRigTransceiver (); int do_start () override; void do_stop () override;