From 1621670d1fd5a1d8231d2420601979411bbd78f1 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 12 Nov 2019 20:45:27 -0500 Subject: [PATCH] Added minute sync to time drift control --- mainwindow.cpp | 14 ++++ mainwindow.h | 1 + mainwindow.ui | 191 +++++++++++++++++++++++++++---------------------- 3 files changed, 122 insertions(+), 84 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index a47e0cc..3310376 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -8987,6 +8987,20 @@ void MainWindow::on_driftSyncEndButton_clicked(){ setDrift(n * 1000); } +void MainWindow::on_driftSyncMinuteButton_clicked(){ + auto now = QDateTime::currentDateTimeUtc(); + int n = 0; + int s = now.time().second(); + + if(s < 30){ + n = -s; + } else { + n = 60 - s; + } + + setDrift(n * 1000); +} + void MainWindow::on_driftSyncResetButton_clicked(){ setDrift(0); resetTimeDeltaAverage(); diff --git a/mainwindow.h b/mainwindow.h index 764380d..a78aff9 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -354,6 +354,7 @@ private slots: void on_driftSpinBox_valueChanged(int n); void on_driftSyncButton_clicked(); void on_driftSyncEndButton_clicked(); + void on_driftSyncMinuteButton_clicked(); void on_driftSyncResetButton_clicked(); void setDrift(int n); void on_rptSpinBox_valueChanged(int n); diff --git a/mainwindow.ui b/mainwindow.ui index dbf8b65..b0727f7 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2008,92 +2008,115 @@ background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #2ecc71, stop:1 #00FF - - - - 0 - 0 - + + + 0 - - - 100 - 30 - + + 0 - - false - - - Qt::AlignCenter - - - QAbstractSpinBox::PlusMinus - - - ms - - - Time Drift - - - -30000 - - - 30000 - - - 100 - - - - - - - - 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.</p></body></html> - - - Sync 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.</p></body></html> - - - Sync Time Drift to Now (TX End) - - - - - - - - 0 - 30 - - - - Reset your time drift to zero. - - - Reset Time Drift - - + + + + + 0 + 30 + + + + Sync 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.</p></body></html> + + + Sync 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.</p></body></html> + + + Sync Time Drift to Now (TX End) + + + + + + + + 0 + 30 + + + + Reset your time drift to zero. + + + Reset Time Drift + + + + + + + + 0 + 0 + + + + + 100 + 30 + + + + false + + + Qt::AlignCenter + + + QAbstractSpinBox::PlusMinus + + + ms + + + Time Drift + + + -30000 + + + 30000 + + + 100 + + + +