From 5ca582a6b4e3c40b237557cf535dba17348e014f Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 20 Dec 2018 20:16:53 -0500 Subject: [PATCH] Fixed #54: heartbeat anywhere should be exposed in the configuration and HB ack should abide by that setting --- Configuration.ui | 16 +++++++--------- mainwindow.cpp | 13 ++++++++++++- mainwindow.h | 1 + 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Configuration.ui b/Configuration.ui index 34dbbd5..602c91e 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -388,6 +388,13 @@ + + + + Allow heartbeat transmissions outside of heartbeat sub-channel (500Hz - 1000Hz) + + + @@ -690,15 +697,6 @@ text message. Heartbeat (HB) - - - - - Allow heartbeat transmissions outside of heartbeat sub-channel (500Hz - 1000Hz) - - - - diff --git a/mainwindow.cpp b/mainwindow.cpp index 078fbf1..f32a611 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -6822,6 +6822,14 @@ void MainWindow::sendHeartbeat(){ enqueueMessage(PriorityLow, message, f, [this](){ /* */ }); } +void MainWindow::sendHeartbeatAck(QString to, int snr){ + auto message = QString("%1 ACK %2").arg(to).arg(Varicode::formatSNR(snr)); + + auto f = m_config.heartbeat_anywhere() ? -1 : findFreeFreqOffset(500, 1000, 50); + + enqueueMessage(PriorityLow, message, f, [this](){ /* */ }); +} + void MainWindow::on_hbMacroButton_toggled(bool checked){ if(checked){ if(m_hbInterval){ @@ -9538,12 +9546,15 @@ void MainWindow::processCommandActivity() { // PROCESS ACTIVE HEARTBEAT // if we have auto reply enabled and we are heartbeating and selcall is not enabled else if (d.cmd == " HB" && ui->autoReplyButton->isChecked() && ui->hbMacroButton->isChecked() && m_hbInterval > 0 && !ui->selcalButton->isChecked()){ - reply = QString("%1 ACK %2").arg(d.from).arg(Varicode::formatSNR(d.snr)); + sendHeartbeatAck(d.from, d.snr); if(isAllCall){ // since all pings are technically @ALLCALL, let's bump the allcall cache here... m_txAllcallCommandCache.insert(d.from, new QDateTime(now), 5); } + + // make sure this is explicit + continue; } // PROCESS BUFFERED QUERY diff --git a/mainwindow.h b/mainwindow.h index 5b06b8b..6f417ab 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -280,6 +280,7 @@ private slots: void buildCQMenu(QMenu *menu); void buildRepeatMenu(QMenu *menu, QPushButton * button, int * interval); void sendHeartbeat(); + void sendHeartbeatAck(QString to, int snr); void on_hbMacroButton_toggled(bool checked); void on_hbMacroButton_clicked(); void sendCQ(bool repeat=false);