From 297c1a0dcbf30c3e62916135fc893c50f26fc315 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 19 Jun 2020 10:16:04 -0400 Subject: [PATCH] Must reallocate some arrays when FST280 submode changes. --- lib/fst280/get_fst280_bitmetrics.f90 | 7 ++++--- lib/fst280_decode.f90 | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/fst280/get_fst280_bitmetrics.f90 b/lib/fst280/get_fst280_bitmetrics.f90 index b266fce82..50568210f 100644 --- a/lib/fst280/get_fst280_bitmetrics.f90 +++ b/lib/fst280/get_fst280_bitmetrics.f90 @@ -19,10 +19,11 @@ subroutine get_fst280_bitmetrics(cd,nss,hmod,bitmetrics,badsync) real s4(0:3,NN) data icos8/0,1,3,2,1,0,2,3/ data graymap/0,1,3,2/ - data first/.true./ - save first,one,cp + data first/.true./,nss0/-1/ + save first,one,cp,nss0 - if(first) then + if(nss.ne.nss0 .and. allocated(c1)) deallocate(c1) + if(first .or. nss.ne.nss0) then allocate(c1(nss,0:3)) one=.false. do i=0,65535 diff --git a/lib/fst280_decode.f90 b/lib/fst280_decode.f90 index 24d100589..e47e251e5 100644 --- a/lib/fst280_decode.f90 +++ b/lib/fst280_decode.f90 @@ -292,13 +292,12 @@ contains integer hmod,isyncword(0:7) real f0save data isyncword/0,1,3,2,1,0,2,3/ - data first/.true./ - data f0save/0.0/ - save first,twopi,dt,fac,f0save + data first/.true./,f0save/0.0/,nss0/-1/ + save first,twopi,dt,fac,f0save,nss0 + p(z1)=(real(z1*fac)**2 + aimag(z1*fac)**2)**0.5 !Compute power - p(z1)=(real(z1*fac)**2 + aimag(z1*fac)**2)**0.5 !Statement function for power - - if( first ) then + if(nss.ne.nss0 .and. allocated(csync)) deallocate(csync,csynct) + if(first .or. nss.ne.nss0) then allocate( csync(8*nss) ) allocate( csynct(8*nss) ) twopi=8.0*atan(1.0) @@ -314,6 +313,7 @@ contains enddo enddo first=.false. + nss0=nss fac=1.0/(8.0*nss) endif