Experiments in computing and setting drift automatically
This commit is contained in:
parent
4b36884abb
commit
e87704f119
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
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=32) ! 50 Hz 6.250 baud 16 wpm -25.0dB (1.0Eb/N0) 12.64s
|
parameter (NSPS=1920, NTXDUR=15, NDOWNSPS=32, NDD=100, JZ=36) ! 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
|
||||||
|
@ -225,7 +225,7 @@ subroutine js8dec(dd0,icos,newdat,synconly,nQSOProgress,nfqso,nftx,ndepth,lapon,
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if(synconly) then
|
if(synconly) then
|
||||||
write(*,*) '<DecodeDebug> candidate X ', 'f', f1, 'sync', nsync, 'xdt', xdt
|
write(*,*) '<DecodeDebug> candidate X ', 'f1', f1, 'sync', nsync, 'xdt', xdt
|
||||||
flush(6)
|
flush(6)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -424,9 +424,8 @@ subroutine js8dec(dd0,icos,newdat,synconly,nQSOProgress,nfqso,nftx,ndepth,lapon,
|
|||||||
if(nbadcrc.eq.0) then
|
if(nbadcrc.eq.0) then
|
||||||
|
|
||||||
if(synconly) then
|
if(synconly) then
|
||||||
write(*,*) '<DecodeDebug> decode X ', 'f1', f1, 'sync', sync, 'xdt', xdt2
|
write(*,*) '<DecodeDebug> decode X ', 'f1', f1, 'sync', (sync*10), 'xdt', xdt2
|
||||||
flush(6)
|
flush(6)
|
||||||
return
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
decoded0=decoded
|
decoded0=decoded
|
||||||
|
@ -4872,6 +4872,10 @@ void MainWindow::processDecodedLine(QByteArray t){
|
|||||||
|
|
||||||
bool bAvgMsg=false;
|
bool bAvgMsg=false;
|
||||||
int navg=0;
|
int navg=0;
|
||||||
|
|
||||||
|
static bool hasNewDrift = false;
|
||||||
|
static int newDrift = 0;
|
||||||
|
|
||||||
if(t.indexOf("<DecodeDebug>") >= 0) {
|
if(t.indexOf("<DecodeDebug>") >= 0) {
|
||||||
if(t.indexOf("f1") >= 0){
|
if(t.indexOf("f1") >= 0){
|
||||||
auto segs = QString(t.trimmed()).split(QRegExp("[\\s\\t]+"), QString::SkipEmptyParts);
|
auto segs = QString(t.trimmed()).split(QRegExp("[\\s\\t]+"), QString::SkipEmptyParts);
|
||||||
@ -4885,37 +4889,36 @@ void MainWindow::processDecodedLine(QByteArray t){
|
|||||||
auto xdt1 = QString(segs.at(8));
|
auto xdt1 = QString(segs.at(8));
|
||||||
auto xdt = int(xdt1.toFloat());
|
auto xdt = int(xdt1.toFloat());
|
||||||
|
|
||||||
if(abs(xdt) <= 1.28){
|
if(abs(xdt) <= 2){
|
||||||
//if(s > 7 && s < 10){
|
if(s < 10){
|
||||||
// m_wideGraph->drawLine(QColor(Qt::white), f, f + computeBandwidthForSubmode(m_nSubMode));
|
m_wideGraph->drawLine(QColor(Qt::darkCyan), f, f + computeBandwidthForSubmode(m_nSubMode));
|
||||||
//} else if (s < 15){
|
} else if (s <= 21){
|
||||||
// m_wideGraph->drawLine(QColor(Qt::darkMagenta), f, f + computeBandwidthForSubmode(m_nSubMode));
|
m_wideGraph->drawLine(QColor(Qt::white), f, f + computeBandwidthForSubmode(m_nSubMode));
|
||||||
//} else {
|
}
|
||||||
/*
|
}
|
||||||
int secs = DriftingDateTime::currentDateTimeUtc().secsTo(nextTransmitCycle());
|
|
||||||
int txtime = computeFramesNeededForDecode(m_nSubMode)/RX_SAMPLE_RATE;
|
if(t.contains("decode X")){
|
||||||
qDebug() << "seconds til transmit" << secs << "time offset" << xdt << "potential drift" << (secs-xdt)*1000;
|
|
||||||
setDrift((secs+xdt-txtime)*1000);
|
|
||||||
*/
|
|
||||||
auto now = QDateTime::currentDateTimeUtc();
|
auto now = QDateTime::currentDateTimeUtc();
|
||||||
|
|
||||||
int n = 0;
|
float n = 0;
|
||||||
int nPos = m_TRperiod - (now.time().second() % m_TRperiod);
|
float nPos = m_TRperiod - (now.time().second() % m_TRperiod);
|
||||||
int nNeg = (now.time().second() % m_TRperiod) - m_TRperiod;
|
float nNeg = (now.time().second() % m_TRperiod) - m_TRperiod;
|
||||||
|
float offset = m_TRperiod - computeFramesNeededForDecode(m_nSubMode)/RX_SAMPLE_RATE + xdt;
|
||||||
|
|
||||||
if(abs(nNeg) < nPos){
|
if(qAbs(nNeg) < nPos){
|
||||||
n = nNeg;
|
n = nNeg + offset;
|
||||||
} else {
|
} else {
|
||||||
n = nPos;
|
n = nPos - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int xdtmin = qMin(n*1000, (float)DriftingDateTime::drift());
|
||||||
|
int xdtmax = qMax(n*1000, (float)DriftingDateTime::drift());
|
||||||
|
|
||||||
int xdtmin = qMin(n*1000, (int)DriftingDateTime::drift());
|
m_wideGraph->drawLine(QColor(Qt::red), f, f + computeBandwidthForSubmode(m_nSubMode));
|
||||||
int xdtmax = qMax(n*1000, (int)DriftingDateTime::drift());
|
int oldNewDrift = newDrift;
|
||||||
setDrift(xdtmin + (xdtmax-xdtmin)/2);
|
newDrift = (xdtmin + (xdtmax-xdtmin)/2);
|
||||||
|
newDrift = qMin(oldNewDrift, newDrift) + (qMax(oldNewDrift, newDrift)-qMin(oldNewDrift, newDrift))/2;
|
||||||
m_wideGraph->drawLine(QColor(Qt::red), f, f + computeBandwidthForSubmode(m_nSubMode));
|
hasNewDrift = true;
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4931,6 +4934,14 @@ void MainWindow::processDecodedLine(QByteArray t){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(t.indexOf("<DecodeFinished>") >= 0) {
|
if(t.indexOf("<DecodeFinished>") >= 0) {
|
||||||
|
|
||||||
|
if(hasNewDrift){
|
||||||
|
int oldDrift = DriftingDateTime::drift();
|
||||||
|
newDrift = qMin(oldDrift, newDrift) + (qMax(oldDrift, newDrift)-qMin(oldDrift, newDrift))/2;
|
||||||
|
setDrift(newDrift);
|
||||||
|
hasNewDrift = false;
|
||||||
|
}
|
||||||
|
|
||||||
m_bDecoded = t.mid(16).trimmed().toInt() > 0;
|
m_bDecoded = t.mid(16).trimmed().toInt() > 0;
|
||||||
int mswait=3*1000*m_TRperiod/4;
|
int mswait=3*1000*m_TRperiod/4;
|
||||||
if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period
|
if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period
|
||||||
|
Loading…
Reference in New Issue
Block a user