From 68056ae8fafab320b74b24ce80347b855f239ce4 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Fri, 6 Nov 2020 18:28:59 +0000 Subject: [PATCH] Testing options Two new environment variables to control special testing behaviour: * WSJT_TX_BOTH - set to "1" to force transmission on both periods. * WSJT_REVERSE_DOPPLER - set to "1" to transpose Tx and Rx Doppler corrections. Use this to test Doppler tracking on a terrestrial link. --- main.cpp | 5 ++++- widgets/astro.h | 10 ++++++++++ widgets/mainwindow.cpp | 25 ++++++++++++++++++++----- widgets/mainwindow.h | 5 ++++- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index 4c30f615c..dec9ba7de 100644 --- a/main.cpp +++ b/main.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -108,6 +109,8 @@ int main(int argc, char *argv[]) // Multiple instances communicate with jt9 via this QSharedMemory mem_jt9; + auto const env = QProcessEnvironment::systemEnvironment (); + QApplication a(argc, argv); try { @@ -411,7 +414,7 @@ int main(int argc, char *argv[]) } // run the application UI - MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, &splash); + MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, &splash, env); w.show(); splash.raise (); QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit())); diff --git a/widgets/astro.h b/widgets/astro.h index a2474072f..2b544872c 100644 --- a/widgets/astro.h +++ b/widgets/astro.h @@ -2,6 +2,8 @@ #ifndef ASTRO_H #define ASTRO_H +#include + #include #include @@ -34,9 +36,17 @@ public: Correction (Correction const&) = default; Correction& operator = (Correction const&) = default; + // testing facility used to test Doppler corrections on + // terrestrial links + void reverse () + { + std::swap (rx, tx); + } + FrequencyDelta rx; FrequencyDelta tx; }; + Correction astroUpdate(QDateTime const& t, QString const& mygrid, QString const& hisgrid, diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 64f7f4ec4..be5062fa0 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -233,8 +234,9 @@ namespace MainWindow::MainWindow(QDir const& temp_directory, bool multiple, MultiSettings * multi_settings, QSharedMemory *shdmem, unsigned downSampleFactor, - QSplashScreen * splash, QWidget *parent) : + QSplashScreen * splash, QProcessEnvironment const& env, QWidget *parent) : QMainWindow(parent), + m_env {env}, m_network_manager {this}, m_valid {true}, m_splash {splash}, @@ -266,6 +268,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_secBandChanged {0}, m_freqNominal {0}, m_freqTxNominal {0}, + m_reverse_Doppler {"1" == env.value ("WSJT_REVERSE_DOPPLER", "0")}, m_s6 {0.}, m_tRemaining {0.}, m_TRperiod {60.0}, @@ -926,9 +929,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, , "-a", QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath ()) , "-t", QDir::toNativeSeparators (m_config.temp_dir ().absolutePath ()) }; - QProcessEnvironment env {QProcessEnvironment::systemEnvironment ()}; - env.insert ("OMP_STACKSIZE", "4M"); - proc_jt9.setProcessEnvironment (env); + QProcessEnvironment new_env {m_env}; + new_env.insert ("OMP_STACKSIZE", "4M"); + proc_jt9.setProcessEnvironment (new_env); proc_jt9.start(QDir::toNativeSeparators (m_appDir) + QDir::separator () + "jt9", jt9_args, QIODevice::ReadWrite | QIODevice::Unbuffered); @@ -4227,7 +4230,15 @@ void MainWindow::guiUpdate() transmitDisplay (true); statusUpdate (); } - if(!m_btxok && m_btxok0 && g_iptt==1) stopTx(); + if(!m_btxok && m_btxok0 && g_iptt==1) + { + stopTx(); + if ("1" == m_env.value ("WSJT_TX_BOTH", "0")) + { + m_txFirst = !m_txFirst; + ui->txFirstCheckBox->setChecked (m_txFirst); + } + } if(m_startAnother) { if(m_mode=="MSK144") { @@ -8193,6 +8204,10 @@ void MainWindow::astroUpdate () correction.tx = correction.tx / 10 * 10; } m_astroCorrection = correction; + if (m_reverse_Doppler) + { + m_astroCorrection.reverse (); + } } else { diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 7a8537d03..272664e78 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -63,6 +63,7 @@ namespace Ui { class MainWindow; } +class QProcessEnvironment; class QSharedMemory; class QSplashScreen; class QSettings; @@ -103,7 +104,7 @@ public: explicit MainWindow(QDir const& temp_directory, bool multiple, MultiSettings *, QSharedMemory *shdmem, unsigned downSampleFactor, - QSplashScreen *, + QSplashScreen *, QProcessEnvironment const&, QWidget *parent = nullptr); ~MainWindow(); @@ -356,6 +357,7 @@ private: void setColorHighlighting(); void chkFT4(); + QProcessEnvironment const& m_env; NetworkAccessManager m_network_manager; bool m_valid; QSplashScreen * m_splash; @@ -407,6 +409,7 @@ private: Frequency m_freqNominal; Frequency m_freqTxNominal; Astro::Correction m_astroCorrection; + bool m_reverse_Doppler; double m_s6; double m_tRemaining;