Fixed a few auto drift bugs
This commit is contained in:
parent
b6fc45b645
commit
f4ae053137
2
INSTALL
2
INSTALL
@ -28,7 +28,7 @@ JS8Call depends on:
|
||||
|
||||
#### 18.04 LTS:
|
||||
|
||||
sudo apt install build-essential git automake cmake clang gfortran libfftw3-dev git libgfortran3 libusb-1.0-dev autoconf libtool texinfo qt5-default qtmultimedia5-dev libqt5multimedia5-plugins libqt5serialport5-dev libudev-dev pkg-config
|
||||
sudo apt install build-essential git automake cmake clang gfortran libfftw3-dev git libgfortran5 libusb-1.0-0-dev autoconf libtool texinfo qt5-default qtmultimedia5-dev libqt5multimedia5-plugins libqt5serialport5-dev libudev-dev pkg-config
|
||||
|
||||
#### 20.04 LTS:
|
||||
|
||||
|
@ -450,7 +450,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
m_hbPaused { false },
|
||||
m_hbInterval {0},
|
||||
m_cqInterval {0},
|
||||
m_cqPaused { false }
|
||||
m_cqPaused { false },
|
||||
m_driftMsMMA { 0 },
|
||||
m_driftMsMMA_N { 0 }
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -5049,7 +5051,7 @@ void MainWindow::processDecodedLine(QByteArray t){
|
||||
bool bAvgMsg=false;
|
||||
int navg=0;
|
||||
|
||||
static QList<int> driftQueue;
|
||||
static QList<qint32> driftQueue;
|
||||
|
||||
static qint32 syncStart = -1;
|
||||
if(t.indexOf("<DecodeSyncMeta> sync start") >= 0){
|
||||
@ -5138,15 +5140,22 @@ void MainWindow::processDecodedLine(QByteArray t){
|
||||
m_wideGraph->notifyDriftedSignalsDecoded(driftQueue.count());
|
||||
|
||||
while(!driftQueue.isEmpty()){
|
||||
int newDrift = driftQueue.first();
|
||||
qint32 newDrift = driftQueue.first();
|
||||
driftQueue.removeFirst();
|
||||
|
||||
m_driftMsMMA = ((m_driftMsMMA_N-1)*m_driftMsMMA + newDrift)/m_driftMsMMA_N;
|
||||
m_driftMsMMA = (((m_driftMsMMA_N-1) * m_driftMsMMA) + newDrift) / m_driftMsMMA_N;
|
||||
if(m_driftMsMMA_N < 60) m_driftMsMMA_N++; // cap it to 60 observations
|
||||
}
|
||||
|
||||
setDrift(m_driftMsMMA);
|
||||
qint32 driftLimitMs = computePeriodForSubmode(Varicode::JS8CallNormal) * 1000;
|
||||
qint32 newDriftMs = m_driftMsMMA;
|
||||
if(newDriftMs < 0){
|
||||
newDriftMs = -((-newDriftMs) % driftLimitMs);
|
||||
} else {
|
||||
newDriftMs = ((newDriftMs) % driftLimitMs);
|
||||
}
|
||||
|
||||
setDrift(m_driftMsMMA);
|
||||
//writeNoticeTextToUI(QDateTime::currentDateTimeUtc(), QString("Automatic Drift: %1").arg(driftAvg));
|
||||
}
|
||||
|
||||
@ -5231,7 +5240,7 @@ void MainWindow::processDecodedLine(QByteArray t){
|
||||
// 3) compute the delta
|
||||
// 4) apply the drift
|
||||
|
||||
int periodMs = 1000 * computePeriodForSubmode(m);
|
||||
qint32 periodMs = 1000 * computePeriodForSubmode(m);
|
||||
|
||||
//writeNoticeTextToUI(now, QString("Decode at %1 (kin: %2, lastDecoded: %3)").arg(syncStart).arg(dec_data.params.kin).arg(m_lastDecodeStartMap.value(m)));
|
||||
|
||||
@ -5258,9 +5267,9 @@ void MainWindow::processDecodedLine(QByteArray t){
|
||||
|
||||
//writeNoticeTextToUI(now, QString("--> so signal adjusted started at %1 seconds into the start of my drifted minute").arg(decodedSignalTime));
|
||||
|
||||
int decodedSignalTimeMs = 1000 * decodedSignalTime;
|
||||
int cycleStartTimeMs = (decodedSignalTimeMs / periodMs) * periodMs;
|
||||
int driftMs = cycleStartTimeMs - decodedSignalTimeMs;
|
||||
qint32 decodedSignalTimeMs = 1000 * decodedSignalTime;
|
||||
qint32 cycleStartTimeMs = (decodedSignalTimeMs / periodMs) * periodMs;
|
||||
qint32 driftMs = cycleStartTimeMs - decodedSignalTimeMs;
|
||||
|
||||
//writeNoticeTextToUI(now, QString("--> which is a drift adjustment of %1 milliseconds").arg(driftMs));
|
||||
|
||||
@ -5275,7 +5284,7 @@ void MainWindow::processDecodedLine(QByteArray t){
|
||||
|
||||
//writeNoticeTextToUI(now, QString("--> which is a corrected drift adjustment of %1 milliseconds").arg(driftMs));
|
||||
|
||||
int newDrift = DriftingDateTime::drift() + driftMs;
|
||||
qint32 newDrift = DriftingDateTime::drift() + driftMs;
|
||||
if(newDrift < 0){
|
||||
newDrift %= -periodMs;
|
||||
} else {
|
||||
@ -10958,7 +10967,7 @@ void MainWindow::processActivity(bool force) {
|
||||
|
||||
void MainWindow::resetTimeDeltaAverage(){
|
||||
m_driftMsMMA = 0;
|
||||
m_driftMsMMA_N = 1;
|
||||
m_driftMsMMA_N = 0;
|
||||
}
|
||||
|
||||
void MainWindow::setDrift(int n){
|
||||
|
@ -833,8 +833,8 @@ private:
|
||||
QString m_totalTxMessage;
|
||||
QDateTime m_lastTxStartTime;
|
||||
QDateTime m_lastTxStopTime;
|
||||
int m_driftMsMMA;
|
||||
int m_driftMsMMA_N;
|
||||
qint32 m_driftMsMMA;
|
||||
qint32 m_driftMsMMA_N;
|
||||
|
||||
enum Priority {
|
||||
PriorityLow = 10,
|
||||
|
@ -256,7 +256,14 @@ bool WideGraph::shouldDisplayDecodeAttempts(){
|
||||
}
|
||||
|
||||
bool WideGraph::isAutoSyncEnabled(){
|
||||
return ui->autoDriftButton->isChecked() && m_autoSyncDecodesLeft > 0;
|
||||
// enabled if we're auto drifting
|
||||
// and we are not auto stopping
|
||||
// or if we are auto stopping,
|
||||
// we have auto sync decodes left
|
||||
return ui->autoDriftButton->isChecked() && (
|
||||
!ui->autoDriftAutoStopCheckBox->isChecked() ||
|
||||
m_autoSyncDecodesLeft > 0
|
||||
);
|
||||
}
|
||||
|
||||
bool WideGraph::shouldAutoSyncSubmode(int submode){
|
||||
|
Loading…
Reference in New Issue
Block a user