diff --git a/Network/PSKReporter.cpp b/Network/PSKReporter.cpp index 59408c284..1776d8143 100644 --- a/Network/PSKReporter.cpp +++ b/Network/PSKReporter.cpp @@ -65,7 +65,6 @@ public: // This timer sets the interval to check for spots to send. connect (&report_timer_, &QTimer::timeout, [this] () {send_report ();}); - report_timer_.start (MIN_SEND_INTERVAL * 1000); // This timer repeats the sending of IPFIX templates and receiver // information if we are using UDP, in case server has been @@ -80,7 +79,6 @@ public: send_receiver_data_ = 3; // three times } }); - descriptor_timer_.start (1 * 60 * 60 * 1000); // hourly } void check_connection () @@ -156,6 +154,15 @@ public: // use this for pseudo connection with UDP, allows us to use // QIODevice::write() instead of QUDPSocket::writeDatagram() socket_->connectToHost (HOST, SERVICE_PORT, QAbstractSocket::WriteOnly); + + if (!report_timer_.isActive ()) + { + report_timer_.start (MIN_SEND_INTERVAL * 1000); + } + if (!descriptor_timer_.isActive ()) + { + descriptor_timer_.start (1 * 60 * 60 * 1000); // hourly + } } void send_report (bool send_residue = false); @@ -490,6 +497,7 @@ void PSKReporter::setLocalStation (QString const& call, QString const& gridSquar bool PSKReporter::addRemoteStation (QString const& call, QString const& grid, Radio::Frequency freq , QString const& mode, int snr) { + m_->check_connection (); if (m_->socket_ && m_->socket_->isValid ()) { if (QAbstractSocket::UnconnectedState == m_->socket_->state ()) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 7040936c1..3f0ded867 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1814,7 +1814,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog on_dxGridEntry_textChanged (m_hisGrid); // recalculate distances in case of units change enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook - if(m_config.spot_to_psk_reporter ()) pskSetLocal (); + pskSetLocal (); if(m_config.restart_audio_input ()) { Q_EMIT startAudioInputStream (m_config.audio_input_device () @@ -6864,7 +6864,11 @@ void MainWindow::band_changed (Frequency f) } m_lastBand.clear (); m_bandEdited = false; - m_psk_Reporter.sendReport(); // Upload any queued spots before changing band + if (m_config.spot_to_psk_reporter ()) + { + // Upload any queued spots before changing band + m_psk_Reporter.sendReport(); + } if (!m_transmitting) monitor (true); if ("FreqCal" == m_mode) { @@ -7539,6 +7543,8 @@ bool MainWindow::shortList(QString callsign) void MainWindow::pskSetLocal () { + if (!m_config.spot_to_psk_reporter ()) return; + // find the station row, if any, that matches the band we are on auto stations = m_config.stations (); auto matches = stations->match (stations->index (0, StationList::band_column)