Working sync via 1 second timing for A mode only

This commit is contained in:
Jordan Sherer 2020-05-09 11:36:09 -04:00
parent 45c1d14112
commit 0887f12e8c
2 changed files with 27 additions and 27 deletions

View File

@ -3,7 +3,7 @@
parameter (NSUBMODE=0) parameter (NSUBMODE=0)
parameter (NCOSTAS=1) !Which JS8 Costas Arrays to use (1=original, 2=three symmetrical costas) parameter (NCOSTAS=1) !Which JS8 Costas Arrays to use (1=original, 2=three symmetrical costas)
parameter (NSPS=1920, NTXDUR=15, NDOWNSPS=32, NDD=100, JZ=62) ! 50 Hz 6.250 baud 16 wpm -25.0dB (1.0Eb/N0) 12.64s parameter (NSPS=1920, NTXDUR=15, NDOWNSPS=32, NDD=100, JZ=26) ! 50 Hz 6.250 baud 16 wpm -25.0dB (1.0Eb/N0) 12.64s
parameter (AZ=12000.0/(1.0*NSPS)*0.64d0) !Dedupe overlap in Hz parameter (AZ=12000.0/(1.0*NSPS)*0.64d0) !Dedupe overlap in Hz
parameter (ASTART=0.5) !Start delay in seconds parameter (ASTART=0.5) !Start delay in seconds

View File

@ -4340,7 +4340,9 @@ bool MainWindow::decodeEnqueueReady(qint32 k, qint32 k0){
int decodes = 0; int decodes = 0;
// when no other mode is being decoded, do a sync stats decode for normal mode // when no other mode is being decoded, do a sync stats decode for normal mode
if(!couldDecodeA && !couldDecodeB && !couldDecodeC && !couldDecodeE){ bool experiment = true;
if(experiment){
static qint32 lastDecodeStartA = -1; static qint32 lastDecodeStartA = -1;
qint32 oneSecondFramesA = computeFramesPerCycleForDecode(Varicode::JS8CallNormal)/computePeriodForSubmode(Varicode::JS8CallNormal); qint32 oneSecondFramesA = computeFramesPerCycleForDecode(Varicode::JS8CallNormal)/computePeriodForSubmode(Varicode::JS8CallNormal);
if(lastDecodeStartA == -1 || k < k0 || k - lastDecodeStartA > oneSecondFramesA){ if(lastDecodeStartA == -1 || k < k0 || k - lastDecodeStartA > oneSecondFramesA){
@ -4356,6 +4358,8 @@ bool MainWindow::decodeEnqueueReady(qint32 k, qint32 k0){
couldDecodeA = true; couldDecodeA = true;
} }
couldDecodeB = couldDecodeC = couldDecodeE = false;
#if 0 #if 0
static qint32 lastDecodeStartB = -1; static qint32 lastDecodeStartB = -1;
qint32 oneSecondFramesB = computeFramesPerCycleForDecode(Varicode::JS8CallFast)/computePeriodForSubmode(Varicode::JS8CallFast); qint32 oneSecondFramesB = computeFramesPerCycleForDecode(Varicode::JS8CallFast)/computePeriodForSubmode(Varicode::JS8CallFast);
@ -4492,7 +4496,7 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
QMutexLocker mutex(m_detector->getMutex()); QMutexLocker mutex(m_detector->getMutex());
if(m_decoderBusy){ if(m_decoderBusy){
int seconds = m_decoderBusyStartTime.secsTo(DriftingDateTime::currentDateTimeUtc()); int seconds = m_decoderBusyStartTime.secsTo(QDateTime::currentDateTimeUtc());
if(seconds > 60){ if(seconds > 60){
if(JS8_DEBUG_DECODE) qDebug() << "--> decoder should be killed!" << QString("(%1 seconds)").arg(seconds); if(JS8_DEBUG_DECODE) qDebug() << "--> decoder should be killed!" << QString("(%1 seconds)").arg(seconds);
} else if(seconds > 30){ } else if(seconds > 30){
@ -4761,7 +4765,7 @@ void MainWindow::decodeBusy(bool b) //decodeBusy()
m_decoderBusy=b; m_decoderBusy=b;
if(m_decoderBusy){ if(m_decoderBusy){
tx_status_label.setText("Decoding"); tx_status_label.setText("Decoding");
m_decoderBusyStartTime = DriftingDateTime::currentDateTimeUtc(); m_decoderBusyStartTime = QDateTime::currentDateTimeUtc(); //DriftingDateTime::currentDateTimeUtc();
m_decoderBusyFreq = dialFrequency(); m_decoderBusyFreq = dialFrequency();
m_decoderBusyBand = m_config.bands()->find (m_decoderBusyFreq); m_decoderBusyBand = m_config.bands()->find (m_decoderBusyFreq);
} }
@ -4844,7 +4848,7 @@ void MainWindow::decodeCheckHangingDecoder(){
return; return;
} }
if(!m_decoderBusyStartTime.isValid() || m_decoderBusyStartTime.secsTo(DriftingDateTime::currentDateTimeUtc()) < 60){ if(!m_decoderBusyStartTime.isValid() || m_decoderBusyStartTime.secsTo(QDateTime::currentDateTimeUtc()) < 60){
return; return;
} }
@ -4975,37 +4979,27 @@ void MainWindow::processDecodedLine(QByteArray t){
// draw decodes // draw decodes
m_wideGraph->drawLine(QColor(Qt::red), f, f + computeBandwidthForSubmode(m)); m_wideGraph->drawLine(QColor(Qt::red), f, f + computeBandwidthForSubmode(m));
#if 0 #if 1
// but use decodes for drift // use normal decodes for auto drift if we haven't already defined a new drift for this period
if(m == Varicode::JS8CallNormal){ if(/*!hasNewDrift && */ (m == Varicode::JS8CallSlow || m == Varicode::JS8CallNormal)){
auto now = QDateTime::currentDateTimeUtc(); auto now = QDateTime::currentDateTimeUtc();
float n = 0; float n = 0;
float nPos = period - ((now.time().second()) % period);
float nNeg = ((now.time().second()) % period) - period; float nNeg = ((now.time().second()) % period) - period;
float nPos = period - ((now.time().second()) % period);
if(qAbs(nNeg) < nPos){ if(qAbs(nNeg) < nPos){
n = nNeg; n = nNeg + 1;
} else { } else {
n = nPos; n = nPos - 1;
} }
int offset = period - computeFramesNeededForDecode(m)/RX_SAMPLE_RATE; // subtract to the previous period
n -= offset; n -= (float)period;
n -= xdt-1.0;
//n += period; // subtract the actual tx duration
// n -= computeFramesNeededForDecode(m)/RX_SAMPLE_RATE; n += computeFramesNeededForDecode(m)/RX_SAMPLE_RATE;
// n += xdt;
//// // auto now = QDateTime::currentDateTimeUtc(); // subtract the time delta
//// // float n = 0; n -= xdt;
//// // float s = now.time().second() + now.time().msec()/1000.0;
//// //
//// // if(s < 30){
//// // n = -s;
//// // } else {
//// // n = 60 - s;
//// // }
int xdtmin = qMin(n*1000, (float)DriftingDateTime::drift()); int xdtmin = qMin(n*1000, (float)DriftingDateTime::drift());
int xdtmax = qMax(n*1000, (float)DriftingDateTime::drift()); int xdtmax = qMax(n*1000, (float)DriftingDateTime::drift());
@ -5032,6 +5026,12 @@ void MainWindow::processDecodedLine(QByteArray t){
} }
if(t.indexOf("<DecodeFinished>") >= 0) { if(t.indexOf("<DecodeFinished>") >= 0) {
int msec = m_decoderBusyStartTime.msecsTo(QDateTime::currentDateTimeUtc());
qDebug() << "Decoder Duration:" << msec;
if(msec >= 1000){
writeNoticeTextToUI(QDateTime::currentDateTimeUtc(), QString("Decoder Duration: %1").arg(msec));
}
// TODO: decide if we should adjust here... // TODO: decide if we should adjust here...
if(hasNewDrift){ if(hasNewDrift){
static int driftN = 1; static int driftN = 1;