From 7e3c93553fa6f928231121f8185b81a29d7391c6 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Thu, 4 Jun 2015 22:25:27 +0000 Subject: [PATCH] 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 --- CMakeLists.txt | 2 +- WsprTxScheduler.cpp | 20 ++++++-------------- WsprTxScheduler.h | 6 +++--- lib/hopping.f90 | 12 ++++++------ mainwindow.cpp | 6 +++++- mainwindow.h | 1 + wsjtx.pro | 4 ++-- 7 files changed, 24 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 596bb8b32..81b620f68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -235,12 +235,12 @@ set (wsjtx_CXXSRCS about.cpp astro.cpp messageaveraging.cpp + WsprTxScheduler.cpp mainwindow.cpp Configuration.cpp main.cpp wsprnet.cpp WSPRBandHopping.cpp - WsprTxScheduler.cpp ) if (WIN32) diff --git a/WsprTxScheduler.cpp b/WsprTxScheduler.cpp index 1d0d10dec..1fe326047 100644 --- a/WsprTxScheduler.cpp +++ b/WsprTxScheduler.cpp @@ -1,15 +1,5 @@ #include "WsprTxScheduler.h" -/*#include -#include -#include -#include -#include -using namespace std; - -char tx[6][10]; -int pctx, tx_table_2hr_slot; -*/ int tx_band_sum(char bsum[10]) { int i,j; @@ -95,7 +85,7 @@ void tx_print() printf("\n"); } -int create_tx_schedule() +int create_tx_schedule(int pctx) { char bsum[10]; int i, j, k, sum, ntxlim, ntxbandmin, needed; @@ -159,7 +149,7 @@ int create_tx_schedule() return 0; } -int next_tx_state() +int next_tx_state(int pctx) { time_t now=time(0)+30; tm *ltm = localtime(&now); @@ -171,7 +161,7 @@ int next_tx_state() int tx_2min_slot = (minute%20)/2; if( tx_2hr_slot != tx_table_2hr_slot ) { - create_tx_schedule(); + create_tx_schedule(pctx); 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_2min_slot " << tx_2min_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]; } /* @@ -192,7 +184,7 @@ int main(int argc, char *argv[]) pctx = 25; } 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; tx_print(); } diff --git a/WsprTxScheduler.h b/WsprTxScheduler.h index 6fa2dd66c..f3c4a6121 100644 --- a/WsprTxScheduler.h +++ b/WsprTxScheduler.h @@ -7,7 +7,7 @@ using namespace std; 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_add_to_band(int band); @@ -15,5 +15,5 @@ int tx_sum(); int tx_add_one(char* tx); int tx_trim(char* tx, int ntxlim); void tx_print(); -int create_tx_schedule(); -int next_tx_state(); +int create_tx_schedule(int pctx); +int next_tx_state(int pctx); diff --git a/lib/hopping.f90 b/lib/hopping.f90 index 108e40473..aae51a0a5 100644 --- a/lib/hopping.f90 +++ b/lib/hopping.f90 @@ -147,14 +147,14 @@ subroutine hopping(nyear,month,nday,uth,mygrid,nduration,npctx,isun, & enddo call txtrim(tx,ntxlimit,ntot) if( abs(ntot-n_needed) .le. 1 ) then - write(*,*) "Success! Iteration converged" +! write(*,*) "Success! Iteration converged" exit endif ! write(*,*) "Iteration: ",k,ntot,n_needed ! iteration loop enddo actual_pct=ntot/60.0 - write(*,*) "Actual percentage: ",actual_pct +! write(*,*) "Actual percentage: ",actual_pct endif iband=mod(nsec/120,10) + 1 @@ -167,10 +167,10 @@ subroutine hopping(nyear,month,nday,uth,mygrid,nduration,npctx,isun, & endif iband=iband-1 - write(*,3000) iband+1,iseq,nrx,ntxnext -3000 format('Fortran iband, iseq,nrx,ntxnext:',4i5) - write(*,3001) int(tx) -3001 format(10i2) +! write(*,3000) iband+1,iseq,nrx,ntxnext +!3000 format('Fortran iband, iseq,nrx,ntxnext:',4i5) +! write(*,3001) int(tx) +!3001 format(10i2) return end subroutine hopping diff --git a/mainwindow.cpp b/mainwindow.cpp index 26cc6bf8f..925b5ee85 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4290,7 +4290,11 @@ void MainWindow::bandHopping() << "tune:" << hop_data.tune_required_ << "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; } else { m_nrx = 1; diff --git a/mainwindow.h b/mainwindow.h index a5dfcdb65..4d2b91e67 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -521,6 +521,7 @@ extern void getDev(int* numDevices,char hostAPI_DeviceName[][50], int minChan[], int maxChan[], int minSpeed[], int maxSpeed[]); extern int ptt(int nport, int ntx, int* iptt, int* nopen); +extern int next_tx_state(int pctx); extern "C" { //----------------------------------------------------- C and Fortran routines diff --git a/wsjtx.pro b/wsjtx.pro index 799546aa6..88e8cc2ff 100644 --- a/wsjtx.pro +++ b/wsjtx.pro @@ -62,9 +62,9 @@ SOURCES += \ Configuration.cpp psk_reporter.cpp AudioDevice.cpp \ Modulator.cpp Detector.cpp logqso.cpp displaytext.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 \ - echoplot.cpp echograph.cpp Modes.cpp WSPRBandHopping.cpp WsprTxScheduler.cpp + echoplot.cpp echograph.cpp Modes.cpp WSPRBandHopping.cpp HEADERS += qt_helpers.hpp \ pimpl_h.hpp pimpl_impl.hpp \