Merged master 8748
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
// Status=review
|
||||
|
||||
image::settings-audio.png[align="center",alt="WSJT-X Audio Configuration Screen"]
|
||||
|
||||
Select the *Audio* tab to configure your sound system.
|
||||
|
||||
- _Soundcard_: Select the audio devices to be used for *Input* and
|
||||
*Output*. Usually the *Mono* settings will suffice, but in special
|
||||
cases you can choose *Left*, *Right*, or *Both* stereo channels.
|
||||
|
||||
- Be sure that your audio device is configured to sample at 48000 Hz,
|
||||
16 bits.
|
||||
|
||||
|
||||
IMPORTANT: If you select the audio output device that is also your
|
||||
computer's default audio device, be sure to turn off all system sounds
|
||||
to prevent inadvertently transmitting them over the air.
|
||||
|
||||
NOTE: Windows Vista and later may configure audio devices using
|
||||
the Texas Instruments PCM2900 series CODEC for microphone input rather
|
||||
line input. (This chip is used in many radios with built-in USB
|
||||
CODECs, as well as various other audio interfaces.) If you are using
|
||||
such a device, be sure to set the mic level in the Recording Device
|
||||
Properties to 0 dB.
|
||||
|
||||
- _Save Directory_: _WSJT-X_ can save its received audio sequences as
|
||||
`.wav` files. A default directory for these files is provided; you
|
||||
can select another location if desired.
|
||||
|
||||
- _AzEl Directory_: A file named `azel.dat` will appear in the
|
||||
specified directory. The file contains information usable by another
|
||||
program for automatic tracking of the Sun or Moon, as well as
|
||||
calculated Doppler shift for the specified EME path. The file is
|
||||
updated once per second whenever the <<ASTRODATA,Astronomical Data>>
|
||||
window is displayed.
|
||||
|
||||
- _Remember power settings by band_: Checking either of these will
|
||||
cause _WSJT-X_ to remember the *Pwr* slider setting for that operation
|
||||
on a band-by-band basis. For example, when *Tune* is checked here and
|
||||
you click the *Tune* on the main window, the power slider will change
|
||||
to the most recent setting used for *Tune* on the band in use.
|
||||
@@ -0,0 +1,197 @@
|
||||
program wspr_fsk8d
|
||||
|
||||
! WSPR-LF is a potential WSPR-like mode intended for use at LF and MF.
|
||||
! This version uses 4-minute T/R sequences, an LDPC (300,60) code,
|
||||
! 8-FSK modulation, and noncoherent demodulation. This decoder reads
|
||||
! data from *.wav files.
|
||||
|
||||
! Reception and Demodulation algorithm:
|
||||
! 1. Compute coarse spectrum; find fc1 = approx carrier freq
|
||||
! 2. Mix from fc1 to 0; LPF at +/- 0.75*R
|
||||
! 3. Find two 7x7 Costas arrays to get xdt and fc2
|
||||
! 4. Mix from fc2 to 0, compute aligned symbol spectra
|
||||
! 5. Get soft bits from symbol spectra
|
||||
|
||||
! Still to do: find and decode more than one signal in the specified passband.
|
||||
|
||||
include 'wspr_fsk8_params.f90'
|
||||
character arg*8,message*22,cbits*50,infile*80,fname*16,datetime*11
|
||||
character*120 data_dir
|
||||
complex csync(0:N7-1) !Sync symbols for Costas 7x7 array
|
||||
complex c1(0:2*N7-1)
|
||||
complex c2(0:2*N7-1)
|
||||
complex c(0:NMAXD-1) !Complex waveform
|
||||
real*8 fMHz
|
||||
real rxdata(3*ND),llr(3*ND) !Soft symbols
|
||||
real a(5) !For twkfreq1
|
||||
real s(0:NH2,NN)
|
||||
real savg(0:NH2)
|
||||
real ss(0:N7)
|
||||
real ss0(0:N7)
|
||||
real ps(0:7)
|
||||
integer ihdr(11)
|
||||
integer*2 iwave(NMAX) !Generated full-length waveform
|
||||
integer*1 idat(7)
|
||||
integer*1 decoded(KK),apmask(3*ND),cw(3*ND)
|
||||
integer icos7(0:6)
|
||||
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.lt.7) then
|
||||
print*,'Usage: wspr_fsk8d -d db -f fMHz -a data_dir file1 [file2 ...]'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,arg)
|
||||
if(arg(1:3).ne.'-d ') go to 999
|
||||
call getarg(2,arg)
|
||||
read(arg,*) degrade
|
||||
rxbw=3000.
|
||||
|
||||
call getarg(3,arg)
|
||||
if(arg(1:3).ne.'-f ') go to 999
|
||||
call getarg(4,arg)
|
||||
read(arg,*) fMHz
|
||||
|
||||
call getarg(5,arg)
|
||||
if(arg(1:3).ne.'-a ') go to 999
|
||||
call getarg(6,data_dir)
|
||||
|
||||
open(13,file=trim(data_dir)//'/ALL_WSPR.TXT',status='unknown', &
|
||||
position='append')
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
fs=NSPS*12000.0/NSPS0 !Sample rate after downsampling (Hz)
|
||||
dt=1.0/fs !Sample interval (s)
|
||||
ts=NSPS*dt !Symbol duration (s)
|
||||
baud=1.0/ts !Keying rate (Hz)
|
||||
txt=NZ*dt !Transmission length (s)
|
||||
|
||||
phi=0.
|
||||
k=-1
|
||||
do j=0,6
|
||||
dphi=twopi*baud*icos7(j)*dt
|
||||
do i=1,NSPS
|
||||
phi=phi+dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
k=k+1
|
||||
csync(k)=cmplx(cos(phi),sin(phi))
|
||||
enddo
|
||||
enddo
|
||||
|
||||
do ifile=7,nargs
|
||||
call getarg(ifile,infile)
|
||||
open(10,file=infile,status='old',access='stream')
|
||||
j1=index(infile,'.c4')
|
||||
j2=index(infile,'.wav')
|
||||
if(j1.gt.0) then
|
||||
read(10,end=999) fname,ntrmin,fMHz,c(0:NZ-1)
|
||||
read(fname(8:11),*) nutc
|
||||
write(datetime,'(i11)') nutc
|
||||
else if(j2.gt.0) then
|
||||
read(10,end=999) ihdr,iwave
|
||||
read(infile(j2-4:j2-1),*) nutc
|
||||
datetime=infile(j2-11:j2-1)
|
||||
if(degrade.gt.0.0) call degrade_snr(iwave,NMAX,degrade,rxbw)
|
||||
call wspr_fsk8_downsample(iwave,c)
|
||||
else
|
||||
print*,'Wrong file format?'
|
||||
go to 999
|
||||
endif
|
||||
close(10)
|
||||
pmax=0.
|
||||
df1=fs/(2*N7)
|
||||
ia=nint(100.0/df1)
|
||||
ib=nint(150.0/df1)
|
||||
ipk=0
|
||||
jpk=0
|
||||
! Get xdt and f0 from the sync arrays
|
||||
do j0=0,1000,50
|
||||
j0b=j0+107*NSPS
|
||||
c1(0:N7-1)=c(j0:j0+N7-1)*conjg(csync)
|
||||
c1(N7:)=0.
|
||||
c2(0:N7-1)=c(j0b:j0b+N7-1)*conjg(csync)
|
||||
c2(N7:)=0.
|
||||
call four2a(c1,2*N7,1,-1,1)
|
||||
call four2a(c2,2*N7,1,-1,1)
|
||||
do i=0,N7
|
||||
p=1.e-9*(real(c1(i))**2 + aimag(c1(i))**2 + &
|
||||
real(c2(i))**2 + aimag(c2(i))**2)
|
||||
ss(i)=p
|
||||
enddo
|
||||
do i=ia,ib
|
||||
p=ss(i)
|
||||
if(p.gt.pmax) then
|
||||
pmax=p
|
||||
ipk=i
|
||||
jpk=j0
|
||||
endif
|
||||
enddo
|
||||
if(jpk.eq.j0) ss0=ss
|
||||
enddo
|
||||
f0=ipk*df1
|
||||
xdt=jpk*dt - 1.0
|
||||
|
||||
sp3n=(ss0(ipk-1)+ss0(ipk)+ss0(ipk+1)) !Sig + 3*noise
|
||||
call pctile(ss0,N7,45,base)
|
||||
psig=sp3n-3*base !Sig only
|
||||
pnoise=(2500.0/df1)*base !Noise in 2500 Hz
|
||||
xsnr=db(psig/pnoise) !SNR from sync tones
|
||||
|
||||
if(jpk.ge.0) c(0:NMAXD-1-jpk)=c(jpk:NMAXD-1)
|
||||
|
||||
a(1)=-f0
|
||||
a(2:5)=0.
|
||||
call twkfreq1(c,NZ,fs,a,c) !Mix from f0 down to 0
|
||||
call spec8(c,s,savg) !Get symbol spectra
|
||||
|
||||
do j=1,ND
|
||||
k=j+7
|
||||
ps=s(0:7,k)
|
||||
ps=sqrt(ps) !### ??? ###
|
||||
! ps=log(ps)
|
||||
r1=max(ps(1),ps(3),ps(5),ps(7))-max(ps(0),ps(2),ps(4),ps(6))
|
||||
r2=max(ps(2),ps(3),ps(6),ps(7))-max(ps(0),ps(1),ps(4),ps(5))
|
||||
r4=max(ps(4),ps(5),ps(6),ps(7))-max(ps(0),ps(1),ps(2),ps(3))
|
||||
rxdata(3*j-2)=r4
|
||||
rxdata(3*j-1)=r2
|
||||
rxdata(3*j)=r1
|
||||
enddo
|
||||
|
||||
rxav=sum(rxdata)/ND
|
||||
rx2av=sum(rxdata*rxdata)/ND
|
||||
rxsig=sqrt(rx2av-rxav*rxav)
|
||||
rxdata=rxdata/rxsig
|
||||
s0=1.1
|
||||
llr=2.0*rxdata/(s0*s0)
|
||||
apmask=0
|
||||
max_iterations=40
|
||||
ifer=0
|
||||
call bpdecode300(llr,apmask,max_iterations,decoded,niterations,cw)
|
||||
if(niterations.lt.0) call osd300(llr,apmask,5,decoded,cw,nhardmin,dmin)
|
||||
if(nhardmin.ge.0) niterations=nhardmin
|
||||
nbadcrc=0
|
||||
if(niterations.ge.0) call chkcrc10(decoded,nbadcrc)
|
||||
if(niterations.lt.0 .or. nbadcrc.ne.0) ifer=1
|
||||
nsnr=nint(xsnr)
|
||||
! freq=fMHz + 1.d-6*f0
|
||||
freq=1.d-6*(f0+1500)
|
||||
nfdot=0
|
||||
message=' '
|
||||
if(ifer.eq.0) then
|
||||
write(cbits,1100) decoded(1:50)
|
||||
1100 format(50i1)
|
||||
read(cbits,1102) idat
|
||||
1102 format(6b8,b2)
|
||||
idat(7)=ishft(idat(7),6)
|
||||
call wqdecode(idat,message,itype)
|
||||
write(*,1112) datetime(8:11),nsnr,xdt,freq,nfdot,message
|
||||
1112 format(a4,i4,f5.1,f11.6,i3,2x,a22)
|
||||
endif
|
||||
write(13,1110) datetime,0,nsnr,xdt,freq,message,nfdot
|
||||
1110 format(a11,2i4,f6.2,f12.7,2x,a22,i3)
|
||||
enddo ! ifile loop
|
||||
write(*,1120)
|
||||
1120 format("<DecodeFinished>")
|
||||
|
||||
999 end program wspr_fsk8d
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
# MAKEFILE FOR LDPC PROGRAMS & ASSOCIATED UTILITIES.
|
||||
|
||||
# Copyright (c) 1995-2012 by Radford M. Neal.
|
||||
#
|
||||
# Permission is granted for anyone to copy, use, modify, and distribute
|
||||
# these programs and accompanying documents for any purpose, provided
|
||||
# this copyright notice is retained and prominently displayed, and note
|
||||
# is made of any changes made to these programs. These programs and
|
||||
# documents are distributed without any warranty, express or implied.
|
||||
# As the programs were written for research purposes only, they have not
|
||||
# been tested to the degree that would be advisable in any important
|
||||
# application. All use of these programs is entirely at the user's own
|
||||
# risk.
|
||||
|
||||
|
||||
# NOTE: The natural random numbers in "randfile" are accessed by the
|
||||
# 'rand' module via a path to this directory. Change the definition of
|
||||
# RAND_FILE in the compilation command for rand.c below if this is not
|
||||
# appropriate.
|
||||
|
||||
# NOTE: This makefile is trivial, simply recompiling everything from
|
||||
# scratch every time. Since this takes only about 5 seconds on a modern
|
||||
# PC, there's no point in putting in dependency-based rules, which just
|
||||
# make things more complex and error-prone.
|
||||
|
||||
|
||||
COMPILE = cc -c -O # Command to compile a module from .c to .o
|
||||
LINK = cc # Command to link a program
|
||||
|
||||
|
||||
# MAKE ALL THE MAIN PROGRAMS. First makes the modules used.
|
||||
|
||||
progs: modules
|
||||
$(COMPILE) make-pchk.c
|
||||
$(LINK) make-pchk.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o alloc.o intio.o open.o -lm -o make-pchk
|
||||
$(COMPILE) alist-to-pchk.c
|
||||
$(LINK) alist-to-pchk.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o alloc.o intio.o open.o -lm -o alist-to-pchk
|
||||
$(COMPILE) pchk-to-alist.c
|
||||
$(LINK) pchk-to-alist.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o alloc.o intio.o open.o -lm -o pchk-to-alist
|
||||
$(COMPILE) make-ldpc.c
|
||||
$(LINK) make-ldpc.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o rand.o alloc.o intio.o open.o distrib.o -lm -o make-ldpc
|
||||
$(COMPILE) print-pchk.c
|
||||
$(LINK) print-pchk.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o rand.o alloc.o intio.o open.o -lm -o print-pchk
|
||||
$(COMPILE) make-gen.c
|
||||
$(LINK) make-gen.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o alloc.o intio.o open.o -lm -o make-gen
|
||||
$(COMPILE) print-gen.c
|
||||
$(LINK) print-gen.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o rand.o alloc.o intio.o open.o -lm -o print-gen
|
||||
$(COMPILE) rand-src.c
|
||||
$(LINK) rand-src.o rand.o open.o -lm -o rand-src
|
||||
$(COMPILE) encode.c
|
||||
$(LINK) encode.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
enc.o rcode.o rand.o alloc.o intio.o blockio.o open.o -lm -o encode
|
||||
$(COMPILE) transmit.c
|
||||
$(LINK) transmit.o channel.o rand.o open.o -lm -o transmit
|
||||
$(COMPILE) decode.c
|
||||
$(LINK) decode.o channel.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
enc.o check.o \
|
||||
rcode.o rand.o alloc.o intio.o blockio.o dec.o open.o -lm -o decode
|
||||
$(COMPILE) extract.c
|
||||
$(LINK) extract.o mod2sparse.o mod2dense.o mod2convert.o \
|
||||
rcode.o alloc.o intio.o blockio.o open.o -lm -o extract
|
||||
$(COMPILE) verify.c
|
||||
$(LINK) verify.o mod2sparse.o mod2dense.o mod2convert.o check.o \
|
||||
rcode.o alloc.o intio.o blockio.o open.o -lm -o verify
|
||||
|
||||
# MAKE THE TEST PROGRAMS. First makes the modules used.
|
||||
|
||||
tests: modules
|
||||
$(COMPILE) mod2dense-test.c
|
||||
$(LINK) mod2dense-test.o mod2dense.o alloc.o intio.o \
|
||||
-lm -o mod2dense-test
|
||||
$(COMPILE) mod2sparse-test.c
|
||||
$(LINK) mod2sparse-test.o mod2sparse.o alloc.o intio.o \
|
||||
-lm -o mod2sparse-test
|
||||
$(COMPILE) mod2convert-test.c
|
||||
$(LINK) mod2convert-test.o mod2convert.o mod2dense.o mod2sparse.o \
|
||||
alloc.o intio.o rand.o open.o -lm -o mod2convert-test
|
||||
$(COMPILE) rand-test.c
|
||||
$(LINK) rand-test.o rand.o -lm -o rand-test
|
||||
|
||||
|
||||
# MAKE THE MODULES USED BY THE PROGRAMS.
|
||||
|
||||
modules:
|
||||
$(COMPILE) rcode.c
|
||||
$(COMPILE) channel.c
|
||||
$(COMPILE) dec.c
|
||||
$(COMPILE) enc.c
|
||||
$(COMPILE) alloc.c
|
||||
$(COMPILE) intio.c
|
||||
$(COMPILE) blockio.c
|
||||
$(COMPILE) check.c
|
||||
$(COMPILE) open.c
|
||||
$(COMPILE) mod2dense.c
|
||||
$(COMPILE) mod2sparse.c
|
||||
$(COMPILE) mod2convert.c
|
||||
$(COMPILE) distrib.c
|
||||
$(COMPILE) -DRAND_FILE=\"`pwd`/randfile\" rand.c
|
||||
|
||||
|
||||
# CLEAN UP ALL PROGRAMS AND REMOVE ALL FILES PRODUCED BY TESTS AND EXAMPLES.
|
||||
|
||||
clean:
|
||||
rm -f core *.o *.exe ex-*.* test-file \
|
||||
make-pchk alist-to-pchk pchk-to-alist \
|
||||
make-ldpc print-pchk make-gen print-gen \
|
||||
rand-src encode transmit decode extract verify \
|
||||
mod2dense-test mod2sparse-test mod2convert-test rand-test
|
||||
@@ -1,508 +0,0 @@
|
||||
#include "widegraph.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include "ui_widegraph.h"
|
||||
#include "commons.h"
|
||||
#include "Configuration.hpp"
|
||||
#include "MessageBox.hpp"
|
||||
#include "SettingsGroup.hpp"
|
||||
#include "moc_widegraph.cpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
auto user_defined = QObject::tr ("User Defined");
|
||||
float swide[MAX_SCREENSIZE];
|
||||
}
|
||||
|
||||
WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::WideGraph),
|
||||
m_settings (settings),
|
||||
m_palettes_path {":/Palettes"},
|
||||
m_ntr0 {0},
|
||||
m_bHaveTransmitted {false},
|
||||
m_n {0}
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowTitle (QApplication::applicationName () + " - " + tr ("Wide Graph"));
|
||||
setWindowFlags (Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
|
||||
setMaximumWidth (MAX_SCREENSIZE);
|
||||
setMaximumHeight (880);
|
||||
|
||||
ui->widePlot->setCursor(Qt::CrossCursor);
|
||||
ui->widePlot->setMaximumHeight(800);
|
||||
ui->widePlot->setCurrent(false);
|
||||
|
||||
connect(ui->widePlot, SIGNAL(freezeDecode1(int)),this,
|
||||
SLOT(wideFreezeDecode(int)));
|
||||
|
||||
connect(ui->widePlot, SIGNAL(setFreq1(int,int)),this,
|
||||
SLOT(setFreq2(int,int)));
|
||||
|
||||
{
|
||||
//Restore user's settings
|
||||
SettingsGroup g {m_settings, "WideGraph"};
|
||||
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
|
||||
ui->widePlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
|
||||
ui->widePlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
|
||||
ui->widePlot->setPlot2dGain(m_settings->value("Plot2dGain", 0).toInt());
|
||||
ui->widePlot->setPlot2dZero(m_settings->value("Plot2dZero", 0).toInt());
|
||||
ui->zeroSlider->setValue(ui->widePlot->plotZero());
|
||||
ui->gainSlider->setValue(ui->widePlot->plotGain());
|
||||
ui->gain2dSlider->setValue(ui->widePlot->plot2dGain());
|
||||
ui->zero2dSlider->setValue(ui->widePlot->plot2dZero());
|
||||
int n = m_settings->value("BinsPerPixel",2).toInt();
|
||||
m_bFlatten=m_settings->value("Flatten",true).toBool();
|
||||
m_bRef=m_settings->value("UseRef",false).toBool();
|
||||
ui->cbFlatten->setChecked(m_bFlatten);
|
||||
ui->widePlot->setFlatten(m_bFlatten,m_bRef);
|
||||
ui->cbRef->setChecked(m_bRef);
|
||||
ui->widePlot->setBreadth(m_settings->value("PlotWidth",1000).toInt());
|
||||
ui->bppSpinBox->setValue(n);
|
||||
m_nsmo=m_settings->value("SmoothYellow",1).toInt();
|
||||
ui->smoSpinBox->setValue(m_nsmo);
|
||||
m_Percent2DScreen=m_settings->value("Percent2D",30).toInt();
|
||||
m_waterfallAvg = m_settings->value("WaterfallAvg",5).toInt();
|
||||
ui->waterfallAvgSpinBox->setValue(m_waterfallAvg);
|
||||
ui->widePlot->setWaterfallAvg(m_waterfallAvg);
|
||||
ui->widePlot->setCurrent(m_settings->value("Current",false).toBool());
|
||||
ui->widePlot->setCumulative(m_settings->value("Cumulative",true).toBool());
|
||||
ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool());
|
||||
ui->widePlot->setReference(m_settings->value("Reference",false).toBool());
|
||||
if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0);
|
||||
if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1);
|
||||
if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2);
|
||||
if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3);
|
||||
int nbpp=m_settings->value("BinsPerPixel",2).toInt();
|
||||
ui->widePlot->setBinsPerPixel(nbpp);
|
||||
ui->sbPercent2dPlot->setValue(m_Percent2DScreen);
|
||||
ui->widePlot->setStartFreq(m_settings->value("StartFreq",0).toInt());
|
||||
ui->fStartSpinBox->setValue(ui->widePlot->startFreq());
|
||||
m_waterfallPalette=m_settings->value("WaterfallPalette","Default").toString();
|
||||
m_userPalette = WFPalette {m_settings->value("UserPalette").value<WFPalette::Colours> ()};
|
||||
m_fMinPerBand = m_settings->value ("FminPerBand").toHash ();
|
||||
setRxRange ();
|
||||
ui->controls_widget->setVisible(!m_settings->value("HideControls",false).toBool());
|
||||
ui->cbControls->setChecked(!m_settings->value("HideControls",false).toBool());
|
||||
}
|
||||
|
||||
int index=0;
|
||||
for (QString const& file:
|
||||
m_palettes_path.entryList(QDir::NoDotAndDotDot |
|
||||
QDir::System | QDir::Hidden |
|
||||
QDir::AllDirs | QDir::Files,
|
||||
QDir::DirsFirst)) {
|
||||
QString t=file.mid(0,file.length()-4);
|
||||
ui->paletteComboBox->addItem(t);
|
||||
if(t==m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
|
||||
index++;
|
||||
}
|
||||
ui->paletteComboBox->addItem (user_defined);
|
||||
if (user_defined == m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
|
||||
readPalette ();
|
||||
}
|
||||
|
||||
WideGraph::~WideGraph ()
|
||||
{
|
||||
}
|
||||
|
||||
void WideGraph::closeEvent (QCloseEvent * e)
|
||||
{
|
||||
saveSettings ();
|
||||
QDialog::closeEvent (e);
|
||||
}
|
||||
|
||||
void WideGraph::saveSettings() //saveSettings
|
||||
{
|
||||
SettingsGroup g {m_settings, "WideGraph"};
|
||||
m_settings->setValue ("geometry", saveGeometry ());
|
||||
m_settings->setValue ("PlotZero", ui->widePlot->plotZero());
|
||||
m_settings->setValue ("PlotGain", ui->widePlot->plotGain());
|
||||
m_settings->setValue ("Plot2dGain", ui->widePlot->plot2dGain());
|
||||
m_settings->setValue ("Plot2dZero", ui->widePlot->plot2dZero());
|
||||
m_settings->setValue ("PlotWidth", ui->widePlot->plotWidth ());
|
||||
m_settings->setValue ("BinsPerPixel", ui->bppSpinBox->value ());
|
||||
m_settings->setValue ("SmoothYellow", ui->smoSpinBox->value ());
|
||||
m_settings->setValue ("Percent2D",m_Percent2DScreen);
|
||||
m_settings->setValue ("WaterfallAvg", ui->waterfallAvgSpinBox->value ());
|
||||
m_settings->setValue ("Current", ui->widePlot->current());
|
||||
m_settings->setValue ("Cumulative", ui->widePlot->cumulative());
|
||||
m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg());
|
||||
m_settings->setValue ("Reference", ui->widePlot->Reference());
|
||||
m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ());
|
||||
m_settings->setValue ("StartFreq", ui->widePlot->startFreq ());
|
||||
m_settings->setValue ("WaterfallPalette", m_waterfallPalette);
|
||||
m_settings->setValue ("UserPalette", QVariant::fromValue (m_userPalette.colours ()));
|
||||
m_settings->setValue("Flatten",m_bFlatten);
|
||||
m_settings->setValue("UseRef",m_bRef);
|
||||
m_settings->setValue ("HideControls", ui->controls_widget->isHidden ());
|
||||
m_settings->setValue ("FminPerBand", m_fMinPerBand);
|
||||
}
|
||||
|
||||
void WideGraph::drawRed(int ia, int ib)
|
||||
{
|
||||
ui->widePlot->drawRed(ia,ib,swide);
|
||||
}
|
||||
|
||||
void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dataSink2
|
||||
{
|
||||
static float splot[NSMAX];
|
||||
int nbpp = ui->widePlot->binsPerPixel();
|
||||
|
||||
//Average spectra over specified number, m_waterfallAvg
|
||||
if (m_n==0) {
|
||||
for (int i=0; i<NSMAX; i++)
|
||||
splot[i]=s[i];
|
||||
} else {
|
||||
for (int i=0; i<NSMAX; i++)
|
||||
splot[i] += s[i];
|
||||
}
|
||||
m_n++;
|
||||
|
||||
if (m_n>=m_waterfallAvg) {
|
||||
for (int i=0; i<NSMAX; i++)
|
||||
splot[i] /= m_n; //Normalize the average
|
||||
m_n=0;
|
||||
int i=int(ui->widePlot->startFreq()/df3 + 0.5);
|
||||
int jz=5000.0/(nbpp*df3);
|
||||
if(jz>MAX_SCREENSIZE) jz=MAX_SCREENSIZE;
|
||||
for (int j=0; j<jz; j++) {
|
||||
float ss=0;
|
||||
for (int k=0; k<nbpp; k++) {
|
||||
if(splot[i]>ss) ss=splot[i];
|
||||
i++;
|
||||
}
|
||||
swide[j]=nbpp*ss;
|
||||
}
|
||||
|
||||
// Time according to this computer
|
||||
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
||||
int ntr = (ms/1000) % m_TRperiod;
|
||||
if((ndiskdata && ihsym <= m_waterfallAvg) || (!ndiskdata && ntr<m_ntr0)) {
|
||||
float flagValue=1.0e30;
|
||||
if(m_bHaveTransmitted) flagValue=2.0e30;
|
||||
for (int i=0; i<2048; i++) {
|
||||
swide[i] = flagValue;
|
||||
}
|
||||
m_bHaveTransmitted=false;
|
||||
}
|
||||
m_ntr0=ntr;
|
||||
ui->widePlot->draw(swide,true,false);
|
||||
}
|
||||
}
|
||||
|
||||
void WideGraph::on_bppSpinBox_valueChanged(int n) //bpp
|
||||
{
|
||||
ui->widePlot->setBinsPerPixel(n);
|
||||
}
|
||||
|
||||
void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n) //Navg
|
||||
{
|
||||
m_waterfallAvg = n;
|
||||
ui->widePlot->setWaterfallAvg(n);
|
||||
}
|
||||
|
||||
void WideGraph::keyPressEvent(QKeyEvent *e) //F11, F12
|
||||
{
|
||||
switch(e->key())
|
||||
{
|
||||
int n;
|
||||
case Qt::Key_F11:
|
||||
n=11;
|
||||
if(e->modifiers() & Qt::ControlModifier) n+=100;
|
||||
emit f11f12(n);
|
||||
break;
|
||||
case Qt::Key_F12:
|
||||
n=12;
|
||||
if(e->modifiers() & Qt::ControlModifier) n+=100;
|
||||
emit f11f12(n);
|
||||
break;
|
||||
default:
|
||||
QDialog::keyPressEvent (e);
|
||||
}
|
||||
}
|
||||
|
||||
void WideGraph::setRxFreq(int n) //setRxFreq
|
||||
{
|
||||
ui->widePlot->setRxFreq(n);
|
||||
ui->widePlot->draw(swide,false,false);
|
||||
}
|
||||
|
||||
int WideGraph::rxFreq() //rxFreq
|
||||
{
|
||||
return ui->widePlot->rxFreq();
|
||||
}
|
||||
|
||||
int WideGraph::nStartFreq() //nStartFreq
|
||||
{
|
||||
return ui->widePlot->startFreq();
|
||||
}
|
||||
|
||||
void WideGraph::wideFreezeDecode(int n) //wideFreezeDecode
|
||||
{
|
||||
emit freezeDecode2(n);
|
||||
}
|
||||
|
||||
void WideGraph::setRxRange ()
|
||||
{
|
||||
ui->widePlot->setRxRange (Fmin ());
|
||||
ui->widePlot->DrawOverlay();
|
||||
ui->widePlot->update();
|
||||
}
|
||||
|
||||
int WideGraph::Fmin() //Fmin
|
||||
{
|
||||
return "60m" == m_rxBand ? 0 : m_fMinPerBand.value (m_rxBand, 2500).toUInt ();
|
||||
}
|
||||
|
||||
int WideGraph::Fmax() //Fmax
|
||||
{
|
||||
return std::min(5000,ui->widePlot->Fmax());
|
||||
}
|
||||
|
||||
int WideGraph::fSpan()
|
||||
{
|
||||
return ui->widePlot->fSpan ();
|
||||
}
|
||||
|
||||
void WideGraph::setPeriod(int ntrperiod, int nsps) //SetPeriod
|
||||
{
|
||||
m_TRperiod=ntrperiod;
|
||||
m_nsps=nsps;
|
||||
ui->widePlot->setNsps(ntrperiod, nsps);
|
||||
}
|
||||
|
||||
void WideGraph::setTxFreq(int n) //setTxFreq
|
||||
{
|
||||
emit setXIT2(n);
|
||||
ui->widePlot->setTxFreq(n);
|
||||
}
|
||||
|
||||
void WideGraph::setMode(QString mode) //setMode
|
||||
{
|
||||
m_mode=mode;
|
||||
ui->fSplitSpinBox->setEnabled(m_mode=="JT9+JT65");
|
||||
ui->widePlot->setMode(mode);
|
||||
ui->widePlot->DrawOverlay();
|
||||
ui->widePlot->update();
|
||||
}
|
||||
|
||||
void WideGraph::setSubMode(int n) //setSubMode
|
||||
{
|
||||
m_nSubMode=n;
|
||||
ui->widePlot->setSubMode(n);
|
||||
ui->widePlot->DrawOverlay();
|
||||
ui->widePlot->update();
|
||||
}
|
||||
void WideGraph::setModeTx(QString modeTx) //setModeTx
|
||||
{
|
||||
m_modeTx=modeTx;
|
||||
ui->widePlot->setModeTx(modeTx);
|
||||
ui->widePlot->DrawOverlay();
|
||||
ui->widePlot->update();
|
||||
}
|
||||
|
||||
//Current-Cumulative-Yellow
|
||||
void WideGraph::on_spec2dComboBox_currentIndexChanged(const QString &arg1)
|
||||
{
|
||||
ui->widePlot->setCurrent(false);
|
||||
ui->widePlot->setCumulative(false);
|
||||
ui->widePlot->setLinearAvg(false);
|
||||
ui->widePlot->setReference(false);
|
||||
ui->smoSpinBox->setEnabled(false);
|
||||
if(arg1=="Current") ui->widePlot->setCurrent(true);
|
||||
if(arg1=="Cumulative") ui->widePlot->setCumulative(true);
|
||||
if(arg1=="Linear Avg") {
|
||||
ui->widePlot->setLinearAvg(true);
|
||||
ui->smoSpinBox->setEnabled(true);
|
||||
}
|
||||
if(arg1=="Reference") {
|
||||
ui->widePlot->setReference(true);
|
||||
}
|
||||
if(ui->widePlot->scaleOK ()) ui->widePlot->draw(swide,false,false);
|
||||
}
|
||||
|
||||
void WideGraph::on_fSplitSpinBox_valueChanged(int n) //fSplit
|
||||
{
|
||||
if (m_rxBand != "60m") m_fMinPerBand[m_rxBand] = n;
|
||||
setRxRange ();
|
||||
}
|
||||
|
||||
void WideGraph::setFreq2(int rxFreq, int txFreq) //setFreq2
|
||||
{
|
||||
emit setFreq3(rxFreq,txFreq);
|
||||
}
|
||||
|
||||
void WideGraph::setDialFreq(double d) //setDialFreq
|
||||
{
|
||||
ui->widePlot->setDialFreq(d);
|
||||
}
|
||||
|
||||
void WideGraph::setRxBand (QString const& band)
|
||||
{
|
||||
m_rxBand = band;
|
||||
if ("60m" == m_rxBand)
|
||||
{
|
||||
ui->fSplitSpinBox->setEnabled (false);
|
||||
ui->fSplitSpinBox->setValue (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->fSplitSpinBox->setValue (m_fMinPerBand.value (band, 2500).toUInt ());
|
||||
ui->fSplitSpinBox->setEnabled (m_mode=="JT9+JT65");
|
||||
}
|
||||
ui->widePlot->setRxBand(band);
|
||||
setRxRange ();
|
||||
}
|
||||
|
||||
|
||||
void WideGraph::on_fStartSpinBox_valueChanged(int n) //fStart
|
||||
{
|
||||
ui->widePlot->setStartFreq(n);
|
||||
}
|
||||
|
||||
void WideGraph::readPalette () //readPalette
|
||||
{
|
||||
try
|
||||
{
|
||||
if (user_defined == m_waterfallPalette)
|
||||
{
|
||||
ui->widePlot->setColours (WFPalette {m_userPalette}.interpolate ());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->widePlot->setColours (WFPalette {m_palettes_path.absoluteFilePath (m_waterfallPalette + ".pal")}.interpolate());
|
||||
}
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("Read Palette"), e.what ());
|
||||
}
|
||||
}
|
||||
|
||||
void WideGraph::on_paletteComboBox_activated (QString const& palette) //palette selector
|
||||
{
|
||||
m_waterfallPalette = palette;
|
||||
readPalette();
|
||||
}
|
||||
|
||||
void WideGraph::on_cbFlatten_toggled(bool b) //Flatten On/Off
|
||||
{
|
||||
m_bFlatten=b;
|
||||
if(m_bRef and m_bFlatten) {
|
||||
m_bRef=false;
|
||||
ui->cbRef->setChecked(false);
|
||||
}
|
||||
ui->widePlot->setFlatten(m_bFlatten,m_bRef);
|
||||
}
|
||||
|
||||
void WideGraph::on_cbRef_toggled(bool b)
|
||||
{
|
||||
m_bRef=b;
|
||||
if(m_bRef and m_bFlatten) {
|
||||
m_bFlatten=false;
|
||||
ui->cbFlatten->setChecked(false);
|
||||
}
|
||||
ui->widePlot->setFlatten(m_bFlatten,m_bRef);
|
||||
}
|
||||
|
||||
void WideGraph::on_cbControls_toggled(bool b)
|
||||
{
|
||||
ui->controls_widget->setVisible(b);
|
||||
}
|
||||
|
||||
void WideGraph::on_adjust_palette_push_button_clicked (bool) //Adjust Palette
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_userPalette.design ())
|
||||
{
|
||||
m_waterfallPalette = user_defined;
|
||||
ui->paletteComboBox->setCurrentText (m_waterfallPalette);
|
||||
readPalette ();
|
||||
}
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("Read Palette"), e.what ());
|
||||
}
|
||||
}
|
||||
|
||||
bool WideGraph::flatten() //Flatten
|
||||
{
|
||||
return m_bFlatten;
|
||||
}
|
||||
|
||||
bool WideGraph::useRef() //Flatten
|
||||
{
|
||||
return m_bRef;
|
||||
}
|
||||
|
||||
void WideGraph::on_gainSlider_valueChanged(int value) //Gain
|
||||
{
|
||||
ui->widePlot->setPlotGain(value);
|
||||
}
|
||||
|
||||
void WideGraph::on_zeroSlider_valueChanged(int value) //Zero
|
||||
{
|
||||
ui->widePlot->setPlotZero(value);
|
||||
}
|
||||
|
||||
void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2
|
||||
{
|
||||
ui->widePlot->setPlot2dGain(value);
|
||||
if(ui->widePlot->scaleOK ()) {
|
||||
ui->widePlot->draw(swide,false,false);
|
||||
if(m_mode=="QRA64") ui->widePlot->draw(swide,false,true);
|
||||
}
|
||||
}
|
||||
|
||||
void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2
|
||||
{
|
||||
ui->widePlot->setPlot2dZero(value);
|
||||
if(ui->widePlot->scaleOK ()) {
|
||||
ui->widePlot->draw(swide,false,false);
|
||||
if(m_mode=="QRA64") ui->widePlot->draw(swide,false,true);
|
||||
}
|
||||
}
|
||||
|
||||
void WideGraph::setTol(int n) //setTol
|
||||
{
|
||||
ui->widePlot->setTol(n);
|
||||
ui->widePlot->DrawOverlay();
|
||||
ui->widePlot->update();
|
||||
}
|
||||
|
||||
void WideGraph::on_smoSpinBox_valueChanged(int n)
|
||||
{
|
||||
m_nsmo=n;
|
||||
}
|
||||
|
||||
int WideGraph::smoothYellow()
|
||||
{
|
||||
return m_nsmo;
|
||||
}
|
||||
|
||||
void WideGraph::setWSPRtransmitted()
|
||||
{
|
||||
m_bHaveTransmitted=true;
|
||||
}
|
||||
|
||||
void WideGraph::setVHF(bool bVHF)
|
||||
{
|
||||
ui->widePlot->setVHF(bVHF);
|
||||
}
|
||||
|
||||
void WideGraph::on_sbPercent2dPlot_valueChanged(int n)
|
||||
{
|
||||
m_Percent2DScreen=n;
|
||||
ui->widePlot->SetPercent2DScreen(n);
|
||||
}
|
||||
|
||||
void WideGraph::setRedFile(QString fRed)
|
||||
{
|
||||
ui->widePlot->setRedFile(fRed);
|
||||
}
|
||||
Reference in New Issue
Block a user