Enable new TX scheduler for WSPR mode.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5533 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2015-06-04 22:25:27 +00:00
parent c4e8b78518
commit 7e3c93553f
7 changed files with 24 additions and 27 deletions

View File

@ -235,12 +235,12 @@ set (wsjtx_CXXSRCS
about.cpp about.cpp
astro.cpp astro.cpp
messageaveraging.cpp messageaveraging.cpp
WsprTxScheduler.cpp
mainwindow.cpp mainwindow.cpp
Configuration.cpp Configuration.cpp
main.cpp main.cpp
wsprnet.cpp wsprnet.cpp
WSPRBandHopping.cpp WSPRBandHopping.cpp
WsprTxScheduler.cpp
) )
if (WIN32) if (WIN32)

View File

@ -1,15 +1,5 @@
#include "WsprTxScheduler.h" #include "WsprTxScheduler.h"
/*#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <iostream>
using namespace std;
char tx[6][10];
int pctx, tx_table_2hr_slot;
*/
int tx_band_sum(char bsum[10]) int tx_band_sum(char bsum[10])
{ {
int i,j; int i,j;
@ -95,7 +85,7 @@ void tx_print()
printf("\n"); printf("\n");
} }
int create_tx_schedule() int create_tx_schedule(int pctx)
{ {
char bsum[10]; char bsum[10];
int i, j, k, sum, ntxlim, ntxbandmin, needed; int i, j, k, sum, ntxlim, ntxbandmin, needed;
@ -159,7 +149,7 @@ int create_tx_schedule()
return 0; return 0;
} }
int next_tx_state() int next_tx_state(int pctx)
{ {
time_t now=time(0)+30; time_t now=time(0)+30;
tm *ltm = localtime(&now); tm *ltm = localtime(&now);
@ -171,7 +161,7 @@ int next_tx_state()
int tx_2min_slot = (minute%20)/2; int tx_2min_slot = (minute%20)/2;
if( tx_2hr_slot != tx_table_2hr_slot ) { if( tx_2hr_slot != tx_table_2hr_slot ) {
create_tx_schedule(); create_tx_schedule(pctx);
tx_table_2hr_slot = tx_2hr_slot; tx_table_2hr_slot = tx_2hr_slot;
} }
@ -180,6 +170,8 @@ int next_tx_state()
cout << "tx_20min_slot " << tx_20min_slot << endl; cout << "tx_20min_slot " << tx_20min_slot << endl;
cout << "tx_2min_slot " << tx_2min_slot << endl; cout << "tx_2min_slot " << tx_2min_slot << endl;
cout << "tx_table_2hr_slot " << tx_table_2hr_slot << endl; cout << "tx_table_2hr_slot " << tx_table_2hr_slot << endl;
cout << "Requested % " << pctx << " Actual % " << 100*tx_sum()/60 << endl;
tx_print();
return tx[tx_20min_slot][tx_2min_slot]; return tx[tx_20min_slot][tx_2min_slot];
} }
/* /*
@ -192,7 +184,7 @@ int main(int argc, char *argv[])
pctx = 25; pctx = 25;
} }
tx_table_2hr_slot = 0; tx_table_2hr_slot = 0;
cout << "Next TX state: " << next_tx_state() << endl; cout << "Next TX state: " << next_tx_state(m_pctx) << endl;
cout << "Requested % " << pctx << " Actual % " << 100*tx_sum()/60 << endl; cout << "Requested % " << pctx << " Actual % " << 100*tx_sum()/60 << endl;
tx_print(); tx_print();
} }

View File

@ -7,7 +7,7 @@
using namespace std; using namespace std;
char tx[6][10]; char tx[6][10];
int pctx, tx_table_2hr_slot; int tx_table_2hr_slot=-1;
int tx_band_sum(char bsum[10]); int tx_band_sum(char bsum[10]);
int tx_add_to_band(int band); int tx_add_to_band(int band);
@ -15,5 +15,5 @@ int tx_sum();
int tx_add_one(char* tx); int tx_add_one(char* tx);
int tx_trim(char* tx, int ntxlim); int tx_trim(char* tx, int ntxlim);
void tx_print(); void tx_print();
int create_tx_schedule(); int create_tx_schedule(int pctx);
int next_tx_state(); int next_tx_state(int pctx);

View File

@ -147,14 +147,14 @@ subroutine hopping(nyear,month,nday,uth,mygrid,nduration,npctx,isun, &
enddo enddo
call txtrim(tx,ntxlimit,ntot) call txtrim(tx,ntxlimit,ntot)
if( abs(ntot-n_needed) .le. 1 ) then if( abs(ntot-n_needed) .le. 1 ) then
write(*,*) "Success! Iteration converged" ! write(*,*) "Success! Iteration converged"
exit exit
endif endif
! write(*,*) "Iteration: ",k,ntot,n_needed ! write(*,*) "Iteration: ",k,ntot,n_needed
! iteration loop ! iteration loop
enddo enddo
actual_pct=ntot/60.0 actual_pct=ntot/60.0
write(*,*) "Actual percentage: ",actual_pct ! write(*,*) "Actual percentage: ",actual_pct
endif endif
iband=mod(nsec/120,10) + 1 iband=mod(nsec/120,10) + 1
@ -167,10 +167,10 @@ subroutine hopping(nyear,month,nday,uth,mygrid,nduration,npctx,isun, &
endif endif
iband=iband-1 iband=iband-1
write(*,3000) iband+1,iseq,nrx,ntxnext ! write(*,3000) iband+1,iseq,nrx,ntxnext
3000 format('Fortran iband, iseq,nrx,ntxnext:',4i5) !3000 format('Fortran iband, iseq,nrx,ntxnext:',4i5)
write(*,3001) int(tx) ! write(*,3001) int(tx)
3001 format(10i2) !3001 format(10i2)
return return
end subroutine hopping end subroutine hopping

View File

@ -4290,7 +4290,11 @@ void MainWindow::bandHopping()
<< "tune:" << hop_data.tune_required_ << "tune:" << hop_data.tune_required_
<< "tx:" << hop_data.tx_next_; << "tx:" << hop_data.tx_next_;
if (m_auto &&hop_data.tx_next_) { int blah = next_tx_state(m_pctx);
printf("next tx state %d\n",blah);
// if (m_auto &&hop_data.tx_next_) {
if ( m_auto && next_tx_state(m_pctx) ) {
m_nrx = 0; m_nrx = 0;
} else { } else {
m_nrx = 1; m_nrx = 1;

View File

@ -521,6 +521,7 @@ extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
int minChan[], int maxChan[], int minChan[], int maxChan[],
int minSpeed[], int maxSpeed[]); int minSpeed[], int maxSpeed[]);
extern int ptt(int nport, int ntx, int* iptt, int* nopen); extern int ptt(int nport, int ntx, int* iptt, int* nopen);
extern int next_tx_state(int pctx);
extern "C" { extern "C" {
//----------------------------------------------------- C and Fortran routines //----------------------------------------------------- C and Fortran routines

View File

@ -62,9 +62,9 @@ SOURCES += \
Configuration.cpp psk_reporter.cpp AudioDevice.cpp \ Configuration.cpp psk_reporter.cpp AudioDevice.cpp \
Modulator.cpp Detector.cpp logqso.cpp displaytext.cpp \ Modulator.cpp Detector.cpp logqso.cpp displaytext.cpp \
getfile.cpp soundout.cpp soundin.cpp meterwidget.cpp signalmeter.cpp \ getfile.cpp soundout.cpp soundin.cpp meterwidget.cpp signalmeter.cpp \
WFPalette.cpp plotter.cpp widegraph.cpp about.cpp mainwindow.cpp \ WFPalette.cpp plotter.cpp widegraph.cpp about.cpp WsprTxScheduler.cpp mainwindow.cpp \
main.cpp decodedtext.cpp wsprnet.cpp messageaveraging.cpp \ main.cpp decodedtext.cpp wsprnet.cpp messageaveraging.cpp \
echoplot.cpp echograph.cpp Modes.cpp WSPRBandHopping.cpp WsprTxScheduler.cpp echoplot.cpp echograph.cpp Modes.cpp WSPRBandHopping.cpp
HEADERS += qt_helpers.hpp \ HEADERS += qt_helpers.hpp \
pimpl_h.hpp pimpl_impl.hpp \ pimpl_h.hpp pimpl_impl.hpp \