Merge branch 'feat-fst280' of bitbucket.org:k1jt/wsjtx into feat-fst280

This commit is contained in:
Joe Taylor 2020-07-14 11:43:40 -04:00
commit c925f6d1cc
5 changed files with 91 additions and 60 deletions

View File

@ -59,8 +59,7 @@ program fst240sim
baud=12000.0/nsps !Keying rate (baud)
nmax=nsec*12000
nz=nsps*NN
nz2=nsps*NN2
txt=nz2*dt !Transmission length (s)
txt=nz*dt !Transmission length (s)
tt=nsps*dt !Duration of symbols (s)
allocate( c0(0:nmax-1) )
allocate( c(0:nmax-1) )

View File

@ -87,11 +87,5 @@ subroutine gen_fst240wave(itone,nsym,nsps,nwave,fsample,hmod,f0, &
cwave=cshift(cwave,kshift)
endif
! do i=1,nwave
! write(71,3071) i,i/48000.0,wave(i)
!3071 format(i10,2f15.9)
! enddo
wave(nsps*nsym:)=0. !Kill a stray spike ??
return
end subroutine gen_fst240wave

View File

@ -308,7 +308,6 @@ contains
call fst240_downsample(c_bigfft,nfft1,ndown,fc0,sigbw,c2)
call timer('sync240 ',0)
fc1=0.0
if(emedelay.lt.0.1) then ! search offsets from 0 s to 2 s
is0=1.5*nspsec
@ -393,7 +392,6 @@ contains
xdt=(isbest-nspsec)/fs2
if(ntrperiod.eq.15) xdt=(isbest-real(nspsec)/2.0)/fs2
call fst240_downsample(c_bigfft,nfft1,ndown,fc_synced,sigbw,c2)
do ijitter=0,jittermax
if(ijitter.eq.0) ioffset=0
if(ijitter.eq.1) ioffset=1
@ -549,6 +547,10 @@ contains
else
call get_fst240_tones_from_bits(message74,itone,1)
endif
if(.false.) then
call write_ref(itone,iwave,nsps,nmax,ndown,hmod, &
isbest,fc_synced)
endif
xsig=0
do i=1,NN
xsig=xsig+s4(itone(i),i)**2
@ -790,20 +792,35 @@ contains
iploc=ia+im(1)-1 !Index of CCF peak
pval=s2(iploc) !Peak value
if(pval.lt.minsync) exit
if(s2(iploc).gt.minsync) then !Is this a possible candidate?
do i=-3,+3 !Remove 0.9 of a model CCF at
k=iploc+2*hmod*i !this frequency from s2()
if(k.ge.ia .and. k.le.ib) then
s2(k)=max(0.,s2(k)-0.9*pval*xdb(i))
endif
enddo
ncand=ncand+1
candidates(ncand,1)=df2*iploc !Candidate frequency
candidates(ncand,2)=pval !Rough estimate of SNR
endif
do i=-3,+3 !Remove 0.9 of a model CCF at
k=iploc+2*hmod*i !this frequency from s2()
if(k.ge.ia .and. k.le.ib) then
s2(k)=max(0.,s2(k)-0.9*pval*xdb(i))
endif
enddo
ncand=ncand+1
candidates(ncand,1)=df2*iploc !Candidate frequency
candidates(ncand,2)=pval !Rough estimate of SNR
enddo
return
end subroutine get_candidates_fst240
subroutine write_ref(itone,iwave,nsps,nmax,ndown,hmod,i0,fc)
complex cwave(nmax)
integer itone(160)
integer*2 iwave(nmax)
integer hmod
wave=0
fsample=12000.0
nsym=160
call gen_fst240wave(itone,nsym,nsps,nmax,fsample,hmod,fc, &
1,cwave,wave)
cwave=cshift(cwave,-i0*ndown)
do i=1,nmax
write(51,*) i,iwave(i),real(cwave(i)),imag(cwave(i))
enddo
end subroutine write_ref
end module fst240_decode

View File

@ -4218,7 +4218,7 @@ void MainWindow::startTx2()
if (m_config.TX_messages ()) {
t = " Transmitting " + m_mode + " ----------------------- " +
m_config.bands ()->find (m_freqNominal);
t=WSPR_hhmm(0) + ' ' + t.rightJustified (66, '-');
t=beacon_start_time () + ' ' + t.rightJustified (66, '-');
ui->decodedTextBrowser->appendText(t);
}
write_all("Tx",m_currentMessage);
@ -5824,6 +5824,8 @@ void MainWindow::on_actionFST240_triggered()
{
int nsub=m_nSubMode;
on_actionJT65_triggered();
ui->label_6->setText(tr ("Band Activity"));
ui->label_7->setText(tr ("Rx Frequency"));
ui->sbSubmode->setMaximum(3);
m_nSubMode=nsub;
ui->sbSubmode->setValue(m_nSubMode);
@ -5835,11 +5837,8 @@ void MainWindow::on_actionFST240_triggered()
// 0123456789012345678901234567890123
displayWidgets(nWidgets("1111110001001111000100000001000000"));
setup_status_bar (bVHF);
m_TRperiod = ui->sbTR->value();
ui->sbTR->setMinimum(15);
ui->sbTR->setMaximum(300);
m_TRperiod = ui->sbTR->value();
on_sbTR_valueChanged(ui->sbTR->value());
ui->sbTR->values ({15, 30, 60, 120, 300});
on_sbTR_valueChanged (ui->sbTR->value());
ui->cbAutoSeq->setChecked(true);
m_wideGraph->setMode(m_mode);
m_wideGraph->setModeTx(m_modeTx);
@ -5862,16 +5861,9 @@ void MainWindow::on_actionFST240W_triggered()
setup_status_bar (bVHF);
m_nSubMode=0;
ui->sbSubmode->setValue(m_nSubMode);
m_TRperiod = ui->sbTR_FST240W->value ();
ui->band_hopping_group_box->setChecked(false);
ui->band_hopping_group_box->setVisible(false);
int ntr=m_TRperiod;
ui->sbTR_FST240W->setMinimum(15);
ui->sbTR_FST240W->setMaximum(300);
ui->sbTR_FST240W->setValue(120); //### Why is all this necessary? ###
ui->sbTR_FST240W->setValue(300);
ui->sbTR_FST240W->setValue(ntr);
m_TRperiod = ui->sbTR_FST240W->value();
on_sbTR_FST240W_valueChanged (ui->sbTR_FST240W->value ());
ui->sbSubmode->setMaximum(3);
m_wideGraph->setMode(m_mode);
m_wideGraph->setModeTx(m_modeTx);
@ -6100,18 +6092,22 @@ void MainWindow::on_actionJT9_triggered()
}
ui->sbSubmode->setMaximum(7);
if(m_bFast9) {
m_TRperiod = ui->sbTR->value ();
ui->sbTR->values ({5, 10, 15, 30});
on_sbTR_valueChanged (ui->sbTR->value());
m_wideGraph->hide();
m_fastGraph->showNormal();
ui->TxFreqSpinBox->setValue(700);
ui->RxFreqSpinBox->setValue(700);
ui->decodedTextLabel->setText("UTC dB T Freq " + tr ("Message"));
ui->decodedTextLabel2->setText("UTC dB T Freq " + tr ("Message"));
ui->decodedTextLabel->setText(" UTC dB T Freq " + tr ("Message"));
ui->decodedTextLabel2->setText(" UTC dB T Freq " + tr ("Message"));
} else {
ui->cbAutoSeq->setChecked(false);
m_TRperiod=60.0;
ui->decodedTextLabel->setText("UTC dB DT Freq " + tr ("Message"));
ui->decodedTextLabel2->setText("UTC dB DT Freq " + tr ("Message"));
if (m_mode != "FST240")
{
m_TRperiod=60.0;
ui->decodedTextLabel->setText("UTC dB DT Freq " + tr ("Message"));
ui->decodedTextLabel2->setText("UTC dB DT Freq " + tr ("Message"));
}
}
m_wideGraph->setPeriod(m_TRperiod,m_nsps);
m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
@ -6251,7 +6247,8 @@ void MainWindow::on_actionISCAT_triggered()
m_mode="ISCAT";
m_modeTx="ISCAT";
ui->actionISCAT->setChecked(true);
m_TRperiod = ui->sbTR->value ();
ui->sbTR->values ({5, 10, 15, 30});
on_sbTR_valueChanged (ui->sbTR->value ());
m_modulator->setTRPeriod(m_TRperiod);
m_detector->setTRPeriod(m_TRperiod);
m_wideGraph->setPeriod(m_TRperiod,m_nsps);
@ -6318,7 +6315,8 @@ void MainWindow::on_actionMSK144_triggered()
VHF_features_enabled(true);
m_bFastMode=true;
m_bFast9=false;
m_TRperiod = ui->sbTR->value ();
ui->sbTR->values ({5, 10, 15, 30});
on_sbTR_valueChanged (ui->sbTR->value());
m_wideGraph->hide();
m_fastGraph->showNormal();
ui->TxFreqSpinBox->setValue(1500);
@ -6326,8 +6324,8 @@ void MainWindow::on_actionMSK144_triggered()
ui->RxFreqSpinBox->setMinimum(1400);
ui->RxFreqSpinBox->setMaximum(1600);
ui->RxFreqSpinBox->setSingleStep(10);
ui->decodedTextLabel->setText("UTC dB T Freq " + tr ("Message"));
ui->decodedTextLabel2->setText("UTC dB T Freq " + tr ("Message"));
ui->decodedTextLabel->setText(" UTC dB T Freq " + tr ("Message"));
ui->decodedTextLabel2->setText(" UTC dB T Freq " + tr ("Message"));
m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
m_fastGraph->setTRPeriod(m_TRperiod);
@ -6422,7 +6420,8 @@ void MainWindow::on_actionFreqCal_triggered()
ui->actionFreqCal->setChecked(true);
switch_mode(Modes::FreqCal);
m_wideGraph->setMode(m_mode);
m_TRperiod = ui->sbTR->value ();
ui->sbTR->values ({5, 10, 15, 30});
on_sbTR_valueChanged (ui->sbTR->value());
m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
m_nsps=6912; //For symspec only
@ -6497,10 +6496,10 @@ void MainWindow::WSPR_config(bool b)
Q_EMIT m_config.transceiver_tx_frequency (0); // turn off split
}
m_bSimplex = true;
} else {
ui->decodedTextLabel->setText("UTC dB DT Freq " + tr ("Message"));
m_bSimplex = false;
}
} else
{
m_bSimplex = false;
}
enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
}
@ -7431,6 +7430,25 @@ void MainWindow::on_sbTR_valueChanged(int value)
// if(!m_bFastMode and n>m_nSubMode) m_MinW=m_nSubMode;
if(m_bFastMode or m_mode=="FreqCal" or m_mode=="FST240" or m_mode=="FST240W") {
m_TRperiod = value;
if (m_mode == "FST240" || m_mode == "FST240W")
{
if (m_TRperiod < 60)
{
ui->decodedTextLabel->setText(" UTC dB DT Freq " + tr ("Message"));
if (m_mode != "FST240W")
{
ui->decodedTextLabel2->setText(" UTC dB DT Freq " + tr ("Message"));
}
}
else
{
ui->decodedTextLabel->setText("UTC dB DT Freq " + tr ("Message"));
if (m_mode != "FST240W")
{
ui->decodedTextLabel2->setText("UTC dB DT Freq " + tr ("Message"));
}
}
}
m_fastGraph->setTRPeriod (value);
m_modulator->setTRPeriod (value); // TODO - not thread safe
m_detector->setTRPeriod (value); // TODO - not thread safe
@ -7727,7 +7745,7 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout
if(m_nWSPRdecodes==0 and ui->band_hopping_group_box->isChecked()) {
t = " " + tr ("Receiving") + " " + m_mode + " ----------------------- " +
m_config.bands ()->find (m_dialFreqRxWSPR);
t=WSPR_hhmm(-60) + ' ' + t.rightJustified (66, '-');
t=beacon_start_time (-m_TRperiod / 2) + ' ' + t.rightJustified (66, '-');
ui->decodedTextBrowser->appendText(t);
}
killFileTimer.start (45*1000); //Kill in 45s (for slow modes)
@ -7814,20 +7832,23 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout
}
}
QString MainWindow::WSPR_hhmm(int n)
QString MainWindow::beacon_start_time (int n)
{
QDateTime t=QDateTime::currentDateTimeUtc().addSecs(n);
int m=t.toString("hhmm").toInt()/2;
QString t1;
t1 = t1.asprintf("%04d",2*m);
return t1;
auto time = QDateTime::currentDateTimeUtc ().addSecs (n).time ();
auto rounded_time = (int ((time.hour () * 10000 + time.minute () * 100 + time.second ()) * 60 / m_TRperiod) * int (m_TRperiod)) / 60;
auto result = QString::number (rounded_time).rightJustified (6, QLatin1Char {'0'});
if (m_TRperiod < 60)
{
return result;
}
return result.left (4);
}
void MainWindow::WSPR_history(Frequency dialFreq, int ndecodes)
{
QDateTime t=QDateTime::currentDateTimeUtc().addSecs(-60);
QString t1=t.toString("yyMMdd");
QString t2=WSPR_hhmm(-60);
QString t2=beacon_start_time (-m_TRperiod / 2);
QString t3;
t3 = t3.asprintf("%13.6f",0.000001*dialFreq);
if(ndecodes<0) {

View File

@ -728,7 +728,7 @@ private:
void freqCalStep();
void setRig (Frequency = 0); // zero frequency means no change
void WSPR_history(Frequency dialFreq, int ndecodes);
QString WSPR_hhmm(int n);
QString beacon_start_time (int n = 0);
QString WSPR_message();
void fast_config(bool b);
void CQTxFreq();