From 3b0b8b0652ddbcb45d25d5756c809431915e1932 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 25 Oct 2012 13:01:37 +0000 Subject: [PATCH] Implement signal reports in the range -31 to -50 dB. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2688 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/grid2n.f90 | 10 +++++ lib/n2grid.f90 | 15 +++++++ lib/packgrid.f | 47 ---------------------- lib/packgrid.f90 | 59 ++++++++++++++++++++++++++++ lib/{unpackgrid.f => unpackgrid.f90} | 8 ++++ mainwindow.cpp | 2 +- 6 files changed, 93 insertions(+), 48 deletions(-) create mode 100644 lib/grid2n.f90 create mode 100644 lib/n2grid.f90 delete mode 100644 lib/packgrid.f create mode 100644 lib/packgrid.f90 rename lib/{unpackgrid.f => unpackgrid.f90} (70%) diff --git a/lib/grid2n.f90 b/lib/grid2n.f90 new file mode 100644 index 000000000..d02d786de --- /dev/null +++ b/lib/grid2n.f90 @@ -0,0 +1,10 @@ +subroutine grid2n(grid,n) + character*4 grid + + i1=ichar(grid(1:1))-ichar('A') + i2=ichar(grid(3:3))-ichar('0') + i=10*i1 + i2 + n=-i - 31 + + return +end subroutine grid2n diff --git a/lib/n2grid.f90 b/lib/n2grid.f90 new file mode 100644 index 000000000..21bafe677 --- /dev/null +++ b/lib/n2grid.f90 @@ -0,0 +1,15 @@ +subroutine n2grid(n,grid) + character*4 grid + character*1 c1,c2 + + if(n.gt.-31 .or. n.lt.-70) stop 'Error in n2grid' + i=-(n+31) !NB: 0 <= i <= 39 + i1=i/10 + i2=mod(i,10) + grid(1:1)=char(ichar('A')+i1) + grid(2:2)='A' + grid(3:3)=char(ichar('0')+i2) + grid(4:4)='0' + + return +end subroutine n2grid diff --git a/lib/packgrid.f b/lib/packgrid.f deleted file mode 100644 index 8f1d00330..000000000 --- a/lib/packgrid.f +++ /dev/null @@ -1,47 +0,0 @@ - subroutine packgrid(grid,ng,text) - - parameter (NGBASE=180*180) - character*4 grid - logical text - - text=.false. - if(grid.eq.' ') go to 90 !Blank grid is OK - -C Test for numerical signal report, etc. - if(grid(1:1).eq.'-') then - read(grid(2:3),*,err=1,end=1) n - 1 ng=NGBASE+1+n - go to 100 - else if(grid(1:2).eq.'R-') then - read(grid(3:4),*,err=2,end=2) n - 2 if(n.eq.0) go to 90 - ng=NGBASE+31+n - go to 100 - else if(grid(1:2).eq.'RO') then - ng=NGBASE+62 - go to 100 - else if(grid(1:3).eq.'RRR') then - ng=NGBASE+63 - go to 100 - else if(grid(1:2).eq.'73') then - ng=NGBASE+64 - go to 100 - endif - - if(grid(1:1).lt.'A' .or. grid(1:1).gt.'R') text=.true. - if(grid(2:2).lt.'A' .or. grid(2:2).gt.'R') text=.true. - if(grid(3:3).lt.'0' .or. grid(3:3).gt.'9') text=.true. - if(grid(4:4).lt.'0' .or. grid(4:4).gt.'9') text=.true. - if(text) go to 100 - - call grid2deg(grid//'mm',dlong,dlat) - long=dlong - lat=dlat+ 90.0 - ng=((long+180)/2)*180 + lat - go to 100 - - 90 ng=NGBASE + 1 - - 100 return - end - diff --git a/lib/packgrid.f90 b/lib/packgrid.f90 new file mode 100644 index 000000000..ab4d43aa3 --- /dev/null +++ b/lib/packgrid.f90 @@ -0,0 +1,59 @@ +subroutine packgrid(grid,ng,text) + + parameter (NGBASE=180*180) + character*4 grid + logical text + + text=.false. + if(grid.eq.' ') go to 90 !Blank grid is OK + + if(grid(1:1).eq.'-') then !Test for numerical signal report + read(grid(2:3),*,err=1,end=1) n !NB: n is positive + if(n.lt.1) n=1 + if(n.gt.50) n=50 + if(n.gt.30) then + call n2grid(-n,grid) !Very low S/N use locators near -90 + go to 10 + endif +1 ng=NGBASE+1+n + go to 100 + else if(grid(1:2).eq.'R-') then + read(grid(3:4),*,err=2,end=2) n + if(n.lt.1) n=1 + if(n.gt.50) n=50 + if(n.gt.30) then + call n2grid(-n-20,grid) !Very low S/N use locators near -90 + go to 10 + endif + +2 if(n.eq.0) go to 90 + ng=NGBASE+31+n + go to 100 + else if(grid(1:2).eq.'RO') then + ng=NGBASE+62 + go to 100 + else if(grid(1:3).eq.'RRR') then + ng=NGBASE+63 + go to 100 + else if(grid(1:2).eq.'73') then + ng=NGBASE+64 + go to 100 + endif + + if(grid(1:1).lt.'A' .or. grid(1:1).gt.'R') text=.true. + if(grid(2:2).lt.'A' .or. grid(2:2).gt.'R') text=.true. + if(grid(3:3).lt.'0' .or. grid(3:3).gt.'9') text=.true. + if(grid(4:4).lt.'0' .or. grid(4:4).gt.'9') text=.true. + if(text) go to 100 + +10 call grid2deg(grid//'mm',dlong,dlat) + long=dlong + lat=dlat+ 90.0 + ng=((long+180)/2)*180 + lat + go to 100 + +90 ng=NGBASE + 1 + +100 return +end subroutine packgrid + diff --git a/lib/unpackgrid.f b/lib/unpackgrid.f90 similarity index 70% rename from lib/unpackgrid.f rename to lib/unpackgrid.f90 index bc4ea1eb2..3cbdca2e3 100644 --- a/lib/unpackgrid.f +++ b/lib/unpackgrid.f90 @@ -9,6 +9,14 @@ dlong=(ng/180)*2 - 180 + 2 call deg2grid(dlong,dlat,grid6) grid=grid6(:4) + if(grid(2:2).eq.'A' .and. grid(4:4).eq.'0') then + i=ichar(grid(1:1)) + if(i.ge.ichar('A') .and. i.le.ichar('D')) then + call grid2n(grid,n) + if(n.ge.-50) write(grid,1012) n + if(n.lt.-50) write(grid,1022) n+20 + endif + endif go to 100 10 n=ng-NGBASE-1 diff --git a/mainwindow.cpp b/mainwindow.cpp index 9df9c5fcc..2df3f15b7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//--------------------------------------------------------------- MainWindow +//---------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h"