Try letting hopping.f90 determine TX intervals

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5472 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2015-05-30 23:45:22 +00:00
parent a032723a7d
commit 41010d05eb
2 changed files with 79 additions and 28 deletions

View File

@ -60,6 +60,55 @@ subroutine hopping(nyear,month,nday,uth,mygrid,nduration,npctx,isun, &
enddo
! We now have 1 to 3 Tx periods per band in the 2-hour interval.
! Now go through and limit the number of successive Tx's to two.
icnt=0
isum=0
nkilled=0
do i=1,6
do j=1,10
if( tx(j,i).eq.1 ) then
icnt=icnt+1
if( icnt.gt.2 ) then
tx(j,i)=0
nkilled=nkilled+1
icnt=0
endif
endif
isum=isum+tx(j,i)
enddo
enddo
actual_pct=isum/60.0
write(*,*) "Actual pct = ",actual_pct," nkilled = ",nkilled
! Not try to put back the slots that were zero'd without causing new runs
nz=0
do i=1,6
do j=1,10
if( tx(j,i).eq.0 ) then
nz=nz+1
if( (nz.eq.3) .and. (nkilled.gt.0) ) then
if(j.ge.2) then
tx(j-1,i) = 1
nkilled=nkilled-1
elseif(i.gt.1) then
tx(10,i-1) = 1
nkilled=nkilled-1
endif
nz=0
endif
endif
enddo
enddo
isum=0
do i=1,6
do j=1,10
if( tx(j,i) .eq. 1 ) then
isum=isum+1
endif
enddo
enddo
actual_pct=isum/60.0
write(*,*) "Actual pct = ",actual_pct," nkilled = ",nkilled
endif
iband=mod(nsec/120,10) + 1
@ -72,10 +121,10 @@ subroutine hopping(nyear,month,nday,uth,mygrid,nduration,npctx,isun, &
endif
iband=iband-1
! write(*,3000) iband,iseq,nrx,ntxnext
!3000 format('Fortran iband, iseq,nrx,ntxnext:',4i5)
! write(*,3001) int(tx)
!3001 format(10i2)
write(*,3000) iband,iseq,nrx,ntxnext
3000 format('Fortran iband, iseq,nrx,ntxnext:',4i5)
write(*,3001) int(tx)
3001 format(10i2)
return
end subroutine hopping

View File

@ -1,4 +1,4 @@
//--------------------------------------------------------- MainWindow
//-------------------------------------------------------- MainWindow
#include "mainwindow.h"
#include <cinttypes>
@ -393,7 +393,6 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
m_bTxTime=false;
m_band00=-1;
m_rxDone=false;
m_bHaveTransmitted=false;
m_fWSPR["160"]=1.8366; //WSPR frequencies
m_fWSPR["80"]=3.5926;
@ -971,7 +970,7 @@ void MainWindow::on_actionAbout_triggered() //Display "About"
void MainWindow::on_autoButton_clicked (bool checked)
{
m_auto = checked;
// qDebug() << "autoButton_clicked" << m_auto << m_tuneup;
qDebug() << "autoButton_clicked" << m_auto << m_tuneup;
m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall,
QString::number (ui->rptSpinBox->value ()),
@ -1829,29 +1828,29 @@ void MainWindow::guiUpdate()
m_tuneup=false; //This is not an ATU tuneup
if(m_pctx==0) m_nrx=1; //Don't transmit if m_pctx=0
bool btx = m_auto and (m_nrx<=0); //To Tx, we need m_auto and Rx sequsnce finished
if(m_bHaveTransmitted) btx=false; //Normally, no two consecutive transmissions
// if(m_ntr == -1) btx=false; //Normally, no two consecutive transmissions
if(m_auto and m_txNext) btx=true; //TxNext button overrides
if(m_auto and m_pctx==100) btx=true; //Always transmit
qDebug() << "B" << m_pctx << m_auto << m_nrx << m_ntr << m_txNext;
if(btx) {
// This will be a WSPR Tx sequence. Compute # of Rx's that should follow.
float x=(float)rand()/RAND_MAX;
if(m_pctx<50) {
m_nrx=int(m_rxavg + 3.0*(x-0.5) + 0.5);
} else {
m_nrx=0;
if(x<m_rxavg) m_nrx=1;
}
// float x=(float)rand()/RAND_MAX;
// if(m_pctx<50) {
// m_nrx=int(m_rxavg + 3.0*(x-0.5) + 0.5);
// } else {
// m_nrx=0;
// if(x<m_rxavg) m_nrx=1;
// }
m_ntr=-1; //This says we will have transmitted
m_bHaveTransmitted=true;
m_txNext=false;
ui->pbTxNext->setChecked(false);
m_bTxTime=true; //Start a WSPR Tx sequence
m_bTxTime=true; //Start a WSPR Tx sequence
} else {
// This will be a WSPR Rx sequence.
m_ntr=1; //This says we will have received
m_bHaveTransmitted=false;
m_bTxTime=false; //Start a WSPR Rx sequence
m_bTxTime=false; //Start a WSPR Rx sequence
}
}
@ -1906,10 +1905,10 @@ void MainWindow::guiUpdate()
m_btxok=false;
}
if(m_ntr==1) {
if(m_bandHopping) {
// if(m_bandHopping) {
// qDebug() << "Call bandHopping after Rx" << m_nseq << m_ntr << m_nrx << m_rxDone;
bandHopping();
}
// }
m_ntr=0; //This WSPR Rx sequence is complete
}
}
@ -2229,7 +2228,7 @@ void MainWindow::startTx2()
transmit (snr);
signalMeter->setValue(0);
if(m_mode.mid(0,4)=="WSPR" and !m_tune) {
t = " Transmiting " + m_mode + " ----------------------- " +
t = " Transmitting " + m_mode + " ----------------------- " +
QString {m_config.bands ()->find (m_dialFreq)->name_};
ui->decodedTextBrowser->append(t.rightJustified (71, '-'));
@ -2272,11 +2271,10 @@ void MainWindow::stopTx2()
m_repeatMsg=0;
}
if(m_mode.mid(0,4)=="WSPR" and m_ntr==-1 and !m_tuneup) {
m_wideGraph->setWSPRtransmitted();
if(m_bandHopping) {
// if(m_bandHopping) {
// qDebug () << "Call bandHopping after Tx" << m_tuneup;
bandHopping();
}
// }
m_ntr=0;
}
}
@ -4298,14 +4296,14 @@ void MainWindow::bandHopping()
const_cast <char *> (m_config.my_grid ().toLatin1().constData()),
&m_grayDuration, &m_pctx, &isun, &iband0, &ntxnext, 6);
/*
if(m_auto and ntxnext==1) {
m_nrx=0;
} else {
m_nrx=1;
}
*/
if( m_bandHopping ) {
QString bname;
QStringList s;
if(isun==0) s=m_sunriseBands;
@ -4339,7 +4337,9 @@ void MainWindow::bandHopping()
}
}
QThread::msleep(500); //### ??? Is this OK to do ??? ###
QThread::msleep(1500);
// qDebug() << nhr << nmin << int(sec) << bname << f0 << 0.000001*f0;
m_band00=iband;
auto frequencies = m_config.frequencies ();
@ -4392,6 +4392,8 @@ void MainWindow::bandHopping()
on_tuneButton_clicked(true);
tuneATU_Timer->start(2500);
}
} //endif m_bandHopping
}
void MainWindow::on_pushButton_clicked()