From 6ab3d32e3b27b83ee14f1548df33528ce359532f Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 30 Aug 2018 12:18:20 -0400 Subject: [PATCH] Updated APRS spotting connections for better reliability --- APRSISClient.cpp | 9 ++++++--- mainwindow.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/APRSISClient.cpp b/APRSISClient.cpp index 7795854..37810cd 100644 --- a/APRSISClient.cpp +++ b/APRSISClient.cpp @@ -13,7 +13,7 @@ APRSISClient::APRSISClient(QString host, quint16 port, QObject *parent): m_port(port) { connect(&m_timer, &QTimer::timeout, this, &APRSISClient::sendReports); - m_timer.setInterval(60*1000); // every minute + m_timer.setInterval(30*1000); // every 30 seconds m_timer.start(); } @@ -188,12 +188,11 @@ void APRSISClient::enqueueSpot(QString theircall, QString grid, quint64 frequenc if(m_localCall.isEmpty()) return; auto geo = APRSISClient::grid2aprs(grid); - auto spotFrame = QString("%1>%2,APRS,TCPIP*:=%3/%4nFT8CALL %5 %6MHz %7dB\n"); + auto spotFrame = QString("%1>%2,APRS,TCPIP*:=%3/%4nFT8CALL %5MHz %6dB\n"); spotFrame = spotFrame.arg(theircall); spotFrame = spotFrame.arg(m_localCall); spotFrame = spotFrame.arg(geo.first); spotFrame = spotFrame.arg(geo.second); - spotFrame = spotFrame.arg(m_localGrid.left(4)); spotFrame = spotFrame.arg(Radio::frequency_MHz_string(frequency)); spotFrame = spotFrame.arg(Varicode::formatSNR(snr)); enqueueRaw(spotFrame); @@ -222,8 +221,12 @@ void APRSISClient::enqueueRaw(QString aprsFrame){ } void APRSISClient::processQueue(bool disconnect){ + // don't process queue if we haven't set our local callsign if(m_localCall.isEmpty()) return; + // don't process queue if there's nothing to process + if(m_frameQueue.isEmpty()) return; + // 1. connect (and read) // 2. login (and read) // 3. for each raw frame in queue, send diff --git a/mainwindow.cpp b/mainwindow.cpp index ce502f6..1d5ae8c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7041,7 +7041,7 @@ void MainWindow::band_changed (Frequency f) m_bandEdited = false; psk_Reporter->sendReport(); // Upload any queued spots before changing band - m_aprsClient->processQueue(); + m_aprsClient->processQueue(true); if (!m_transmitting) monitor (true); if ("FreqCal" == m_mode) {