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
This commit is contained in:
Joe Taylor 2016-06-08 21:20:58 +00:00
parent ecd36a33b5
commit 143736129b
6 changed files with 74 additions and 15 deletions

View File

@ -21,7 +21,8 @@ namespace
"Echo", "Echo",
"ISCAT", "ISCAT",
"JTMSK", "JTMSK",
"MSK144" "MSK144",
"QRA"
}; };
std::size_t constexpr mode_names_size = sizeof (mode_names) / sizeof (mode_names[0]); std::size_t constexpr mode_names_size = sizeof (mode_names) / sizeof (mode_names[0]);
} }

View File

@ -48,6 +48,7 @@ public:
ISCAT, ISCAT,
JTMSK, JTMSK,
MSK144, MSK144,
QRA,
MODES_END_SENTINAL_AND_COUNT // this must be last MODES_END_SENTINAL_AND_COUNT // this must be last
}; };
Q_ENUM (Mode) Q_ENUM (Mode)

View File

@ -8,9 +8,12 @@ subroutine fast_decode(id2,narg,line)
real psavg(450) real psavg(450)
logical pick logical pick
character*6 cfile6 character*6 cfile6
character*80 line(100) character*80 line(100),pchk_file
save npts save npts
pchk_file=line(1)
print*,pchk_file
nutc=narg(0) nutc=narg(0)
ndat0=narg(1) ndat0=narg(1)
nsubmode=narg(2) nsubmode=narg(2)

View File

@ -344,6 +344,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
ui->actionISCAT->setActionGroup(modeGroup); ui->actionISCAT->setActionGroup(modeGroup);
ui->actionJTMSK->setActionGroup(modeGroup); ui->actionJTMSK->setActionGroup(modeGroup);
ui->actionMSK144->setActionGroup(modeGroup); ui->actionMSK144->setActionGroup(modeGroup);
ui->actionQRA->setActionGroup(modeGroup);
QActionGroup* saveGroup = new QActionGroup(this); QActionGroup* saveGroup = new QActionGroup(this);
ui->actionNone->setActionGroup(saveGroup); ui->actionNone->setActionGroup(saveGroup);
@ -681,7 +682,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
m_config.transceiver_online (); m_config.transceiver_online ();
bool b=m_config.enable_VHF_features() and (m_mode=="JT4" or m_mode=="JT65" or 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); VHF_controls_visible(b);
if(m_mode=="JT4") on_actionJT4_triggered(); 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=="ISCAT") on_actionISCAT_triggered();
if(m_mode=="JTMSK") on_actionJTMSK_triggered(); if(m_mode=="JTMSK") on_actionJTMSK_triggered();
if(m_mode=="MSK144") on_actionMSK144_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. if(m_mode=="Echo") monitor(false); //Don't auto-start Monitor in Echo mode.
m_ntx=1; m_ntx=1;
@ -1199,7 +1201,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
displayDialFrequency (); displayDialFrequency ();
bool b=m_config.enable_VHF_features() and (m_mode=="JT4" or m_mode=="JT65" or 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=="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_features_enabled(b);
VHF_controls_visible(b); VHF_controls_visible(b);
} }
@ -1880,7 +1882,7 @@ void MainWindow::decode() //decode()
dec_data.params.ntxmode=9; dec_data.params.ntxmode=9;
if(m_modeTx=="JT65") dec_data.params.ntxmode=65; if(m_modeTx=="JT65") dec_data.params.ntxmode=65;
dec_data.params.nmode=9; 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=="JT9+JT65") dec_data.params.nmode=9+65; // = 74
if(m_mode=="JT4") { if(m_mode=="JT4") {
dec_data.params.nmode=4; dec_data.params.nmode=4;
@ -1963,9 +1965,18 @@ void MainWindow::decode() //decode()
narg[13]=-1; narg[13]=-1;
narg[14]=m_config.aggressive(); narg[14]=m_config.aggressive();
memcpy(d2b,dec_data.d2,2*360000); 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(); // I'm sure there's a better way to do this... I'm sending the file path to
// Q: How to pass "pchk-file" as a standard string to Fortran routine fast_decode() ?? // 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(i<pchk_file.length()) m_msg[0][i]=m_ba[i];
}
//###
*future3 = QtConcurrent::run(fast_decode_,&d2b[0],&narg[0],&m_msg[0][0],80); *future3 = QtConcurrent::run(fast_decode_,&d2b[0],&narg[0],&m_msg[0][0],80);
watcher3->setFuture(*future3); watcher3->setFuture(*future3);
} else { } else {
@ -2074,7 +2085,7 @@ void MainWindow::readFromStdout() //readFromStdout
QByteArray t=proc_jt9.readLine(); QByteArray t=proc_jt9.readLine();
bool bAvgMsg=false; bool bAvgMsg=false;
int navg=0; 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"); int n=t.indexOf("f");
if(n<0) n=t.indexOf("d"); if(n<0) n=t.indexOf("d");
if(n>0) { 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()) { if(m_msgAvgWidget->isVisible()) {
QFile f(m_config.temp_dir ().absoluteFilePath ("avemsg.txt")); QFile f(m_config.temp_dir ().absoluteFilePath ("avemsg.txt"));
if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { if(f.open(QIODevice::ReadOnly | QIODevice::Text)) {
@ -2285,7 +2296,7 @@ void MainWindow::guiUpdate()
txDuration=0.0; txDuration=0.0;
if(m_modeTx=="JT4") txDuration=1.0 + 207.0*2520/11025.0; // JT4 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=="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=="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) { 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 txDuration=m_TRperiod-0.25; // ISCAT, JT9-fast, JTMSK, MSK144
@ -2463,6 +2474,11 @@ void MainWindow::guiUpdate()
&m_currentMessageType, len1, len1); &m_currentMessageType, len1, len1);
if(m_modeTx=="JT65") gen65_(message, &ichk, msgsent, const_cast<int *> (itone), if(m_modeTx=="JT65") gen65_(message, &ichk, msgsent, const_cast<int *> (itone),
&m_currentMessageType, len1, len1); &m_currentMessageType, len1, len1);
//###
// To be changed!
if(m_modeTx=="QRA") gen65_(message, &ichk, msgsent, const_cast<int *> (itone),
&m_currentMessageType, len1, len1);
//###
if(m_mode.startsWith ("WSPR")) genwspr_(message, msgsent, const_cast<int *> (itone), if(m_mode.startsWith ("WSPR")) genwspr_(message, msgsent, const_cast<int *> (itone),
len1, len1); len1, len1);
if(m_modeTx=="JTMSK") genmsk_(message, &ichk, msgsent, const_cast<int *> (itone), if(m_modeTx=="JTMSK") genmsk_(message, &ichk, msgsent, const_cast<int *> (itone),
@ -2971,7 +2987,8 @@ void MainWindow::processMessage(QString const& messages, int position, bool ctrl
m_lockTxFreq or ctrl) { m_lockTxFreq or ctrl) {
if (ui->TxFreqSpinBox->isEnabled ()) { if (ui->TxFreqSpinBox->isEnabled ()) {
if(!m_bFastMode) ui->TxFreqSpinBox->setValue(frequency); 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; return;
} }
} }
@ -3675,6 +3692,20 @@ void MainWindow::on_actionMSK144_triggered()
ui->actionMSK144->setChecked(true); 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() void MainWindow::on_actionJT65_triggered()
{ {
if(m_mode=="JT4" or m_mode.startsWith ("WSPR")) { 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 (), toneSpacing, m_soundOutput, m_config.audio_output_channel (),
true, false, snr, m_TRperiod); 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") { if (m_modeTx == "JT9") {
int nsub=pow(2,m_nSubMode); int nsub=pow(2,m_nSubMode);
int nsps[]={480,240,120,60}; int nsps[]={480,240,120,60};
@ -4801,7 +4843,7 @@ void MainWindow::transmitDisplay (bool transmitting)
ui->menuMode->setEnabled (!transmitting); ui->menuMode->setEnabled (!transmitting);
//ui->bandComboBox->setEnabled (!transmitting); //ui->bandComboBox->setEnabled (!transmitting);
if (!transmitting) { if (!transmitting) {
if ("JT9+JT65" == m_mode) { if (m_mode == "JT9+JT65") {
// allow mode switch in Rx when in dual mode // allow mode switch in Rx when in dual mode
ui->pbTxMode->setEnabled (true); ui->pbTxMode->setEnabled (true);
} }

View File

@ -39,6 +39,7 @@
#define NUM_ISCAT_SYMBOLS 1291 //30*11025/256 #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_JTMSK_SYMBOLS 234 //(72+15+12)*2 + 3*11 sync + 3 f0-parity
#define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80 #define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80
#define NUM_QRA_SYMBOLS 126 //63 data + 63 sync
#define NUM_CW_SYMBOLS 250 #define NUM_CW_SYMBOLS 250
#define TX_SAMPLE_RATE 48000 #define TX_SAMPLE_RATE 48000
@ -244,8 +245,8 @@ private slots:
void on_actionJTMSK_triggered(); void on_actionJTMSK_triggered();
void on_sbCQRxFreq_valueChanged(int n); void on_sbCQRxFreq_valueChanged(int n);
void on_cbCQRx_toggled(bool b); void on_cbCQRx_toggled(bool b);
void on_actionMSK144_triggered(); void on_actionMSK144_triggered();
void on_actionQRA_triggered();
private: private:
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo, Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
@ -512,6 +513,8 @@ private:
QDateTime m_dateTimeQSO; QDateTime m_dateTimeQSO;
QByteArray m_ba;
QSharedMemory *mem_jt9; QSharedMemory *mem_jt9;
LogBook m_logBook; LogBook m_logBook;
DecodedText m_QSOText; DecodedText m_QSOText;

View File

@ -2375,6 +2375,7 @@ QPushButton[state=&quot;ok&quot;] {
<addaction name="actionISCAT"/> <addaction name="actionISCAT"/>
<addaction name="actionJTMSK"/> <addaction name="actionJTMSK"/>
<addaction name="actionMSK144"/> <addaction name="actionMSK144"/>
<addaction name="actionQRA"/>
</widget> </widget>
<widget class="QMenu" name="menuConfig"> <widget class="QMenu" name="menuConfig">
<property name="title"> <property name="title">
@ -2844,6 +2845,14 @@ QPushButton[state=&quot;ok&quot;] {
<string>MSK144</string> <string>MSK144</string>
</property> </property>
</action> </action>
<action name="actionQRA">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>QRA</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>