summaryrefslogtreecommitdiff
path: root/lib/q65_decode.f90
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
committerhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
commitc25cbdf6fb6d946175f4335fab77bfea601b56db (patch)
tree6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /lib/q65_decode.f90
parent71f5689252c9f13e70e1c24856904475b2307809 (diff)
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'lib/q65_decode.f90')
-rw-r--r--lib/q65_decode.f9032
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90
index 5c9b0237..e06d9972 100644
--- a/lib/q65_decode.f90
+++ b/lib/q65_decode.f90
@@ -1,10 +1,13 @@
module q65_decode
+ use q65_workspace, only: q65_workspace_type
+
integer nsnr0,nfreq0
real xdt0
character msg0*37,cq0*3
type :: q65_decoder
+ type(q65_workspace_type) :: workspace
procedure(q65_decode_callback), pointer :: callback
contains
procedure :: decode
@@ -12,7 +15,7 @@ module q65_decode
abstract interface
subroutine q65_decode_callback (this,nutc,snr1,nsnr,dt,freq, &
- decoded,idec,nused,ntrperiod)
+ decoded,idec,nused,ntrperiod,iflagdec)
import q65_decoder
implicit none
class(q65_decoder), intent(inout) :: this
@@ -25,6 +28,7 @@ module q65_decode
integer, intent(in) :: idec
integer, intent(in) :: nused
integer, intent(in) :: ntrperiod
+ integer, intent(in) :: iflagdec !Recovered spare 78th bit (see genq65/q65_ap)
end subroutine q65_decode_callback
end interface
@@ -33,7 +37,7 @@ contains
subroutine decode(this,callback,iwave,nqd0,nutc,ntrperiod,nsubmode,nfqso, &
ntol,ndepth,nfa0,nfb0,lclearave,single_decode,lagain,max_drift0, &
lnewdat0,emedelay,mycall,hiscall,hisgrid,nQSOprogress,ncontest, &
- lapcqonly,navg0,nqf)
+ lq65pileup,lapcqonly,navg0,nqf)
! Top-level routine that organizes the decoding of Q65 signals
! Input: iwave Raw data, i*2
@@ -47,6 +51,7 @@ contains
! emedelay Sync search extended to cover EME delays
! nQSOprogress Auto-sequencing state for the present QSO
! ncontest Supported contest type
+! lq65pileup Q65 Pileup AP flag policy
! lapcqonly Flag to use AP only for CQ calls
! Output: sent to the callback routine for display to user
@@ -58,7 +63,7 @@ contains
use types
parameter (NMAX=300*12000) !Max TRperiod is 300 s
- parameter (MAX_CALLERS=40) !For multiple q3 decodes in NA VHf Contest mode
+ parameter (MAX_CALLERS=50) !For multiple q3 decodes in NA VHF Contest mode
class(q65_decoder), intent(inout) :: this
@@ -81,7 +86,8 @@ contains
integer nqf(20)
integer stageno !Added by W3SZ
integer time
- logical lclearave,lnewdat0,lapcqonly,unpk77_success
+ integer iflagdec !Recovered spare 78th bit
+ logical lclearave,lnewdat0,lq65pileup,lapcqonly,unpk77_success
logical single_decode,lagain
complex c00(0:3600000) !Analytic signal, 6000 Sa/s
type(q3list) callers(MAX_CALLERS)
@@ -233,7 +239,7 @@ contains
apsymbols=0
if(ipass.ge.1) then
! Subsequent passes use AP information appropiate for nQSOprogress
- call q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, &
+ call q65_ap(nQSOprogress,ipass,ncontest,lq65pileup,lapcqonly,iaptype, &
apsym0,apmask1,apsymbols1)
write(c78,1050) apmask1
1050 format(78i1)
@@ -244,7 +250,7 @@ contains
endif
call timer('q65loop1',0)
- call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, &
+ call q65_loops(this%workspace,c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, &
xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec)
call timer('q65loop1',1)
if(idec.ge.0) then
@@ -312,6 +318,7 @@ contains
! 3: Decode with AP for "MyCall DxCall ?"
! Unpack decoded message for display to user
+ iflagdec=iand(dat4(13),1) !Recover the spare 78th bit before it's shifted away
write(c77,1000) dat4(1:12),dat4(13)/2
1000 format(12b6.6,b5.5)
call unpack77(c77,1,decoded,unpk77_success) !Unpack to get decoded
@@ -319,7 +326,7 @@ contains
do i=1,ndecodes
if(decodes(i).eq.decoded) idupe=1
enddo
- if(idupe.eq.0) then
+ if(idupe.eq.0 .and. unpk77_success) then
ndecodes=min(ndecodes+1,100)
decodes(ndecodes)=decoded
f0decodes(ndecodes)=f0dec
@@ -327,7 +334,7 @@ contains
call q65_snr(dat4,dtdec,f0dec,mode_q65,snr2)
nsnr=nint(snr2)
call this%callback(nutc,snr1,nsnr,dtdec,f0dec,decoded, &
- idec,nused,ntrperiod)
+ idec,nused,ntrperiod,iflagdec)
if(ncontest.eq.1) then
call q65_hist2(nint(f0dec),decoded,callers,nhist2)
else
@@ -403,7 +410,7 @@ contains
apsymbols=0
if(ipass.ge.1) then
! Subsequent passes use AP information appropiate for nQSOprogress
- call q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, &
+ call q65_ap(nQSOprogress,ipass,ncontest,lq65pileup,lapcqonly,iaptype, &
apsym0,apmask1,apsymbols1)
write(c78,1050) apmask1
read(c78,1060) apmask
@@ -412,7 +419,7 @@ contains
endif
call timer('q65loop2',0)
- call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, &
+ call q65_loops(this%workspace,c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, &
xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec)
call timer('q65loop2',1)
! write(*,3001) '=e',nfqso,ntol,ndepth,xdt,f0,idec
@@ -426,20 +433,21 @@ contains
200 decoded=' '
if(idec.ge.0) then
! Unpack decoded message for display to user
+ iflagdec=iand(dat4(13),1) !Recover the spare 78th bit before it's shifted away
write(c77,1000) dat4(1:12),dat4(13)/2
call unpack77(c77,1,decoded,unpk77_success) !Unpack to get decoded
idupe=0
do i=1,ndecodes
if(decodes(i).eq.decoded) idupe=1
enddo
- if(idupe.eq.0) then
+ if(idupe.eq.0 .and. unpk77_success) then
ndecodes=min(ndecodes+1,100)
decodes(ndecodes)=decoded
f0decodes(ndecodes)=f0dec
call q65_snr(dat4,dtdec,f0dec,mode_q65,snr2)
nsnr=nint(snr2)
call this%callback(nutc,snr1,nsnr,dtdec,f0dec,decoded, &
- idec,nused,ntrperiod)
+ idec,nused,ntrperiod,iflagdec)
if(ncontest.eq.1) then
call q65_hist2(nint(f0dec),decoded,callers,nhist2)
else