From e7e5e3f3405462ba01e93ad6c4cffac2ecf7dc3e Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sat, 9 Jul 2016 02:27:57 +0000 Subject: [PATCH] Further Tx watchdog refinements This should allow receivers of UDP Status messages to accurately track the Tx watchdog status. Also some defects in the Tx watchdog logic are repaired. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6900 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- NetworkMessage.hpp | 2 +- mainwindow.cpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/NetworkMessage.hpp b/NetworkMessage.hpp index 07efaad8b..34e0d18b9 100644 --- a/NetworkMessage.hpp +++ b/NetworkMessage.hpp @@ -140,7 +140,7 @@ * When the Tx DF changes, * When the DE call or grid changes (currently when settings are exited), * When the DX call or grid changes, - * When the Tx watchdog is triggered. + * When the Tx watchdog is set or reset. * * * Decode Out 2 quint32 diff --git a/mainwindow.cpp b/mainwindow.cpp index 3443078a9..866b38bbb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -869,10 +869,9 @@ void MainWindow::on_the_minute () } } - if (!m_mode.startsWith ("WSPR") && m_config.watchdog () != 0 - && m_idleMinutes < m_config.watchdog ()) + if (m_config.watchdog () && !m_mode.startsWith ("WSPR")) { - ++m_idleMinutes; + if (m_idleMinutes < m_config.watchdog ()) ++m_idleMinutes; updateProgressBarFormat (true); } else @@ -1362,6 +1361,8 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog ui->label_6->setText("Band Activity"); ui->label_7->setText("Rx Frequency"); } + + updateProgressBarFormat (m_config.watchdog () && !m_mode.startsWith ("WSPR")); } void MainWindow::on_monitorButton_clicked (bool checked) @@ -1611,9 +1612,10 @@ bool MainWindow::eventFilter (QObject * object, QEvent * event) case QEvent::KeyPress: // fall through case QEvent::MouseButtonPress: - if (m_idleMinutes && !m_mode.startsWith ("WSPR") && m_config.watchdog () != 0) { + if (m_idleMinutes && m_config.watchdog () && !m_mode.startsWith ("WSPR")) { m_idleMinutes = 0; // reset Tx watchdog updateProgressBarFormat (true); + statusUpdate (); } break; @@ -1660,7 +1662,7 @@ void MainWindow::createStatusBar() //createStatusBar statusBar()->addPermanentWidget(&progressBar, 1); progressBar.setMinimumSize (QSize {100, 18}); - updateProgressBarFormat (!m_mode.startsWith ("WSPR") && m_config.watchdog () != 0); + updateProgressBarFormat (m_config.watchdog () && !m_mode.startsWith ("WSPR")); } void MainWindow::setup_status_bar (bool vhf) @@ -2636,7 +2638,7 @@ void MainWindow::guiUpdate() } } - if (!m_mode.startsWith ("WSPR") && m_config.watchdog() + if (m_config.watchdog() && !m_mode.startsWith ("WSPR") && m_idleMinutes >= m_config.watchdog ()) { m_bTxTime=false; if (m_tune) stop_tuning (); @@ -2864,7 +2866,7 @@ void MainWindow::guiUpdate() if (g_iptt == 1 && m_iptt0 == 0) { auto const& current_message = QString::fromLatin1 (msgsent); - if(!m_mode.startsWith ("WSPR") && m_config.watchdog () != 0) { + if(m_config.watchdog () && !m_mode.startsWith ("WSPR")) { if (current_message != m_msgSent0) { m_idleMinutes=0; // in case we are auto sequencing m_msgSent0 = current_message; @@ -5263,7 +5265,7 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de // find the linefeed at the end of the line position = ui->decodedTextBrowser->toPlainText().indexOf("\n",position); processMessage (messages, position, false); - if (m_idleMinutes && !m_mode.startsWith ("WSPR") && m_config.watchdog () != 0) { + if (m_idleMinutes && m_config.watchdog () && !m_mode.startsWith ("WSPR")) { m_idleMinutes = 0; // reset Tx watchdog updateProgressBarFormat (true); } @@ -5719,7 +5721,9 @@ void MainWindow::statusUpdate () const { if (ui) { - bool watchdog_timeout = !m_mode.startsWith("WSPR") && m_config.watchdog () && m_idleMinutes >= m_config.watchdog (); + bool watchdog_timeout {m_config.watchdog () + && m_idleMinutes >= m_config.watchdog () + && !m_mode.startsWith("WSPR")}; m_messageClient->status_update (m_freqNominal, m_mode, m_hisCall, QString::number (ui->rptSpinBox->value ()), m_modeTx, ui->autoButton->isChecked (),