From 9caf3b650cc0e764a998d92ad1d8a7fd4b976220 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 25 Jun 2020 17:18:48 -0400 Subject: [PATCH] Correct a number of parameters that control FST280 signal duration and timing. --- Modulator/Modulator.cpp | 27 +++++++++++++++++--------- widgets/mainwindow.cpp | 42 ++++++++++++++++++++++++----------------- widgets/mainwindow.h | 2 +- 3 files changed, 44 insertions(+), 27 deletions(-) diff --git a/Modulator/Modulator.cpp b/Modulator/Modulator.cpp index 6442fd4d9..3a33c42f1 100644 --- a/Modulator/Modulator.cpp +++ b/Modulator/Modulator.cpp @@ -69,13 +69,8 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, m_bFastMode=fastMode; m_TRperiod=TRperiod; unsigned delay_ms=1000; - if(m_nsps==1920) delay_ms=500; //FT8 - if(m_nsps==576) delay_ms=300; //FT4 - if(m_nsps==800) delay_ms=750; //FST280-15 - if(m_nsps==1680) delay_ms=650; //FST280-30 - if(m_nsps==4000) delay_ms=450; //FST280-60 - if(m_nsps==8400) delay_ms=250; //FST280-120 - if(m_nsps==21504) delay_ms=50; //FST280-300 + if(m_nsps==1920) delay_ms=500; //FT8 + if(m_nsps==576) delay_ms=300; //FT4 // noise generator parameters if (m_addNoise) { @@ -89,7 +84,6 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, if(delay_ms > 0 and !m_bFastMode) { m_ic = (mstr/delay_ms) * m_frameRate * delay_ms / 1000; } - if(m_nsps==21504) m_ic=int(0.8*48000); //FST280-300 m_silentFrames = 0; // calculate number of silent frames to send, so that audio will start at @@ -98,9 +92,21 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, if(delay_ms >= mstr) m_silentFrames = m_ic + 0.001*(delay_ms-mstr)*m_frameRate; } -// qDebug() << "aa" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz") + // Special case for FST280: +// qDebug() << "aa" << m_ic << m_silentFrames << m_symbolsLength << m_nsps; + if(m_nsps==800 or m_nsps==1680 or m_nsps==3888 or m_nsps==8200 or m_nsps==21168) { + m_ic = m_ic + 48000 - 2*m_nsps + 9600; //The 9600 is empirical + m_silentFrames = m_silentFrames - 2*m_nsps; + } + if(m_silentFrames<0) { + m_ic = m_ic - m_silentFrames; + m_silentFrames = 0; + } +// qDebug() << "bb" << m_ic << m_silentFrames; +// qDebug() << "cc" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz") // << delay_ms << mstr << m_silentFrames << m_ic; + initialize (QIODevice::ReadOnly, channel); Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ? Synchronizing : Active)); @@ -317,6 +323,9 @@ qint64 Modulator::readData (char * data, qint64 maxSize) ++m_ic; } +// qDebug() << "dd" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz") +// << m_ic << m_amp << foxcom_.wave[m_ic]; + if (m_amp == 0.0) { // TODO G4WJS: compare double with zero might not be wise if (icw[0] == 0) { // no CW ID to send diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 84eab0715..4ac9f485c 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1342,11 +1342,18 @@ void MainWindow::fixStop() } else if (m_mode=="FT4") { m_hsymStop=21; } else if(m_mode=="FST280" or m_mode=="FST280W") { - if(m_TRperiod==15) m_hsymStop=51; - if(m_TRperiod==30) m_hsymStop=95; - if(m_TRperiod==60) m_hsymStop=205; - if(m_TRperiod==120) m_hsymStop=414; - if(m_TRperiod==300) m_hsymStop=1036; + int stop[] = {45,87,192,397,1012}; + int stop_EME[] = {51,96,201,406,1021}; + int i=0; + if(m_TRperiod==30) i=1; + if(m_TRperiod==60) i=2; + if(m_TRperiod==120) i=3; + if(m_TRperiod==300) i=4; + if(m_config.decode_at_52s()) { + m_hsymStop=stop_EME[i]; + } else { + m_hsymStop=stop[i]; + } } } @@ -3531,11 +3538,11 @@ void MainWindow::guiUpdate() if(m_modeTx=="QRA64") txDuration=1.0 + 84*6912/12000.0; // QRA64 if(m_modeTx=="WSPR") txDuration=2.0 + 162*8192/12000.0; // WSPR if(m_modeTx=="FST280" or m_mode=="FST280W") { //FST280, FST280W - if(m_TRperiod==15) txDuration=1.0 + 164*800/12000.0; - if(m_TRperiod==30) txDuration=1.0 + 164*1680/12000.0; - if(m_TRperiod==60) txDuration=1.0 + 164*4000/12000.0; - if(m_TRperiod==120) txDuration=1.0 + 164*8400/12000.0; - if(m_TRperiod==300) txDuration=1.0 + 164*2150500/12000.0; + if(m_TRperiod==15) txDuration=1.0 + 166*800/12000.0; + if(m_TRperiod==30) txDuration=1.0 + 166*1680/12000.0; + if(m_TRperiod==60) txDuration=1.0 + 166*3888/12000.0; + if(m_TRperiod==120) txDuration=1.0 + 166*8200/12000.0; + if(m_TRperiod==300) txDuration=1.0 + 166*21168/12000.0; } if(m_modeTx=="ISCAT" or m_mode=="MSK144" or m_bFast9) { txDuration=m_TRperiod-0.25; // ISCAT, JT9-fast, MSK144 @@ -3877,15 +3884,16 @@ void MainWindow::guiUpdate() int hmod=int(pow(2.0,double(m_nSubMode))); int nsps=800; if(m_TRperiod==30) nsps=1680; - if(m_TRperiod==60) nsps=4000; - if(m_TRperiod==120) nsps=8400; - if(m_TRperiod==300) nsps=21504; + if(m_TRperiod==60) nsps=3888; + if(m_TRperiod==120) nsps=8200; + if(m_TRperiod==300) nsps=21168; nsps=4*nsps; //48000 Hz sampling int nsym=164; float fsample=48000.0; float dfreq=hmod*fsample/nsps; float f0=ui->TxFreqSpinBox->value() - m_XIT + 1.5*dfreq; - int nwave=(nsym+2)*nsps; +// int nwave=(nsym+2)*nsps; + int nwave=48000 + 166*nsps; int icmplx=0; gen_fst280wave_(const_cast(itone),&nsym,&nsps,&nwave, &fsample,&hmod,&f0,&icmplx,foxcom_.wave,foxcom_.wave); @@ -7160,9 +7168,9 @@ void MainWindow::transmit (double snr) toneSpacing=-2.0; //Transmit a pre-computed, filtered waveform. int nsps=800; if(m_TRperiod==30) nsps=1680; - if(m_TRperiod==60) nsps=4000; - if(m_TRperiod==120) nsps=8400; - if(m_TRperiod==300) nsps=21504; + if(m_TRperiod==60) nsps=3888; + if(m_TRperiod==120) nsps=8200; + if(m_TRperiod==300) nsps=21168; int hmod=int(pow(2.0,double(m_nSubMode))); double dfreq=hmod*12000.0/nsps; double f0=ui->TxFreqSpinBox->value() - m_XIT + 1.5*dfreq; diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 51a935c93..b342850bd 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -49,7 +49,7 @@ #define NUM_QRA64_SYMBOLS 84 //63 data + 21 sync #define NUM_FT8_SYMBOLS 79 #define NUM_FT4_SYMBOLS 105 -#define NUM_FST280_SYMBOLS 164 //280/2 data + 6*4 sync +#define NUM_FST280_SYMBOLS 166 //280/2 data + 6*4 sync + 2 ramp #define NUM_CW_SYMBOLS 250 #define TX_SAMPLE_RATE 48000 #define N_WIDGETS 33