From 7845736c056bb860b39a6334e126b3976ab91566 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Wed, 18 Jul 2018 09:04:58 -0400 Subject: [PATCH] Smarter beacon scheduling for when editing a message or have recently transmitted --- mainwindow.cpp | 15 ++++++++++++--- mainwindow.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 65f7ede..774d417 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3942,6 +3942,10 @@ void MainWindow::guiUpdate() case 6: m_QSOProgress = CALLING; break; default: break; // determined elsewhere } + + // TODO: jsherer - perhaps an on_transmitting signal? + m_lastTxTime = QDateTime::currentDateTimeUtc(); + m_transmitting = true; transmitDisplay (true); statusUpdate (); @@ -5661,9 +5665,14 @@ void MainWindow::prepareBeacon(){ f = findFreeFreqOffset(250, 1500, bw); } - // delay beacon if there's not a free frequency or there's something the tx queue... - if(f == 0 || !m_txFrameQueue.isEmpty()){ - beaconTimer.start(15*1000); + // delay beacon if there's not a free frequency or there's something the tx queue or we just recently transmitted + if( + f == 0 || + !m_txFrameQueue.isEmpty() || + !ui->extFreeTextMsgEdit->toPlainText().isEmpty() || + m_lastTxTime.secsTo(QDateTime::currentDateTimeUtc()) < 30 + ){ + setBeaconTimer(QDateTime::currentDateTimeUtc().addSecs(30)); return; } diff --git a/mainwindow.h b/mainwindow.h index 6a87745..06c7597 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -674,6 +674,7 @@ private: bool m_rxDirty; int m_txFrameCount; + QDateTime m_lastTxTime; QQueue m_txFrameQueue; QQueue m_rxFrameQueue; QQueue m_rxCommandQueue;