From 143736129ba451f2f068a88e93b0ad3563139164 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 8 Jun 2016 21:20:58 +0000 Subject: [PATCH] Starting to implement the hooks for interfacing to QRA mode. Pass file path for peg-128 files to fast_decode(). (Inelegant, but it works.) git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6741 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Modes.cpp | 3 ++- Modes.hpp | 1 + lib/fast_decode.f90 | 5 +++- mainwindow.cpp | 66 ++++++++++++++++++++++++++++++++++++--------- mainwindow.h | 5 +++- mainwindow.ui | 9 +++++++ 6 files changed, 74 insertions(+), 15 deletions(-) diff --git a/Modes.cpp b/Modes.cpp index d4c4f84d6..0161b6913 100644 --- a/Modes.cpp +++ b/Modes.cpp @@ -21,7 +21,8 @@ namespace "Echo", "ISCAT", "JTMSK", - "MSK144" + "MSK144", + "QRA" }; std::size_t constexpr mode_names_size = sizeof (mode_names) / sizeof (mode_names[0]); } diff --git a/Modes.hpp b/Modes.hpp index 0dd5b4b46..8a14a098f 100644 --- a/Modes.hpp +++ b/Modes.hpp @@ -48,6 +48,7 @@ public: ISCAT, JTMSK, MSK144, + QRA, MODES_END_SENTINAL_AND_COUNT // this must be last }; Q_ENUM (Mode) diff --git a/lib/fast_decode.f90 b/lib/fast_decode.f90 index 9f5f460b8..6d8aadc8f 100644 --- a/lib/fast_decode.f90 +++ b/lib/fast_decode.f90 @@ -8,9 +8,12 @@ subroutine fast_decode(id2,narg,line) real psavg(450) logical pick character*6 cfile6 - character*80 line(100) + character*80 line(100),pchk_file save npts + pchk_file=line(1) + print*,pchk_file + nutc=narg(0) ndat0=narg(1) nsubmode=narg(2) diff --git a/mainwindow.cpp b/mainwindow.cpp index 03a727f0f..7db43ed35 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -344,6 +344,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->actionISCAT->setActionGroup(modeGroup); ui->actionJTMSK->setActionGroup(modeGroup); ui->actionMSK144->setActionGroup(modeGroup); + ui->actionQRA->setActionGroup(modeGroup); QActionGroup* saveGroup = new QActionGroup(this); ui->actionNone->setActionGroup(saveGroup); @@ -681,7 +682,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_config.transceiver_online (); bool b=m_config.enable_VHF_features() and (m_mode=="JT4" or m_mode=="JT65" or - m_mode=="ISCAT" or m_mode=="JT9" or m_mode=="JTMSK" or m_mode=="MSK144"); + m_mode=="ISCAT" or m_mode=="JT9" or m_mode=="JTMSK" or m_mode=="MSK144" or + m_mode=="QRA"); VHF_controls_visible(b); if(m_mode=="JT4") on_actionJT4_triggered(); @@ -694,7 +696,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, if(m_mode=="ISCAT") on_actionISCAT_triggered(); if(m_mode=="JTMSK") on_actionJTMSK_triggered(); if(m_mode=="MSK144") on_actionMSK144_triggered(); - + if(m_mode=="QRA") on_actionQRA_triggered(); if(m_mode=="Echo") monitor(false); //Don't auto-start Monitor in Echo mode. m_ntx=1; @@ -1199,7 +1201,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog displayDialFrequency (); bool b=m_config.enable_VHF_features() and (m_mode=="JT4" or m_mode=="JT65" or m_mode=="ISCAT" or m_mode=="JT9" or m_mode=="JTMSK" or - m_mode=="MSK144"); + m_mode=="MSK144" or m_mode=="QRA"); VHF_features_enabled(b); VHF_controls_visible(b); } @@ -1880,7 +1882,7 @@ void MainWindow::decode() //decode() dec_data.params.ntxmode=9; if(m_modeTx=="JT65") dec_data.params.ntxmode=65; dec_data.params.nmode=9; - if(m_mode=="JT65") dec_data.params.nmode=65; + if(m_mode=="JT65" or m_mode=="QRA") dec_data.params.nmode=65; if(m_mode=="JT9+JT65") dec_data.params.nmode=9+65; // = 74 if(m_mode=="JT4") { dec_data.params.nmode=4; @@ -1963,9 +1965,18 @@ void MainWindow::decode() //decode() narg[13]=-1; narg[14]=m_config.aggressive(); memcpy(d2b,dec_data.d2,2*360000); -// QString pchk_file = m_config.data_dir().absoluteFilePath("peg-128-80-reg3.pchk"); -// qDebug() << pchk_file << pchk_file.length(); -// Q: How to pass "pchk-file" as a standard string to Fortran routine fast_decode() ?? + +// I'm sure there's a better way to do this... I'm sending the file path to +// fast_decode() as the first word of the m_msg[] array. +//### + QString pchk_file = m_config.data_dir().absoluteFilePath("peg-128-80-reg3.pchk"); + m_ba = pchk_file.toLocal8Bit(); + for(int i=0; i<80; i++) { + m_msg[0][i]=32; + if(isetFuture(*future3); } else { @@ -2074,7 +2085,7 @@ void MainWindow::readFromStdout() //readFromStdout QByteArray t=proc_jt9.readLine(); bool bAvgMsg=false; int navg=0; - if(m_mode=="JT4" or m_mode=="JT65") { + if(m_mode=="JT4" or m_mode=="JT65" or m_mode=="QRA") { int n=t.indexOf("f"); if(n<0) n=t.indexOf("d"); if(n>0) { @@ -2186,7 +2197,7 @@ void MainWindow::readFromStdout() //readFromStdout } } - if((m_mode=="JT4" or m_mode=="JT65") and m_msgAvgWidget!=NULL) { + if((m_mode=="JT4" or m_mode=="JT65" or m_mode=="QRA") and m_msgAvgWidget!=NULL) { if(m_msgAvgWidget->isVisible()) { QFile f(m_config.temp_dir ().absoluteFilePath ("avemsg.txt")); if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -2285,7 +2296,7 @@ void MainWindow::guiUpdate() txDuration=0.0; if(m_modeTx=="JT4") txDuration=1.0 + 207.0*2520/11025.0; // JT4 if(m_modeTx=="JT9") txDuration=1.0 + 85.0*m_nsps/12000.0; // JT9 - if(m_modeTx=="JT65") txDuration=1.0 + 126*4096/11025.0; // JT65 + if(m_modeTx=="JT65" or m_mode=="QRA") txDuration=1.0 + 126*4096/11025.0; // JT65 or QRA if(m_mode=="WSPR-2") txDuration=2.0 + 162*8192/12000.0; // WSPR if(m_mode=="ISCAT" or m_mode=="JTMSK" or m_mode=="MSK144" or m_bFast9) { txDuration=m_TRperiod-0.25; // ISCAT, JT9-fast, JTMSK, MSK144 @@ -2463,6 +2474,11 @@ void MainWindow::guiUpdate() &m_currentMessageType, len1, len1); if(m_modeTx=="JT65") gen65_(message, &ichk, msgsent, const_cast (itone), &m_currentMessageType, len1, len1); +//### +// To be changed! + if(m_modeTx=="QRA") gen65_(message, &ichk, msgsent, const_cast (itone), + &m_currentMessageType, len1, len1); +//### if(m_mode.startsWith ("WSPR")) genwspr_(message, msgsent, const_cast (itone), len1, len1); if(m_modeTx=="JTMSK") genmsk_(message, &ichk, msgsent, const_cast (itone), @@ -2971,7 +2987,8 @@ void MainWindow::processMessage(QString const& messages, int position, bool ctrl m_lockTxFreq or ctrl) { if (ui->TxFreqSpinBox->isEnabled ()) { if(!m_bFastMode) ui->TxFreqSpinBox->setValue(frequency); - } else if(m_mode != "JT4" && m_mode != "JT65" && !m_mode.startsWith ("JT9")) { + } else if(m_mode != "JT4" && m_mode != "JT65" && !m_mode.startsWith ("JT9") && + m_mode != "QRA") { return; } } @@ -3675,6 +3692,20 @@ void MainWindow::on_actionMSK144_triggered() ui->actionMSK144->setChecked(true); } +void MainWindow::on_actionQRA_triggered() +{ + on_actionJT65_triggered(); + m_mode="QRA"; + m_modeTx="QRA"; + ui->actionQRA->setChecked(true); + switch_mode (Modes::QRA); + statusChanged(); + mode_label->setStyleSheet("QLabel{background-color: #99ff33}"); + QString t1=(QString)QChar(short(m_nSubMode+65)); + mode_label->setText(m_mode + " " + t1); +} + + void MainWindow::on_actionJT65_triggered() { if(m_mode=="JT4" or m_mode.startsWith ("WSPR")) { @@ -4552,6 +4583,17 @@ void MainWindow::transmit (double snr) toneSpacing, m_soundOutput, m_config.audio_output_channel (), true, false, snr, m_TRperiod); } + + if (m_modeTx == "QRA") { + if(m_nSubMode==0) toneSpacing=11025.0/4096.0; + if(m_nSubMode==1) toneSpacing=2*11025.0/4096.0; + if(m_nSubMode==2) toneSpacing=4*11025.0/4096.0; + Q_EMIT sendMessage (NUM_QRA_SYMBOLS, + 4096.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT, + toneSpacing, m_soundOutput, m_config.audio_output_channel (), + true, false, snr, m_TRperiod); + } + if (m_modeTx == "JT9") { int nsub=pow(2,m_nSubMode); int nsps[]={480,240,120,60}; @@ -4801,7 +4843,7 @@ void MainWindow::transmitDisplay (bool transmitting) ui->menuMode->setEnabled (!transmitting); //ui->bandComboBox->setEnabled (!transmitting); if (!transmitting) { - if ("JT9+JT65" == m_mode) { + if (m_mode == "JT9+JT65") { // allow mode switch in Rx when in dual mode ui->pbTxMode->setEnabled (true); } diff --git a/mainwindow.h b/mainwindow.h index b759255db..a2d0b47c5 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -39,6 +39,7 @@ #define NUM_ISCAT_SYMBOLS 1291 //30*11025/256 #define NUM_JTMSK_SYMBOLS 234 //(72+15+12)*2 + 3*11 sync + 3 f0-parity #define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80 +#define NUM_QRA_SYMBOLS 126 //63 data + 63 sync #define NUM_CW_SYMBOLS 250 #define TX_SAMPLE_RATE 48000 @@ -244,8 +245,8 @@ private slots: void on_actionJTMSK_triggered(); void on_sbCQRxFreq_valueChanged(int n); void on_cbCQRx_toggled(bool b); - void on_actionMSK144_triggered(); + void on_actionQRA_triggered(); private: Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo, @@ -512,6 +513,8 @@ private: QDateTime m_dateTimeQSO; + QByteArray m_ba; + QSharedMemory *mem_jt9; LogBook m_logBook; DecodedText m_QSOText; diff --git a/mainwindow.ui b/mainwindow.ui index 2b6b0b20e..3087ad13a 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2375,6 +2375,7 @@ QPushButton[state="ok"] { + @@ -2844,6 +2845,14 @@ QPushButton[state="ok"] { MSK144 + + + true + + + QRA + +