diff --git a/mainwindow.cpp b/mainwindow.cpp
index 44c021d..78d38a0 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -5281,9 +5281,13 @@ void MainWindow::processDecodedLine(QByteArray t){
return;
}
+ // TODO: can we do this for FAST & TURBO
+ // if fast/turbo is observed and we're in a period post 15 seconds (i.e., second 18 turbo decode)
+ // then make the drift relative to the first cycle instead
if(m != Varicode::JS8CallNormal && m != Varicode::JS8CallSlow){
return;
}
+
// if we're here at this point, we _should_ be operating a decode every second
//
// so we need to figure out where:
@@ -5374,6 +5378,9 @@ void MainWindow::processDecodedLine(QByteArray t){
static int driftN = 1;
static int driftAvg = DriftingDateTime::drift();
+ // let the widegraph know for timing control
+ m_wideGraph->notifyDriftedSignalsDecoded(driftQueue.count());
+
while(!driftQueue.isEmpty()){
int newDrift = driftQueue.first();
driftQueue.removeFirst();
@@ -5384,6 +5391,7 @@ void MainWindow::processDecodedLine(QByteArray t){
setDrift(driftAvg);
+
//writeNoticeTextToUI(QDateTime::currentDateTimeUtc(), QString("Automatic Drift: %1").arg(driftAvg));
}
diff --git a/widegraph.cpp b/widegraph.cpp
index 8ca7c31..66aa649 100644
--- a/widegraph.cpp
+++ b/widegraph.cpp
@@ -168,6 +168,7 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
ui->cbControls->setChecked(!m_settings->value("HideControls", false).toBool());
ui->fpsSpinBox->setValue(m_settings->value ("WaterfallFPS", 4).toInt());
ui->decodeAttemptCheckBox->setChecked(m_settings->value("DisplayDecodeAttempts", false).toBool());
+ ui->autoDriftAutoStopCheckBox->setChecked(m_settings->value ("StopAutoSyncOnDecode", true).toBool());
auto splitState = m_settings->value("SplitState").toByteArray();
if(!splitState.isEmpty()){
@@ -244,6 +245,7 @@ void WideGraph::saveSettings() //saveS
m_settings->setValue ("SplitState", ui->splitter->saveState());
m_settings->setValue ("WaterfallFPS", ui->fpsSpinBox->value());
m_settings->setValue ("DisplayDecodeAttempts", ui->decodeAttemptCheckBox->isChecked());
+ m_settings->setValue ("StopAutoSyncOnDecode", ui->autoDriftAutoStopCheckBox->isChecked());
}
bool WideGraph::shouldDisplayDecodeAttempts(){
@@ -254,12 +256,58 @@ bool WideGraph::shouldAutoSync(){
return ui->autoDriftButton->isChecked();
}
+void WideGraph::notifyDriftedSignalsDecoded(int /*signalsDecoded*/){
+ if(ui->autoDriftAutoStopCheckBox->isChecked()){
+ ui->autoDriftButton->setChecked(false);
+ }
+}
+
void WideGraph::on_autoDriftButton_toggled(bool checked){
+ static bool connected = false;
+ if(!connected){
+ connect(&m_autoSyncTimer, &QTimer::timeout, this, [this](){
+ // if auto drift isn't checked, don't worry about this...
+ if(!ui->autoDriftButton->isChecked()){
+ return;
+ }
+
+ // uncheck after timeout
+ if(m_autoSyncTimeLeft == 0){
+ ui->autoDriftButton->setChecked(false);
+ return;
+ }
+
+ // set new text and decrement timeleft
+ auto text = ui->autoDriftButton->text();
+ auto newText = QString("%1 (%2)").arg(text.left(text.indexOf("(")).trimmed()).arg(m_autoSyncTimeLeft--);
+ ui->autoDriftButton->setText(newText);
+ });
+ connected = true;
+ }
+
+ // if in the future we want to auto sync timeout after a time period
+ bool autoSyncTimeout = false;
+
auto text = ui->autoDriftButton->text();
- if(checked){
- ui->autoDriftButton->setText(text.replace("Start", "Stop"));
+
+ if(autoSyncTimeout){
+ if(checked){
+ m_autoSyncTimeLeft = 120;
+ m_autoSyncTimer.setInterval(1000);
+ m_autoSyncTimer.start();
+ ui->autoDriftButton->setText(QString("%1 (%2)").arg(text.replace("Start", "Stop")).arg(m_autoSyncTimeLeft--));
+ } else {
+ m_autoSyncTimeLeft = 0;
+ m_autoSyncTimer.stop();
+ ui->autoDriftButton->setText(text.left(text.indexOf("(")).trimmed().replace("Stop", "Start"));
+ }
+ return;
} else {
- ui->autoDriftButton->setText(text.replace("Stop", "Start"));
+ if(checked){
+ ui->autoDriftButton->setText(text.left(text.indexOf("(")).trimmed().replace("Start", "Stop"));
+ } else {
+ ui->autoDriftButton->setText(text.left(text.indexOf("(")).trimmed().replace("Stop", "Start"));
+ }
}
}
diff --git a/widegraph.h b/widegraph.h
index 38a84f7..f5facc7 100644
--- a/widegraph.h
+++ b/widegraph.h
@@ -90,6 +90,7 @@ public slots:
int drift();
void setQSYEnabled(bool enabled);
void setPaused(bool paused){ m_paused = paused; }
+ void notifyDriftedSignalsDecoded(int signalsDecoded);
protected:
void keyPressEvent (QKeyEvent *e) override;
@@ -165,6 +166,9 @@ private:
bool m_bRef;
bool m_bHaveTransmitted; //Set true at end of a WSPR transmission
+ QTimer m_autoSyncTimer;
+ int m_autoSyncTimeLeft;
+
QTimer m_drawTimer;
QMutex m_drawLock;
diff --git a/widegraph.ui b/widegraph.ui
index 1ff363a..ce7b81b 100644
--- a/widegraph.ui
+++ b/widegraph.ui
@@ -179,7 +179,7 @@
0
0
- 270
+ 323
372
@@ -428,7 +428,7 @@
0
0
- 267
+ 323
742
@@ -975,8 +975,8 @@
0
0
- 273
- 252
+ 337
+ 351
@@ -1021,100 +1021,114 @@
-
-
-
- Qt::Horizontal
+
+
+ Automatic
+
+
-
+
+
+
+ 0
+ 30
+
+
+
+ <html><head/><body><p>Automatically synchronize time drift every second to decodes of NORMAL and SLOW signals observed.</p><p>This process is CPU intensive and may cause abnormal decoder behavior if run for extended periods of time. Default operation should be paired with stopping automatic time drift after signals have been decoded. </p></body></html>
+
+
+ Start Automatic Time Drift
+
+
+ true
+
+
+
+ -
+
+
+ Stop Automatic Drift After First Decode
+
+
+ true
+
+
+
+
-
-
-
-
- 0
- 30
-
-
-
- <html><head/><body><p>Automatically synchronize time drift every second to decodes of signals observed.</p><p>This process is CPU intensive and may cause abnormal decoder behavior if run for extended periods of time.</p></body></html>
-
-
- Start Automatic Time Drift
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
- 0
- 30
-
-
-
- <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the start of a minute.</p></body></html>
-
-
- Set Time Drift to Now (Minute Start)
-
-
-
- -
-
-
-
- 0
- 30
-
-
-
- <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the start of a TX cycle in the current transmission speed.</p></body></html>
-
-
- Set Time Drift to Now (TX Start)
-
-
-
- -
-
-
-
- 0
- 30
-
-
-
- <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the end of a TX cycle in the current transmission speed.</p></body></html>
-
-
- Set Time Drift to Now (TX End)
-
-
-
- -
-
-
-
- 0
- 30
-
-
-
- Reset your time drift to zero.
-
-
- Reset Time Drift
+
+
+ Manual
+
+
-
+
+
+
+ 0
+ 30
+
+
+
+ <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the start of a minute.</p></body></html>
+
+
+ Set Time Drift to Now (Minute Start)
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the end of a TX cycle in the current transmission speed.</p></body></html>
+
+
+ Set Time Drift to Now (TX End)
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the start of a TX cycle in the current transmission speed.</p></body></html>
+
+
+ Set Time Drift to Now (TX Start)
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ Reset your time drift to zero.
+
+
+ Reset Time Drift
+
+
+
+
-