From f415b0c94f64cf9fe836e29762066529c86a0296 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 24 Jul 2018 16:46:04 -0400 Subject: [PATCH] Added autoreply button in conjuntion with beacon button --- Configuration.cpp | 6 + Configuration.hpp | 1 + Configuration.ui | 10 + mainwindow.cpp | 42 +-- mainwindow.h | 4 +- mainwindow.ui | 832 ++++++++++++++++++++++++++++------------------ 6 files changed, 556 insertions(+), 339 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 022d123..934c4d1 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -554,6 +554,7 @@ private: bool id_after_73_; bool tx_QSY_allowed_; bool spot_to_psk_reporter_; + bool autoreply_off_at_startup_; bool monitor_off_at_startup_; bool monitor_last_used_; bool log_as_RTTY_; @@ -664,6 +665,7 @@ void Configuration::set_spot_to_psk_reporter (bool spot) } } +bool Configuration::autoreply_off_at_startup () const {return m_->autoreply_off_at_startup_;} bool Configuration::monitor_off_at_startup () const {return m_->monitor_off_at_startup_;} bool Configuration::monitor_last_used () const {return m_->rig_is_dummy_ || m_->monitor_last_used_;} bool Configuration::log_as_RTTY () const {return m_->log_as_RTTY_;} @@ -1179,6 +1181,7 @@ void Configuration::impl::initialize_models () ui_->CW_id_after_73_check_box->setChecked (id_after_73_); ui_->tx_QSY_check_box->setChecked (tx_QSY_allowed_); ui_->psk_reporter_check_box->setChecked (spot_to_psk_reporter_); + ui_->autoreply_off_check_box->setChecked (autoreply_off_at_startup_); ui_->monitor_off_check_box->setChecked (monitor_off_at_startup_); ui_->monitor_last_used_check_box->setChecked (monitor_last_used_); ui_->log_as_RTTY_check_box->setChecked (log_as_RTTY_); @@ -1376,6 +1379,7 @@ void Configuration::impl::read_settings () type_2_msg_gen_ = settings_->value ("Type2MsgGen", QVariant::fromValue (Configuration::type_2_msg_3_full)).value (); + autoreply_off_at_startup_ = settings_->value ("AutoreplyOFF", false).toBool (); monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool (); monitor_last_used_ = settings_->value ("MonitorLastUsed", false).toBool (); spot_to_psk_reporter_ = settings_->value ("PSKReporter", false).toBool (); @@ -1511,6 +1515,7 @@ void Configuration::impl::write_settings () settings_->setValue ("AudioInputChannel", AudioDevice::toString (audio_input_channel_)); settings_->setValue ("AudioOutputChannel", AudioDevice::toString (audio_output_channel_)); settings_->setValue ("Type2MsgGen", QVariant::fromValue (type_2_msg_gen_)); + settings_->setValue ("AutoreplyOFF", autoreply_off_at_startup_); settings_->setValue ("MonitorOFF", monitor_off_at_startup_); settings_->setValue ("MonitorLastUsed", monitor_last_used_); settings_->setValue ("PSKReporter", spot_to_psk_reporter_); @@ -1937,6 +1942,7 @@ void Configuration::impl::accept () RxBandwidth_ = ui_->sbBandwidth->value (); id_after_73_ = ui_->CW_id_after_73_check_box->isChecked (); tx_QSY_allowed_ = ui_->tx_QSY_check_box->isChecked (); + autoreply_off_at_startup_ = ui_->autoreply_off_check_box->isChecked (); monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked (); monitor_last_used_ = ui_->monitor_last_used_check_box->isChecked (); type_2_msg_gen_ = static_cast (ui_->type_2_msg_gen_combo_box->currentIndex ()); diff --git a/Configuration.hpp b/Configuration.hpp index 1929e32..5251f83 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -112,6 +112,7 @@ public: bool tx_QSY_allowed () const; bool spot_to_psk_reporter () const; void set_spot_to_psk_reporter (bool); + bool autoreply_off_at_startup () const; bool monitor_off_at_startup () const; bool monitor_last_used () const; bool log_as_RTTY () const; diff --git a/Configuration.ui b/Configuration.ui index 3b2666d..4cb09d5 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -314,6 +314,13 @@ Behavior + + + + Autoreply off at startup + + + @@ -329,6 +336,9 @@ + + false + <html><head/><body><p>Check this if you wish to automatically return to the last monitored frequency when monitor is enabled, leave it unchecked if you wish to have the current rig frequency maintained.</p></body></html> diff --git a/mainwindow.cpp b/mainwindow.cpp index f0cafee..fde5a76 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4176,7 +4176,7 @@ void MainWindow::guiUpdate() ui->labUTC->setText(utc); auto delta = t.secsTo(m_nextBeacon); - auto beacon = ui->beaconButton->isChecked() ? delta > 0 ? QString("%1 s").arg(delta) : "queued!" : "disabled"; + auto beacon = ui->beaconButton->isChecked() ? delta > 0 ? QString("%1 s").arg(delta) : "queued!" : m_nextBeaconPaused ? "paused" : "disabled"; ui->labBeacon->setText(QString("Next Beacon: %1").arg(beacon)); if(!m_monitoring and !m_diskData) { @@ -5765,7 +5765,7 @@ bool MainWindow::prepareNextMessageFrame() if(ui->beaconButton->isChecked()){ // bump beacon - scheduleBeacon(true); + scheduleBacon(true); } return true; @@ -5828,7 +5828,8 @@ int MainWindow::findFreeFreqOffset(int fmin, int fmax, int bw){ return 0; } -void MainWindow::scheduleBeacon(bool first){ +// scheduleBeacon +void MainWindow::scheduleBacon(bool first){ auto timestamp = QDateTime::currentDateTimeUtc(); auto orig = timestamp; @@ -5851,13 +5852,22 @@ void MainWindow::scheduleBeacon(bool first){ setBaconTimer(timestamp); } +// setBeaconTimer void MainWindow::setBaconTimer(QDateTime timestamp){ // set the next beacon timestamp and timer beaconTimer.stop(); m_nextBeacon = timestamp; + m_nextBeaconPaused = false; beaconTimer.start(QDateTime::currentDateTimeUtc().msecsTo(m_nextBeacon) - 2*1000); } +// pauseBeacon +void MainWindow::pauseBacon(){ + ui->beaconButton->setChecked(false); + beaconTimer.stop(); + m_nextBeaconPaused = true; +} + // prepareBeacon void MainWindow::prepareBacon(){ if(!ui->beaconButton->isChecked()){ @@ -5882,7 +5892,7 @@ void MainWindow::prepareBacon(){ m_lastTxTime.secsTo(QDateTime::currentDateTimeUtc()) < 30 ){ if(ui->beaconButton->isChecked()){ - scheduleBeacon(true); + scheduleBacon(true); } return; } @@ -5924,7 +5934,7 @@ void MainWindow::prepareBacon(){ ui->startTxButton->setChecked(true); - scheduleBeacon(); + scheduleBacon(); } @@ -7454,7 +7464,7 @@ void MainWindow::on_pbT2R_clicked() void MainWindow::on_beaconButton_clicked() { if(ui->beaconButton->isChecked()){ - scheduleBeacon(true); + scheduleBacon(true); } } @@ -7590,6 +7600,8 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& { // initializing on_monitorButton_clicked (!m_config.monitor_off_at_startup ()); + + ui->autoReplyButton->setChecked(!m_config.autoreply_off_at_startup()); } if (s.frequency () != old_state.frequency () || s.split () != m_splitMode) { @@ -8483,8 +8495,6 @@ void MainWindow::displayActivity(bool force){ ui->tableWidgetCalls->resizeColumnToContents(2); ui->tableWidgetCalls->resizeColumnToContents(3); - - // Recently Directed Activity while(!m_rxFrameQueue.isEmpty()){ RXDetail d = m_rxFrameQueue.dequeue(); @@ -8518,6 +8528,9 @@ void MainWindow::displayActivity(bool force){ bool processed = false; + // TODO: jsherer - should we if we have _any_ directed messages, pause the beacon?? + // pauseBacon(); + while(!m_rxCommandQueue.isEmpty()){ auto d = m_rxCommandQueue.dequeue(); @@ -8601,17 +8614,8 @@ void MainWindow::displayActivity(bool force){ processed = true; } - if(processed){ - // 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){ - setFreqForRestore(f, true); - - ui->startTxButton->setChecked(true); - - if(ui->beaconButton->isChecked()){ - scheduleBeacon(false); - } - } + if(processed && ui->autoReplyButton->isChecked()){ + toggleTx(true); } } diff --git a/mainwindow.h b/mainwindow.h index 29ca8d9..d5a7653 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -261,8 +261,9 @@ private slots: bool prepareNextMessageFrame(); bool isFreqOffsetFree(int f, int bw); int findFreeFreqOffset(int fmin, int fmax, int bw); - void scheduleBeacon(bool first=false); + void scheduleBacon(bool first=false); void setBaconTimer(QDateTime timestamp); + void pauseBacon(); void prepareBacon(); QString calculateDistance(QString const& grid); void on_rptSpinBox_valueChanged(int n); @@ -707,6 +708,7 @@ private: QQueue m_foxRR73Queue; QQueue m_foxRateQueue; + bool m_nextBeaconPaused = false; QDateTime m_nextBeacon; QDateTime m_dateTimeQSOOn; QDateTime m_dateTimeLastTX; diff --git a/mainwindow.ui b/mainwindow.ui index f5dfe21..07342db 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 960 - 534 + 544 @@ -19,19 +19,19 @@ - 4 + 6 - 4 + 6 - 4 + 6 - 4 + 6 - 4 + 6 @@ -45,7 +45,7 @@ true - 4 + 6 true @@ -60,13 +60,13 @@ 0 - 110 + 125 16777215 - 110 + 16777215 @@ -96,13 +96,13 @@ 0 - 110 + 125 16777215 - 110 + 16777215 @@ -113,7 +113,7 @@ - 4 + 6 0 @@ -148,33 +148,94 @@ QFrame::Sunken + + 6 + + + 18 + + + 18 + + + 18 + + + 18 + - + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + 0 + 0 + + - 75 + 0 0 - - true - - - <html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html> - - - background-color:white; + + + 4 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 75 + 30 + + + + true + + + <html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html> + + + background-color:white; color:black; - - - true - - - QComboBox::NoInsert - - - QComboBox::AdjustToMinimumContentsLength - + + + true + + + QComboBox::NoInsert + + + QComboBox::AdjustToMinimumContentsLength + + + + @@ -232,6 +293,19 @@ QPushButton[oob="true"] { + + + + Qt::Vertical + + + + 20 + 10 + + + + @@ -252,19 +326,19 @@ o - 0 + 6 - 0 + 18 - 0 + 18 - 0 + 18 - 0 + 18 @@ -375,235 +449,48 @@ color : white; QFrame::Plain - - - - false + + 18 + + + 18 + + + 18 + + + 18 + + + 12 + + + + + Qt::Vertical - - - 0 - 0 - - - + - 40 - 30 + 20 + 40 - - - 40 - 30 - - - - <html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html> - - - QPushButton { -font-family: helvetica; -font-size: 9pt; -font-weight: bold; -background-color: white; -color: black; -border-style: solid; -border-width:0px; -border-color: gray; -max-height:30px; -min-width:40px; -min-height:30px; -max-width:40px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} - - - CAT - - + - - - - true - - - - 0 - 0 - - - - - 40 - 30 - - - - - 40 - 30 - - - - QPushButton { -font-family: helvetica; -font-size: 9pt; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-width:0px; -border-color: gray; -max-height:30px; -min-width:40px; -min-height:30px; -max-width:40px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} - - - LOG - - - - - - - true - - - - 0 - 0 - - - - - 40 - 30 - - - - - 40 - 30 - - - - QPushButton { -font-family: helvetica; -font-size: 9pt; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-width:0px; -border-color: gray; -max-height:30px; -min-width:40px; -min-height:30px; -max-width:40px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #6699ff; -} - - - BCN - - - true - - - - - - - true - - - - 0 - 0 - - - - - 40 - 30 - - - - - 40 - 30 - - - - QPushButton { -font-family: helvetica; -font-size: 9pt; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-width:0px; -border-color: gray; -max-height:30px; -min-width:40px; -min-height:30px; -max-width:40px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #00ff00; -} - - - SPOT - - - true - - - - + + + + 60 + 30 + + + + + 60 + 30 + + true @@ -612,7 +499,7 @@ background-color: #00ff00; 0 0 - 40 + 60 30 @@ -624,30 +511,31 @@ background-color: #00ff00; - 40 + 60 30 - 40 + 60 30 QPushButton { font-family: helvetica; -font-size: 9pt; font-weight: bold; background-color: lightgray; color: black; border-style: solid; +border-radius:2px; border-width:0px; border-color: gray; -max-height:30px; -min-width:40px; +font-size:90%; +min-width:60px; min-height:30px; -max-width:40px;; +max-width:60px; +max-height:30px; } QPushButton[state="error"] { background-color: red; @@ -677,7 +565,7 @@ background-color: #00ff00; 0 0 - 40 + 60 30 @@ -689,13 +577,13 @@ background-color: #00ff00; - 40 + 60 30 - 40 + 60 30 @@ -705,16 +593,17 @@ background-color: #00ff00; QPushButton { font-family: helvetica; -font-size: 9pt; font-weight: bold; color: black; border-style: solid; +border-radius:2px; border-width:0px; border-color: gray; -max-height:30px; -min-width:40px; +font-size:90%; +min-width:60px; min-height:30px; -max-width:40px;; +max-width:60px; +max-height:30px; background-color: yellow; } @@ -728,7 +617,20 @@ background-color: yellow; - + + + + Qt::Vertical + + + + 20 + 40 + + + + + true @@ -741,30 +643,32 @@ background-color: yellow; - 40 + 60 30 - 40 + 60 30 QPushButton { font-family: helvetica; -font-size: 9pt; font-weight: bold; background-color: lightgray; color: black; border-style: solid; +border-radius:2px; border-width:0px; border-color: gray; -max-height:30px; -min-width:40px; +font-size:90%; +min-width:60px; min-height:30px; -max-width:40px; +max-width:60px; +max-height:30px; + } QPushButton[state="error"] { background-color: red; @@ -787,6 +691,240 @@ background-color: yellow; + + + + true + + + + 0 + 0 + + + + + 60 + 30 + + + + + 60 + 30 + + + + QPushButton { +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:60px; +min-height:30px; +max-width:60px; +max-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} +QPushButton:checked { +background-color: #6699ff; +} + + + AUTO + + + true + + + + + + + true + + + + 0 + 0 + + + + + 60 + 30 + + + + + 60 + 30 + + + + QPushButton { +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:60px; +min-height:30px; +max-width:60px; +max-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} +QPushButton:checked { +background-color: #00ff00; +} + + + SPOT + + + true + + + + + + + true + + + + 0 + 0 + + + + + 60 + 30 + + + + + 60 + 30 + + + + QPushButton { +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:60px; +min-height:30px; +max-width:60px; +max-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} +QPushButton:checked { +background-color: #6699ff; +} + + + BCN + + + true + + + + + + + true + + + + 0 + 0 + + + + + 60 + 30 + + + + + 60 + 30 + + + + QPushButton { +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:60px; +min-height:30px; +max-width:60px; +max-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} + + + LOG + + + @@ -812,7 +950,7 @@ background-color: yellow; Qt::Horizontal - 4 + 6 @@ -912,7 +1050,7 @@ background-color: yellow; Qt::Vertical - 4 + 6 @@ -1289,7 +1427,7 @@ background:yellow; 0 - 4 + 6 0 @@ -1324,43 +1462,100 @@ background:yellow; 0 + + + + false + + + + 0 + 0 + + + + + 40 + 30 + + + + + 16777215 + 16777215 + + + + true + + + <html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html> + + + QPushButton { +font-family: helvetica; +font-size: 9pt; +font-weight: bold; +background-color: white; +color: black; +border-style: solid; +border-width:0px; +border-color: gray; +min-width:40px; +min-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} + + + CAT + + + + + + + + 1 + 1 + + + + + 75 + 0 + + + + + 16777215 + 16777215 + + + + <html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html> + + + background-color:black; + + + QFrame::NoFrame + + + QFrame::Plain + + + - - - - - 1 - 0 - - - - - 75 - 0 - - - - - 16777215 - 16777215 - - - - <html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html> - - - background-color:black; - - - QFrame::NoFrame - - - QFrame::Plain - - - @@ -4776,7 +4971,6 @@ list. The list can be maintained in Settings (F2). - logQSOButton stopButton EraseButton ClrAvgButton