diff --git a/APRSISClient.cpp b/APRSISClient.cpp index a22d827..1486353 100644 --- a/APRSISClient.cpp +++ b/APRSISClient.cpp @@ -301,7 +301,7 @@ void APRSISClient::processQueue(bool disconnect){ } // random delay 25% of the time for throttling (a skip will add 60 seconds to the processing time) - if(qrand() % 100 <= 25){ + if(m_skipPercent > 0 && qrand() % 100 <= int(m_skipPercent*100)){ qDebug() << "APRSISClient Throttle: Skipping Frame"; delayed.enqueue(m_frameQueue.dequeue()); continue; diff --git a/APRSISClient.h b/APRSISClient.h index ab9a772..f680ef0 100644 --- a/APRSISClient.h +++ b/APRSISClient.h @@ -27,6 +27,10 @@ public: public slots: + void setSkipPercent(float skipPercent){ + m_skipPercent = skipPercent; + } + void setServer(QString host, quint16 port){ if(state() == QTcpSocket::ConnectedState){ disconnectFromHost(); @@ -65,6 +69,7 @@ private: quint16 m_port; QTimer m_timer; bool m_paused; + float m_skipPercent; }; #endif // APRSISCLIENT_H diff --git a/mainwindow.cpp b/mainwindow.cpp index 9483c4e..7b9bf78 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -504,6 +504,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, connect (this, &MainWindow::aprsClientSetLocalStation, m_aprsClient, &APRSISClient::setLocalStation); connect (this, &MainWindow::aprsClientSetPaused, m_aprsClient, &APRSISClient::setPaused); connect (this, &MainWindow::aprsClientSetServer, m_aprsClient, &APRSISClient::setServer); + connect (this, &MainWindow::aprsClientSetSkipPercent, m_aprsClient, &APRSISClient::setSkipPercent); connect (&m_networkThread, &QThread::finished, m_aprsClient, &QObject::deleteLater); // hook up sound output stream slots & signals and disposal @@ -3207,6 +3208,7 @@ void MainWindow::prepareSpotting(){ spotSetLocal(); pskSetLocal(); aprsSetLocal(); + emit aprsClientSetSkipPercent(0.25); emit aprsClientSetServer(m_config.aprs_server_name(), m_config.aprs_server_port()); emit aprsClientSetPaused(false); ui->spotButton->setChecked(true); diff --git a/mainwindow.h b/mainwindow.h index b1a5170..c7e4431 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -448,6 +448,7 @@ private: Q_SIGNAL void aprsClientEnqueueSpot(QString by_call, QString from_call, QString grid, QString comment); Q_SIGNAL void aprsClientEnqueueThirdParty(QString by_call, QString from_call, QString text); + Q_SIGNAL void aprsClientSetSkipPercent(float skipPercent); Q_SIGNAL void aprsClientSetServer(QString host, quint16 port); Q_SIGNAL void aprsClientSetPaused(bool paused); Q_SIGNAL void aprsClientSetLocalStation(QString mycall, QString passcode);