Repair a regression with odd/2nd period FT4 decode timestamps

Generalized slow mode decode timestamp generation to a common routine.
This commit is contained in:
Bill Somerville 2020-09-29 12:32:47 +01:00
parent fff5644858
commit 204d63929d
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
2 changed files with 8 additions and 24 deletions

View File

@ -3019,34 +3019,19 @@ void MainWindow::decode() //decode()
if( m_diskData ) {
dec_data.params.lapcqonly=false;
}
m_msec0=QDateTime::currentMSecsSinceEpoch();
if(!m_dataAvailable or m_TRperiod==0.0) return;
ui->DecodeButton->setChecked (true);
if(!dec_data.params.nagain && m_diskData && (m_TRperiod >= 60.0)) {
if(!dec_data.params.nagain && m_diskData && m_TRperiod >= 60.) {
dec_data.params.nutc=dec_data.params.nutc/100;
}
if(dec_data.params.nagain==0 && dec_data.params.newdat==1 && (!m_diskData)) {
qint64 nperiods=now.toMSecsSinceEpoch()/(1000.0*m_TRperiod);
m_dateTimeSeqStart=QDateTime::fromMSecsSinceEpoch(qint64(1000.0*nperiods*m_TRperiod)).toUTC();
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
int imin=ms/60000;
int ihr=imin/60;
imin=imin % 60;
if(m_TRperiod>=60) imin=imin - (imin % (int(m_TRperiod)/60));
dec_data.params.nutc=100*ihr + imin;
if(m_TRperiod < 60) {
qint64 ms=1000.0*(2.0-m_TRperiod);
if(m_mode=="FST4") ms=1000.0*(6.0-m_TRperiod);
//Adjust for FT8 early decode:
if(m_mode=="FT8" and m_ihsym==m_earlyDecode and !m_diskData) ms+=(m_hsymStop-m_earlyDecode)*288;
if(m_mode=="FT8" and m_ihsym==m_earlyDecode2 and !m_diskData) ms+=(m_hsymStop-m_earlyDecode2)*288;
QDateTime t=QDateTime::currentDateTimeUtc().addMSecs(ms);
ihr=t.toString("hh").toInt();
imin=t.toString("mm").toInt();
int isec=t.toString("ss").toInt();
isec=isec - fmod(double(isec),m_TRperiod);
dec_data.params.nutc=10000*ihr + 100*imin + isec;
}
auto t_start = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc (), m_TRperiod * 1.e3);
auto t = t_start.time ();
dec_data.params.nutc = t.hour () * 100 + t.minute ();
if (m_TRperiod < 60.)
{
dec_data.params.nutc = dec_data.params.nutc * 100 + t.second ();
}
}
if(m_nPick==1 and !m_diskData) {

View File

@ -401,7 +401,6 @@ private:
qint64 m_msErase;
qint64 m_secBandChanged;
qint64 m_freqMoon;
qint64 m_msec0;
qint64 m_fullFoxCallTime;
Frequency m_freqNominal;