diff --git a/lib/decoder.f90 b/lib/decoder.f90 index e53ad0437..3f58f8b3e 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -105,7 +105,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) newdat=params%newdat call my_ft8%decode(ft8_decoded,id2,params%nQSOProgress,params%nfqso, & params%nftx,newdat,params%nutc,params%nfa,params%nfb, & - params%ndepth,ncontest,logical(params%nagain), & + params%nzhsym,params%ndepth,ncontest,logical(params%nagain), & logical(params%lft8apon),logical(params%lapcqonly), & params%napwid,mycall,hiscall,hisgrid) call timer('decft8 ',1) diff --git a/lib/ft8/ft8b.f90 b/lib/ft8/ft8b.f90 index a8e0a2e58..26f25712b 100644 --- a/lib/ft8/ft8b.f90 +++ b/lib/ft8/ft8b.f90 @@ -1,6 +1,7 @@ -subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & - napwid,lsubtract,nagain,ncontest,iaptype,mycall12,hiscall12, & - sync0,f1,xdt,xbase,apsym,aph10,nharderrors,dmin,nbadcrc,ipass,iera,msg37,xsnr) +subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & + lapcqonly,napwid,lsubtract,nagain,ncontest,iaptype,mycall12,hiscall12, & + sync0,f1,xdt,xbase,apsym,aph10,nharderrors,dmin,nbadcrc,ipass,iera, & + msg37,xsnr,itone) use crc use timer_module, only: timer @@ -236,7 +237,8 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & else npasses=3 endif - + if(nzhsym.lt.50) npasses=1 + do ipass=1,npasses llrd=llra if(ipass.eq.2) llrd=llrb @@ -405,7 +407,10 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & endif nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message. call get_ft8_tones_from_77bits(message77,itone) - if(lsubtract) call subtractft8(dd0,itone,f1,xdt) + if(lsubtract) call subtractft8(dd0,itone,f1,xdt) +! write(*,3001) nzhsym,npasses,nqsoprogress,ipass,iaptype,lsubtract, & +! f1,xdt,msg37(1:22); flush(6) +!3001 format('A',5i3,L3,f7.1,f7.2,2x,a22) xsig=0.0 xnoi=0.0 do i=1,79 diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index c501bd40b..40b944bed 100644 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -33,14 +33,14 @@ module ft8_decode contains subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, & - nutc,nfa,nfb,ndepth,ncontest,nagain,lft8apon,lapcqonly, & + nutc,nfa,nfb,nzhsym,ndepth,ncontest,nagain,lft8apon,lapcqonly, & napwid,mycall12,hiscall12,hisgrid6) use timer_module, only: timer include 'ft8/ft8_params.f90' class(ft8_decoder), intent(inout) :: this procedure(ft8_decode_callback) :: callback - parameter (MAXCAND=300) + parameter (MAXCAND=300,MAX_EARLY=100) real s(NH1,NHSYM) real sbase(NH1) real candidate(3,MAXCAND) @@ -55,7 +55,12 @@ contains ! character message*22 character*37 allmessages(100) integer allsnrs(100) - save s,dd + integer itone(NN) + integer itone_save(NN,MAX_EARLY) + real f1_save(MAX_EARLY) + real xdt_save(MAX_EARLY) + + save s,dd,ndec_early,itone_save,f1_save,xdt_save this%callback => callback write(datetime,1001) nutc !### TEMPORARY ### @@ -63,9 +68,18 @@ contains call ft8apset(mycall12,hiscall12,ncontest,apsym2,aph10) dd=iwave - ndecodes=0 - allmessages=' ' - allsnrs=0 + if(nzhsym.lt.50) then + ndecodes=0 + allmessages=' ' + allsnrs=0 + else + ndecodes=ndec_early + endif + if(nhsym.eq.50 .and. ndec_early.ge.1) then + do i=1,ndec_early + call subtractft8(dd,itone_save(1,i),f1_save(i),xdt_save(i)) + enddo + endif ifa=nfa ifb=nfb if(nagain) then @@ -104,10 +118,10 @@ contains xdt=candidate(2,icand) xbase=10.0**(0.1*(sbase(nint(f1/3.125))-40.0)) call timer('ft8b ',0) - call ft8b(dd,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & + call ft8b(dd,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lft8apon, & lapcqonly,napwid,lsubtract,nagain,ncontest,iaptype,mycall12, & hiscall12,sync,f1,xdt,xbase,apsym2,aph10,nharderrors,dmin, & - nbadcrc,iappass,iera,msg37,xsnr) + nbadcrc,iappass,iera,msg37,xsnr,itone) call timer('ft8b ',1) nsnr=nint(xsnr) xdt=xdt-0.5 @@ -121,6 +135,9 @@ contains ndecodes=ndecodes+1 allmessages(ndecodes)=msg37 allsnrs(ndecodes)=nsnr + f1_save(ndecodes)=f1 + xdt_save(ndecodes)=xdt + itone_save(1:NN,ndecodes)=itone endif ! write(81,1004) nutc,ncand,icand,ipass,iaptype,iappass, & ! nharderrors,dmin,hd,min(sync,999.0),nint(xsnr), & @@ -133,8 +150,11 @@ contains endif endif enddo - enddo + enddo + ndec_early=0 + if(nzhsym.lt.50) ndec_early=ndecodes + return - end subroutine decode +end subroutine decode end module ft8_decode diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index b9aa79e53..a90ab8992 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1411,7 +1411,7 @@ void MainWindow::dataSink(qint64 frames) m_dialFreqRxWSPR=m_freqNominal; } - if(m_ihsym == m_hsymStop) { + if(m_ihsym==m_hsymStop or (m_mode=="FT8" and m_ihsym==m_earlyDecode and !m_diskData)) { if(m_mode=="Echo") { float snr=0; int nfrit=0; @@ -1448,9 +1448,11 @@ void MainWindow::dataSink(qint64 frames) dec_data.params.newdat=1; dec_data.params.nagain=0; dec_data.params.nzhsym=m_hsymStop; + if(m_mode=="FT8" and m_ihsym==m_earlyDecode and !m_diskData) dec_data.params.nzhsym=m_earlyDecode; QDateTime now {QDateTime::currentDateTimeUtc ()}; m_dateTime = now.toString ("yyyy-MMM-dd hh:mm"); if(!m_mode.startsWith ("WSPR")) decode(); //Start decoder + if(m_mode=="FT8" and m_ihsym==m_earlyDecode and !m_diskData) return; if(!m_diskData) { //Always save; may delete later if(m_mode=="FT8" or m_mode=="FT4") { @@ -1458,8 +1460,6 @@ void MainWindow::dataSink(qint64 frames) if(n<(m_TRperiod/2)) n=n+m_TRperiod; auto const& period_start=now.addSecs(-n); m_fnameWE=m_config.save_directory().absoluteFilePath (period_start.toString("yyMMdd_hhmmss")); -// qDebug() << "datasink 2" << QDateTime::currentDateTimeUtc().toString("ss.zzz") -// << n << period_start.toString("ss.zzz"); } else { auto const& period_start = now.addSecs (-(now.time ().minute () % (int(m_TRperiod) / 60)) * 60); m_fnameWE=m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmm")); @@ -2843,6 +2843,8 @@ void MainWindow::decode() //decode() if(m_mode=="ISCAT" or m_mode=="MSK144" or m_bFast9 or m_mode=="FT8" or m_mode=="FT4") { qint64 ms=1000.0*(2.0-m_TRperiod); if(m_mode=="FT4") ms=1000.0*(2.0-m_TRperiod); + //Adjust for FT8 early decode: + if(m_mode=="FT8" and m_ihsym==m_earlyDecode and !m_diskData) ms+=(m_hsymStop-m_earlyDecode)*288; QDateTime t=QDateTime::currentDateTimeUtc().addMSecs(ms); ihr=t.toString("hh").toInt(); imin=t.toString("mm").toInt(); @@ -2983,6 +2985,7 @@ void MainWindow::decode() //decode() } else { memcpy(to, from, qMin(mem_jt9->size(), size)); QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove (); // Allow jt9 to start +// qDebug() << "aa" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.s") << m_ihsym; decodeBusy(true); } } @@ -3041,6 +3044,7 @@ void MainWindow::decodeDone () decodeBusy(false); m_RxLog=0; m_blankLine=true; + if(m_mode=="FT8" and dec_data.params.nzhsym==m_earlyDecode) m_blankLine=false; if(SpecOp::FOX == m_config.special_op_id()) houndCallers(); } @@ -3048,6 +3052,7 @@ void MainWindow::readFromStdout() //readFromStdout { while(proc_jt9.canReadLine()) { auto line_read = proc_jt9.readLine (); +// qDebug() << "cc" << line_read; if (auto p = std::strpbrk (line_read.constData (), "\n\r")) { // truncate before line ending chars diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 91575b079..dea12db1c 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -467,6 +467,7 @@ private: qint32 m_nFoxFreq; //Audio freq at which Hound received a call from Fox qint32 m_nSentFoxRrpt=0; //Serial number for next R+rpt Hound will send to Fox qint32 m_kin0=0; + qint32 m_earlyDecode=35; bool m_btxok; //True if OK to transmit bool m_diskData;