summaryrefslogtreecommitdiff
path: root/map65/libm65/map65a.f90
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /map65/libm65/map65a.f90
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'map65/libm65/map65a.f90')
-rw-r--r--map65/libm65/map65a.f90105
1 files changed, 85 insertions, 20 deletions
diff --git a/map65/libm65/map65a.f90 b/map65/libm65/map65a.f90
index cece6ec9..90326477 100644
--- a/map65/libm65/map65a.f90
+++ b/map65/libm65/map65a.f90
@@ -23,6 +23,7 @@ contains
use stdout_channel_mod, only: write_stdout
use decodes_mod, only: nhsym1, ldecoded, ljt65decoded, ndecodes, mcall3a, decodes_init
use display_mod
+ use message_history_mod, only: append_message, has_message
use timf2_mod
use getdphi_mod
use datcom_ptrs_mod, only: ss_old, savg_old
@@ -86,6 +87,7 @@ contains
type(candidate) :: cand(MAX_CANDIDATES)
real(real64) :: f00
character(len=256) :: line
+ character(len=83) :: history_line
integer :: n_rms, i2
real*8 :: rms, sumsq, v
real*4 :: tsec_mod
@@ -99,6 +101,9 @@ contains
integer :: best_i, best_ipol2
real :: sync1_tmp, dt_tmp, flipk_tmp, syncshort_tmp, snr2_tmp, dt2_tmp
integer :: ipol_tmp, ipol2_tmp,ftol_bins, manualDecodeFlag_initial
+ integer :: i_click, il, iu, jsep, sh_j, sh_il, sh_iu, sh_ipol2
+ real :: sh_sync, sh_snr2, sh_dt2, u_snr2, u_dt2
+ integer :: u_ipol2
real :: freq_q65
integer :: nhsym_prev_call
integer(c_int64_t) :: previous_input_generation = -1
@@ -221,6 +226,7 @@ contains
i = nint(freq*1000.0/df) + icenter ! bin corresponding to that RF
i = max(51, min(nfft_active - 51, i))
+ i_click = i
! --- local search around clicked bin within ftol ---
ftol = real(ntol)
@@ -284,25 +290,59 @@ contains
!===========================
! SHORTHAND DETECTION (JT65)
!===========================
+ ! Same rule as the wideband quick decode (nqd=1).
shorthand_detected = .false.
-
thresh0 = 1.0
- if (syncshort > thresh0 .and. mode65 > 0) then
+ if (ntol .le. 100) thresh0 = 0.
+ sh_j = 0
+ if (mode65 > 0) then
+ sh_sync = thresh0
+ do j = 2, 4
+ jsep = nint(j*mode65*10.0*(11025.0/4096.0)/df)
+ do ii = -ftol_bins, ftol_bins
+ il = i_click + ii
+ iu = il + jsep
+ if (il < 51 .or. iu > nfft_active - 51) cycle
+ ssmax = 1.e30
+ call ccf65(ss_dec(:,:,iu), nhsym, ssmax, sync1_tmp, ipol_tmp, jpz, dt_tmp, flipk_tmp, &
+ syncshort_tmp, u_snr2, u_ipol2, u_dt2)
+ if (syncshort_tmp <= sh_sync) cycle
+ syncshort = syncshort_tmp
+ ssmax = 1.e30
+ call ccf65(ss_dec(:,:,il), nhsym, ssmax, sync1_tmp, ipol_tmp, jpz, dt_tmp, flipk_tmp, &
+ syncshort_tmp, snr2_tmp, ipol2_tmp, dt2_tmp)
+ if (syncshort_tmp <= thresh0) cycle
+ sh_sync = syncshort
+ sh_j = j
+ sh_il = il
+ sh_iu = iu
+ sh_snr2 = u_snr2
+ sh_ipol2 = u_ipol2
+ sh_dt2 = u_dt2
+ enddo
+ enddo
+ endif
+ call dbg('map65a manual: shorthand search thresh0=' // rtoa(thresh0) // ' found=' // itoa(sh_j) // &
+ ' syncshort=' // rtoa(merge(sh_sync, -99.0, sh_j > 0)))
+
+ if (sh_j > 0) then
shorthand_detected = .true.
km = 1
sig(1,1) = nfile
sig(1,2) = nutc
- sig(1,3) = freq
- sig(1,4) = syncshort
- sig(1,5) = dt2
- sig(1,6) = 45*(ipol2 - 1)/57.2957795
+ sig(1,3) = 0.001*(sh_il - icenter)*df + 0.5*(nfa + nfb)
+ sig(1,4) = sh_sync
+ sig(1,5) = sh_dt2
+ sig(1,6) = 45*(sh_ipol2 - 1)/57.2957795
sig(1,7) = 0
- sig(1,8) = snr2
+ sig(1,8) = sh_snr2
sig(1,9) = 0
sig(1,10)= 0
- sig(1,12)= savg_dec(ipol2,i)
- msg(1) = shmsg0(1)
+ sig(1,12)= savg_dec(sh_ipol2, sh_iu)
+ sig(1,13:16) = 0
+ sig(1,18) = 0
+ msg(1) = shmsg0(sh_j)
endif
! Bin frequency for this click (for decode1a’s f00)
@@ -313,11 +353,12 @@ contains
noffset = nint(1000.0*(freq - fqso) - mousedf)
- ! JT65-specific rejects only when JT65 is active
+ ! JT65-specific rejects only when JT65 is active. A detected
+ ! shorthand is still reported even though sync1 failed.
if (mode65 > 0) then
if (sync1 <= thresh1) then
- if (.not. bq65) then
+ if (.not. bq65 .and. .not. shorthand_detected) then
! JT65-only mode → real reject
newdat = 0
km = 0
@@ -336,7 +377,7 @@ contains
if (abs(noffset) > ntol) then
- if (.not. bq65) then
+ if (.not. bq65 .and. .not. shorthand_detected) then
! JT65-only mode → real reject
newdat = 0
@@ -463,9 +504,9 @@ contains
q65_success = (nsnr0 .gt. -99)
! On success, q65b has already written the decoded text itself
- ! (write_stdout, plus units 26/21/12) because nqd=1 and the result
- ! is within ntol of mousedf -- the same mechanism the wideband
- ! quick-decode pass uses. Nothing further to add to km/msg/sig here.
+ ! (write_stdout, plus the history and units 21/12) because nqd=1
+ ! and the result is within ntol of mousedf. The wideband quick
+ ! decode uses the same path. Nothing further to add to km/msg/sig.
endif
!===========================
@@ -522,9 +563,35 @@ contains
write (line, '("!",I3,I5,I4,I6.4,F5.1,I5,1X,A1,1X,A22,I2,I5,I5,1X,A1)') &
nkHz, ndf, npol, nutc, dt, nsync2, cm, decoded, nkv, nqual, ntxpol, cp
call write_stdout(trim(line)//new_line('a'))
+
+ ! Keep manual decodes out of both histories when the wideband
+ ! pass or an earlier click already recorded the same decode.
+ if (.not. has_message(f0, nutc, decoded)) then
+ do j = 1, 5
+ a(j) = sig(k, 12 + j)
+ enddo
+ ndf0 = nint(a(1))
+ ndf1 = nint(a(2))
+ ndf2 = nint(a(3))
+ cmode = '#A'
+ if (mode65 .eq. 2) cmode = '#B'
+ if (mode65 .eq. 4) cmode = '#C'
+ write (history_line, 1014) f0, ndf, ndf0, ndf1, ndf2, dt, npol, nsync1, &
+ nsync2, nutc, decoded, '#', cp, cmode
+ call append_message(history_line, nutc, f0, ndf)
+ ndecodes = ndecodes + 1
+ write (21, 1100) f0, ndf, dt, npol, nsync2, nutc, decoded, '#', cp, &
+ cmode(1:1), cmode(2:2)
+ endif
endif
enddo ! k=1,km
+ ! Refresh Messages and Band Map after the manual pass.
+ ! 0.010 is the wideband pass's ftol (kHz); the ftol above is
+ ! the click tolerance in Hz.
+ flush (21)
+ call display(nkeep, 0.010, nutc)
+
manualDecodeFlag = 0
return
endif
@@ -1141,9 +1208,10 @@ endif
cmode = '#A'
if (mode65 .eq. 2) cmode = '#B'
if (mode65 .eq. 4) cmode = '#C'
- write (26, 1014) f0, ndf, ndf0, ndf1, ndf2, dt, npol, nsync1, &
+ write (history_line, 1014) f0, ndf, ndf0, ndf1, ndf2, dt, npol, nsync1, &
nsync2, nutc, decoded, '#', cp, cmode ! was decoded,cp,
1014 format(f8.3, i5, 3i3, f5.1, i4, i3, i4, i5.4, 4x, a22, 7x, 2a1, 2x, a2) ! was a22,2x,a1,3x,a2
+ call append_message(history_line, nutc, f0, ndf)
ndecodes = ndecodes + 1
write (21, 1100) f0, ndf, dt, npol, nsync2, nutc, decoded, '#', cp, &
cmode(1:1), cmode(2:2)! was decoded,cp,
@@ -1151,11 +1219,8 @@ endif
endif
enddo
- write (26, 1015) nutc
-1015 format(37x, i6.4, ' ')
flush (21)
- flush (26)
- call display(nkeep, ftol)
+ call display(nkeep, ftol, nutc)
ndecdone = 2
900 close (23)