From 1b2f8a1c6c63bb0fd70a1eea997e602622201fad Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Sat, 21 Jul 2018 17:50:33 -0400 Subject: [PATCH] Restore audio frequency after responding to allcall or transmitting beacon --- mainwindow.cpp | 20 +++++++++++++++++++- mainwindow.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index c307f48..b3bc9d0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -427,7 +427,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, psk_Reporter {new PSK_Reporter {m_messageClient, this}}, m_manual {&m_network_manager}, m_i3bit {0}, - m_txFrameCount {0} + m_txFrameCount {0}, + m_previousFreq {0} { ui->setupUi(this); createStatusBar(); @@ -4193,6 +4194,13 @@ void MainWindow::stopTx() ui->extFreeTextMsgEdit->setReadOnly(false); update_dynamic_property(ui->extFreeTextMsgEdit, "transmitting", false); on_stopTxButton_clicked(); + + // if we have a previousFrequency, and should jump to it, do it + if(m_previousFreq && m_shouldRestoreFreq){ + setFreq4(m_previousFreq, m_previousFreq); + m_previousFreq = 0; + m_shouldRestoreFreq = false; + } } ptt0Timer.start(200); //end-of-transmission sequencer delay @@ -5756,6 +5764,7 @@ void MainWindow::prepareBeacon(){ // TODO: jsherer - return to the original frequency afterwards? setFreq4(f, f); + m_shouldRestoreFreq = true; QStringList lines; @@ -7072,6 +7081,7 @@ void MainWindow::on_macrosMacroButton_pressed(){ void MainWindow::on_tableWidgetRXAll_cellClicked(int row, int col){ auto item = ui->tableWidgetRXAll->item(row, 0); int offset = item->text().toInt(); + setFreq4(offset, offset); ui->tableWidgetCalls->selectionModel()->select( @@ -7127,7 +7137,9 @@ void MainWindow::on_tableWidgetCalls_cellClicked(int row, int col){ if(!m_callActivity.contains(call)){ return; } + int offset = m_callActivity[call].freq; + setFreq4(offset, offset); ui->tableWidgetRXAll->selectionModel()->select( @@ -7353,6 +7365,8 @@ void MainWindow::setFreq4(int rxFreq, int txFreq) txFreq = qMax(500, txFreq); } + m_previousFreq = currentFreq(); + if (ui->RxFreqSpinBox->isEnabled ()) ui->RxFreqSpinBox->setValue(rxFreq); ui->labDialFreqOffset->setText(QString("%1 Hz").arg(rxFreq)); if(m_mode.startsWith ("WSPR")) { @@ -7371,6 +7385,8 @@ void MainWindow::setFreq4(int rxFreq, int txFreq) setXIT (ui->TxFreqSpinBox->value ()); } } + + } void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& s) @@ -8384,6 +8400,8 @@ void MainWindow::displayActivity(bool force){ // if we have beacon turned on, and it's more than 15 seconds away, automatically reply now, and bump the beacon if(QDateTime::currentDateTimeUtc().secsTo(m_nextBeacon) >= 15){ setFreq4(f, f); + m_shouldRestoreFreq = true; + ui->startTxButton->setChecked(true); if(ui->beaconButton->isChecked()){ diff --git a/mainwindow.h b/mainwindow.h index 0563661..ab52a31 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -691,6 +691,8 @@ private: QMap> m_bandActivity; // freq -> [(text, last timestamp), ...] QMap m_callActivity; // call -> (last freq, last timestamp) QSet m_callSeenBeacon; // call + int m_previousFreq; + bool m_shouldRestoreFreq; QMap m_foxQSO; QMap m_loggedByFox;