From 4a32b0bef67a2ab60689472190c279a49caee0ba Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 24 Sep 2014 17:25:19 +0000 Subject: [PATCH] Add facility to disallow CAT commands while transmitting. Some rigs either do not honour some CAT commands while transmitting or interpret them incorrectly. To deal with this a settings option to allow TX frequency changes while transmitting has been added with a default value of off. Any UI actions that directly or indirectly change the TX frequency are guarded according to this new option. As well as this band changes and use of the +2kHz check box are disabled and guarded respectively in transmit mode. Mode changes via the menu are now disabled while transmitting. When TX frequency changes are allowed; frequency changes are correctly implemented while in tune mode. Double clicking decodes while transmitting now correctly regenerate and change the message sent on the fly. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4349 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Configuration.cpp | 6 ++ Configuration.hpp | 1 + Configuration.ui | 46 +++++---- Modulator.cpp | 7 +- Modulator.hpp | 1 + mainwindow.cpp | 232 +++++++++++++++++++++++++++++----------------- mainwindow.h | 3 +- plotter.cpp | 26 ++---- plotter.h | 2 +- widegraph.cpp | 8 +- widegraph.h | 5 - 11 files changed, 201 insertions(+), 136 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index cfc5689c5..19e751e48 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -369,6 +369,7 @@ private: QString my_grid_; qint32 id_interval_; bool id_after_73_; + bool tx_QSY_allowed_; bool spot_to_psk_reporter_; bool monitor_off_at_startup_; bool log_as_RTTY_; @@ -425,6 +426,7 @@ QString Configuration::my_grid () const {return m_->my_grid_;} QFont Configuration::decoded_text_font () const {return m_->decoded_text_font_;} qint32 Configuration::id_interval () const {return m_->id_interval_;} bool Configuration::id_after_73 () const {return m_->id_after_73_;} +bool Configuration::tx_QSY_allowed () const {return m_->tx_QSY_allowed_ || !split_mode ();} bool Configuration::spot_to_psk_reporter () const {return m_->spot_to_psk_reporter_;} bool Configuration::monitor_off_at_startup () const {return m_->monitor_off_at_startup_;} bool Configuration::log_as_RTTY () const {return m_->log_as_RTTY_;} @@ -839,6 +841,7 @@ void Configuration::impl::initialise_models () ui_->PTT_method_button_group->button (rig_params_.PTT_method_)->setChecked (true); ui_->save_path_display_label->setText (save_directory_.absolutePath ()); 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_->monitor_off_check_box->setChecked (monitor_off_at_startup_); ui_->log_as_RTTY_check_box->setChecked (log_as_RTTY_); @@ -987,6 +990,7 @@ void Configuration::impl::read_settings () monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool (); spot_to_psk_reporter_ = settings_->value ("PSKReporter", false).toBool (); id_after_73_ = settings_->value ("After73", false).toBool (); + tx_QSY_allowed_ = settings_->value ("TxQSYAllowed", false).toBool (); macros_.setStringList (settings_->value ("Macros", QStringList {"TNX 73 GL"}).toStringList ()); @@ -1067,6 +1071,7 @@ void Configuration::impl::write_settings () settings_->setValue ("MonitorOFF", monitor_off_at_startup_); settings_->setValue ("PSKReporter", spot_to_psk_reporter_); settings_->setValue ("After73", id_after_73_); + settings_->setValue ("TxQSYAllowed", tx_QSY_allowed_); settings_->setValue ("Macros", macros_.stringList ()); settings_->setValue ("frequencies", QVariant::fromValue (frequencies_.frequencies ())); settings_->setValue ("stations", QVariant::fromValue (stations_.stations ())); @@ -1404,6 +1409,7 @@ void Configuration::impl::accept () spot_to_psk_reporter_ = ui_->psk_reporter_check_box->isChecked (); id_interval_ = ui_->CW_id_interval_spin_box->value (); id_after_73_ = ui_->CW_id_after_73_check_box->isChecked (); + tx_QSY_allowed_ = ui_->tx_QSY_check_box->isChecked (); monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked (); jt9w_bw_mult_ = ui_->jt9w_bandwidth_mult_combo_box->currentText ().toUInt (); jt9w_min_dt_ = static_cast (ui_->jt9w_min_dt_double_spin_box->value ()); diff --git a/Configuration.hpp b/Configuration.hpp index ff0c9a75b..a497822d2 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -85,6 +85,7 @@ public: QFont decoded_text_font () const; qint32 id_interval () const; bool id_after_73 () const; + bool tx_QSY_allowed () const; bool spot_to_psk_reporter () const; bool monitor_off_at_startup () const; bool log_as_RTTY () const; diff --git a/Configuration.ui b/Configuration.ui index da049658f..f71687fca 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -214,6 +214,27 @@ Behavior + + + + Turns off automatic transmissions after sending a 73 or any other free +text message. + + + Di&sable Tx after sending 73 + + + + + + + Stop transmitting automatically after five periods. + + + Runaway Tx &watchdog + + + @@ -237,28 +258,17 @@ - - + + - Turns off automatic transmissions after sending a 73 or any other free -text message. + <html><head/><body><p>Some rigs are not able to process CAT commands while transmitting. This means that if you are operating in split mode you may have to uncheck this option.</p></body></html> - Di&sable Tx after sending 73 + Allow Tx Frequency Changes While Transmitting - - - - Stop transmitting automatically after five periods. - - - Runaway Tx &watchdog - - - - + @@ -1825,11 +1835,11 @@ soundcard changes - + + - diff --git a/Modulator.cpp b/Modulator.cpp index 81d6e6b3e..30b275b62 100644 --- a/Modulator.cpp +++ b/Modulator.cpp @@ -58,7 +58,9 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, unsigned m_quickClose = false; m_symbolsLength = symbolsLength; - m_isym0 = std::numeric_limits::max (); // Arbitrary big number + m_isym0 = std::numeric_limits::max (); // Arbitrary big + // number + m_frequency0 = 0.; m_addNoise = dBSNR < 0.; m_nsps = framesPerSymbol; m_frequency = frequency; @@ -223,7 +225,7 @@ qint64 Modulator::readData (char * data, qint64 maxSize) for (unsigned i = 0; i < numFrames && m_ic <= i1; ++i) { isym = m_tuning ? 0 : m_ic / (4.0 * m_nsps); //Actual fsample=48000 - if (isym != m_isym0) { + if (isym != m_isym0 || m_frequency != m_frequency0) { // qDebug () << "@m_ic:" << m_ic << "itone[" << isym << "] =" << itone[isym] << "@" << i << "in numFrames:" << numFrames; if(m_toneSpacing==0.0) { @@ -233,6 +235,7 @@ qint64 Modulator::readData (char * data, qint64 maxSize) } m_dphi = m_twoPi * toneFrequency0 / m_frameRate; m_isym0 = isym; + m_frequency0 = m_frequency; } int j=m_ic/480; diff --git a/Modulator.hpp b/Modulator.hpp index 30e68c0b1..80c900c08 100644 --- a/Modulator.hpp +++ b/Modulator.hpp @@ -60,6 +60,7 @@ private: double m_amp; double m_nsps; double volatile m_frequency; + double m_frequency0; double m_snr; double m_fac; double m_toneSpacing; diff --git a/mainwindow.cpp b/mainwindow.cpp index f17158e57..eed28efe1 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -285,8 +285,6 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme m_killAll=false; m_widebandDecode=false; m_ntx=1; - m_rxFreq=1500; - m_txFreq=1500; m_setftx=0; m_loopall=false; m_startAnother=false; @@ -373,8 +371,6 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme if(m_mode!="JT9" and m_mode!="JT9W-1" and m_mode!="JT65" and m_mode!="JT9+JT65") m_mode="JT9"; on_actionWide_Waterfall_triggered(); //### - m_wideGraph->setRxFreq(m_rxFreq); - m_wideGraph->setTxFreq(m_txFreq); m_wideGraph->setLockTxFreq(m_lockTxFreq); m_wideGraph->setModeTx(m_mode); m_wideGraph->setModeTx(m_modeTx); @@ -398,7 +394,7 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme Q_EMIT startAudioInputStream (m_config.audio_input_device (), m_framesAudioInputBuffered, &m_detector, m_downSampleFactor, m_config.audio_input_channel ()); Q_EMIT initializeAudioOutputStream (m_config.audio_output_device (), AudioDevice::Mono == m_config.audio_output_channel () ? 1 : 2, m_msAudioOutputBuffered); - Q_EMIT transmitFrequency (m_txFreq - m_XIT); + Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value () - m_XIT); auto t = "UTC dB DT Freq Message"; ui->decodedTextLabel->setText(t); @@ -447,8 +443,8 @@ void MainWindow::writeSettings() m_settings->setValue("SaveDecoded",ui->actionSave_decoded->isChecked()); m_settings->setValue("SaveAll",ui->actionSave_all->isChecked()); m_settings->setValue("NDepth",m_ndepth); - m_settings->setValue("RxFreq",m_rxFreq); - m_settings->setValue("TxFreq",m_txFreq); + m_settings->setValue("RxFreq",ui->RxFreqSpinBox->value ()); + m_settings->setValue("TxFreq",ui->TxFreqSpinBox->value ()); m_settings->setValue ("DialFreq", QVariant::fromValue(m_lastMonitoredFrequency)); m_settings->setValue("InGain",m_inGain); m_settings->setValue("OutAttenuation", ui->outAttenuation->value ()); @@ -500,12 +496,10 @@ void MainWindow::readSettings() ui->actionSave_decoded->setChecked(m_settings->value( "SaveDecoded",false).toBool()); ui->actionSave_all->setChecked(m_settings->value("SaveAll",false).toBool()); - m_rxFreq=m_settings->value("RxFreq",1500).toInt(); - ui->RxFreqSpinBox->setValue(m_rxFreq); - m_txFreq=m_settings->value("TxFreq",1500).toInt(); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq",1500).toInt()); m_lastMonitoredFrequency = m_settings->value ("DialFreq", QVariant::fromValue (default_frequency)).value (); - ui->TxFreqSpinBox->setValue(m_txFreq); - Q_EMIT transmitFrequency (m_txFreq - m_XIT); + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq",1500).toInt()); + Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value () - m_XIT); m_saveDecoded=ui->actionSave_decoded->isChecked(); m_saveAll=ui->actionSave_all->isChecked(); m_ndepth=m_settings->value("NDepth",3).toInt(); @@ -644,7 +638,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog displayDialFrequency (); } - setXIT (m_txFreq); + setXIT (ui->TxFreqSpinBox->value ()); if (m_config.transceiver_online ()) { Q_EMIT m_config.transceiver_frequency (m_dialFreq); @@ -664,7 +658,7 @@ void MainWindow::on_monitorButton_clicked (bool checked) // put rig back where it was when last in control Q_EMIT m_config.transceiver_frequency (m_lastMonitoredFrequency); - setXIT (m_txFreq); + setXIT (ui->TxFreqSpinBox->value ()); } Q_EMIT m_config.sync_transceiver (true, checked); // gets @@ -828,14 +822,17 @@ void MainWindow::bumpFqso(int n) //bumpFqso() int i; bool ctrl = (n>=100); n=n%100; - i=m_wideGraph->rxFreq(); + i=ui->RxFreqSpinBox->value (); if(n==11) i--; if(n==12) i++; - m_wideGraph->setRxFreq(i); - if(ctrl) { - ui->TxFreqSpinBox->setValue(i); - m_wideGraph->setTxFreq(i); - } + if (ui->RxFreqSpinBox->isEnabled ()) + { + ui->RxFreqSpinBox->setValue (i); + } + if(ctrl && ui->TxFreqSpinBox->isEnabled ()) + { + ui->TxFreqSpinBox->setValue (i); + } } void MainWindow::qsy (Frequency f) @@ -848,14 +845,11 @@ void MainWindow::qsy (Frequency f) if (m_dialFreq != f) { m_dialFreq = f; - setXIT(m_txFreq); + setXIT(ui->TxFreqSpinBox->value ()); m_repeatMsg=0; m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000; - bumpFqso(11); - bumpFqso(12); - QFile f2(m_config.data_path ().absoluteFilePath ("ALL.TXT")); f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); QTextStream out(&f2); @@ -1198,12 +1192,6 @@ void MainWindow::on_DecodeButton_clicked (bool /* checked */) //Decode request void MainWindow::freezeDecode(int n) //freezeDecode() { - bool ctrl = (n>=100); - int i=m_wideGraph->rxFreq(); - if(ctrl) { - ui->TxFreqSpinBox->setValue(i); - m_wideGraph->setTxFreq(i); - } if((n%100)==2) on_DecodeButton_clicked (true); } @@ -1426,7 +1414,7 @@ void MainWindow::guiUpdate() bTxTime=true; } - Frequency onAirFreq = m_dialFreq + m_txFreq; + Frequency onAirFreq = m_dialFreq + ui->TxFreqSpinBox->value (); if (onAirFreq > 10139900 && onAirFreq < 10140320) { bTxTime=false; @@ -1506,7 +1494,7 @@ void MainWindow::guiUpdate() f.close(); if (m_config.TX_messages ()) { - ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,m_txFreq); + ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,ui->TxFreqSpinBox->value ()); } } @@ -1553,36 +1541,48 @@ void MainWindow::guiUpdate() if (g_iptt == 1 && iptt0 == 0) { QString t=QString::fromLatin1(msgsent); - if(t==m_msgSent0) { - m_repeatMsg++; - } else { - m_repeatMsg=0; - m_msgSent0=t; - } - - signalMeter->setValue(0); - - if (m_monitoring) + if(t==m_msgSent0) { - monitor (false); + m_repeatMsg++; + } + else + { + m_repeatMsg=0; + m_msgSent0=t; + if(!m_tune) + { + QFile f(m_config.data_path ().absoluteFilePath ("ALL.TXT")); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); + QTextStream out(&f); + out << QDateTime::currentDateTimeUtc().toString("hhmm") + << " Transmitting " << (m_dialFreq / 1.e6) << " MHz " << m_modeTx + << ": " << t << endl; + f.close(); + } + if (m_config.TX_messages () && !m_tune) + { + ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,ui->TxFreqSpinBox->value ()); + } + } + + if(!m_tune) + { + QFile f(m_config.data_path ().absoluteFilePath ("ALL.TXT")); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); + QTextStream out(&f); + out << QDateTime::currentDateTimeUtc().toString("hhmm") + << " Transmitting " << (m_dialFreq / 1.e6) << " MHz " << m_modeTx + << ": " << t << endl; + f.close(); } - m_btxok=true; - m_transmitting=true; - ui->pbTxMode->setEnabled(false); - if(!m_tune) { - QFile f(m_config.data_path ().absoluteFilePath ("ALL.TXT")); - f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); - QTextStream out(&f); - out << QDateTime::currentDateTimeUtc().toString("hhmm") - << " Transmitting " << (m_dialFreq / 1.e6) << " MHz " << m_modeTx - << ": " << t << endl; - f.close(); - } if (m_config.TX_messages () && !m_tune) { - ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,m_txFreq); + ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,ui->TxFreqSpinBox->value ()); } + + m_transmitting = true; + transmitDisplay (true); } if(!m_btxok && btxok0 && g_iptt==1) stopTx(); @@ -1604,7 +1604,7 @@ void MainWindow::guiUpdate() QDateTime t = QDateTime::currentDateTimeUtc(); int fQSO=125; if(m_astroWidget) m_astroWidget->astroUpdate(t, m_config.my_grid (), m_hisGrid, fQSO, - m_setftx, m_txFreq); + m_setftx, ui->TxFreqSpinBox->value ()); if(m_transmitting) { if(nsendingsh==1) { @@ -1658,21 +1658,14 @@ void MainWindow::startTx2() if(snr>0.0 or snr < -50.0) snr=99.0; transmit (snr); signalMeter->setValue(0); - - //monitor (false); - - //m_btxok=true; - //m_transmitting=true; - ui->pbTxMode->setEnabled(false); } } void MainWindow::stopTx() { Q_EMIT endTransmitMessage (); - m_transmitting=false; m_btxok = false; - if ("JT9+JT65" == m_mode) ui->pbTxMode->setEnabled(true); + m_transmitting = false; g_iptt=0; tx_status_label->setStyleSheet(""); tx_status_label->setText(""); @@ -1819,18 +1812,23 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl) int frequency = decodedtext.frequencyOffset(); - m_wideGraph->setRxFreq(frequency); //Set Rx freq + if (ui->RxFreqSpinBox->isEnabled ()) + { + ui->RxFreqSpinBox->setValue (frequency); //Set Rx freq + } if (decodedtext.isTX()) { - if (ctrl) - ui->TxFreqSpinBox->setValue(frequency); //Set Tx freq + if (ctrl && ui->TxFreqSpinBox->isEnabled ()) + { + ui->TxFreqSpinBox->setValue(frequency); //Set Tx freq + } return; } QString firstcall = decodedtext.call(); // Don't change Tx freq if a station is calling me, unless m_lockTxFreq // is true or CTRL is held down - if ((firstcall!=m_config.my_callsign ()) or m_lockTxFreq or ctrl) + if (((firstcall!=m_config.my_callsign ()) or m_lockTxFreq or ctrl) and ui->TxFreqSpinBox->isEnabled ()) ui->TxFreqSpinBox->setValue(frequency); if (decodedtext.isJT9()) @@ -1929,6 +1927,7 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl) ui->rbGenMsg->setChecked(true); } } + if(m_transmitting) m_restart=true; if(m_config.quick_call ()) { auto_tx_mode (true); @@ -2288,7 +2287,7 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button , m_rptSent , m_rptRcvd , m_dateTimeQSO - , (m_dialFreq + m_txFreq) / 1.e6 + , (m_dialFreq + ui->TxFreqSpinBox->value ()) / 1.e6 , m_config.my_callsign () , m_config.my_grid () , m_noSuffix @@ -2301,7 +2300,7 @@ void MainWindow::acceptQSO2(bool accepted) { if(accepted) { - QString band = ADIF::bandFromFrequency ((m_dialFreq + m_txFreq) / 1.e6); + QString band = ADIF::bandFromFrequency ((m_dialFreq + ui->TxFreqSpinBox->value ()) / 1.e6); QString date = m_dateTimeQSO.toString("yyyy-MM-dd"); date=date.mid(0,4) + date.mid(5,2) + date.mid(8,2); m_logBook.addAsWorked(m_hisCall,band,m_modeTx,date); @@ -2394,17 +2393,19 @@ void MainWindow::on_actionJT9_JT65_triggered() void MainWindow::on_TxFreqSpinBox_valueChanged(int n) { - m_txFreq=n; m_wideGraph->setTxFreq(n); if(m_lockTxFreq) ui->RxFreqSpinBox->setValue(n); - Q_EMIT transmitFrequency (m_txFreq - m_XIT); + Q_EMIT transmitFrequency (n - m_XIT); } void MainWindow::on_RxFreqSpinBox_valueChanged(int n) { - m_rxFreq=n; m_wideGraph->setRxFreq(n); - if(m_lockTxFreq) ui->TxFreqSpinBox->setValue(n); + + if (m_lockTxFreq && ui->TxFreqSpinBox->isEnabled ()) + { + ui->TxFreqSpinBox->setValue (n); + } } void MainWindow::on_actionQuickDecode_triggered() @@ -2662,7 +2663,6 @@ void MainWindow::on_stopTxButton_clicked() //Stop Tx auto_tx_mode (false); } - m_transmitting = false; m_btxok=false; m_repeatMsg=0; } @@ -2679,13 +2679,18 @@ void MainWindow::rigOpen () void MainWindow::on_pbR2T_clicked() { - int n=m_wideGraph->rxFreq(); - ui->TxFreqSpinBox->setValue(n); + if (ui->TxFreqSpinBox->isEnabled ()) + { + ui->TxFreqSpinBox->setValue(ui->RxFreqSpinBox->value ()); + } } void MainWindow::on_pbT2R_clicked() { - m_wideGraph->setRxFreq(m_txFreq); + if (ui->RxFreqSpinBox->isEnabled ()) + { + ui->RxFreqSpinBox->setValue (ui->TxFreqSpinBox->value ()); + } } @@ -2731,15 +2736,20 @@ void MainWindow::setXIT(int n) } } - Q_EMIT transmitFrequency (m_txFreq - m_XIT); + Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value () - m_XIT); } void MainWindow::setFreq4(int rxFreq, int txFreq) { - m_rxFreq=rxFreq; - m_txFreq=txFreq; - ui->RxFreqSpinBox->setValue(m_rxFreq); - ui->TxFreqSpinBox->setValue(m_txFreq); + if (ui->RxFreqSpinBox->isEnabled ()) + { + ui->RxFreqSpinBox->setValue(rxFreq); + } + + if (ui->TxFreqSpinBox->isEnabled ()) + { + ui->TxFreqSpinBox->setValue(txFreq); + } } void MainWindow::on_cbTxLock_clicked(bool checked) @@ -2773,6 +2783,14 @@ void MainWindow::on_cbPlus2kHz_toggled(bool checked) void MainWindow::handle_transceiver_update (Transceiver::TransceiverState s) { + static bool prior_ptt {false}; + + if (!s.ptt () && prior_ptt) + { + transmitDisplay (false); + } + prior_ptt = s.ptt (); + if ((s.frequency () - m_dialFreq) || s.split () != m_splitMode) { m_splitMode = s.split (); @@ -2821,11 +2839,11 @@ void MainWindow::transmit (double snr) { if (m_modeTx == "JT65") { - Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, m_txFreq - m_XIT, m_toneSpacing, &m_soundOutput, m_config.audio_output_channel (), true, snr); + Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, ui->TxFreqSpinBox->value () - m_XIT, m_toneSpacing, &m_soundOutput, m_config.audio_output_channel (), true, snr); } else { - Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, m_txFreq - m_XIT, m_toneSpacing, &m_soundOutput, m_config.audio_output_channel (), true, snr); + Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, ui->TxFreqSpinBox->value () - m_XIT, m_toneSpacing, &m_soundOutput, m_config.audio_output_channel (), true, snr); } } @@ -2951,3 +2969,45 @@ void MainWindow::pskSetLocal () , m_config.my_grid () , antenna_description, "WSJT-X " + m_revision); } + +void MainWindow::transmitDisplay (bool transmitting) +{ + if (transmitting) + { + signalMeter->setValue(0); + + if (m_monitoring) + { + monitor (false); + } + + m_btxok=true; + } + + auto QSY_allowed = !transmitting || m_config.tx_QSY_allowed (); + if (ui->cbTxLock->isChecked ()) + { + ui->RxFreqSpinBox->setEnabled (QSY_allowed); + ui->pbT2R->setEnabled (QSY_allowed); + } + ui->TxFreqSpinBox->setEnabled (QSY_allowed); + ui->pbR2T->setEnabled (QSY_allowed); + ui->cbTxLock->setEnabled (QSY_allowed); + ui->cbPlus2kHz->setEnabled (QSY_allowed); + + // the following are always disallowed in transmit + ui->menuMode->setEnabled (!transmitting); + ui->bandComboBox->setEnabled (!transmitting); + if (!transmitting) + { + if ("JT9+JT65" == m_mode) + { + // allow mode switch in Rx when in dual mode + ui->pbTxMode->setEnabled (true); + } + } + else + { + ui->pbTxMode->setEnabled (false); + } +} diff --git a/mainwindow.h b/mainwindow.h index 78da98615..a0d03a6e3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -220,8 +220,6 @@ private: qint32 m_waterfallAvg; qint32 m_ntx; qint32 m_timeout; - qint32 m_rxFreq; - qint32 m_txFreq; int m_XIT; qint32 m_setftx; qint32 m_ndepth; @@ -389,6 +387,7 @@ private: void rigFailure (QString const& reason, QString const& detail); void pskSetLocal (); void displayDialFrequency (); + void transmitDisplay (bool); }; extern void getfile(QString fname, int ntrperiod); diff --git a/plotter.cpp b/plotter.cpp index 69461cb8c..0e71e3eb9 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -399,18 +399,9 @@ int CPlotter::binsPerPixel() // get nbpp return m_binsPerPixel; } -void CPlotter::setRxFreq(int x, bool bf) //setRxFreq() +void CPlotter::setRxFreq (int x) { - if(bf) { - m_rxFreq=x; // x is freq in Hz - m_xClick=XfromFreq(m_rxFreq); - } else { - if(x<0) x=0; // x is pixel number - if(x>m_Size.width()) x=m_Size.width(); - m_rxFreq=int(FreqfromX(x)+0.5); - m_xClick=x; - } - emit setFreq1(m_rxFreq,m_txFreq); + m_rxFreq = x; // x is freq in Hz DrawOverlay(); update(); } @@ -420,18 +411,22 @@ int CPlotter::rxFreq() {return m_rxFreq;} //get rxFreq void CPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent { int x=event->x(); - setRxFreq(x,false); // Wideband waterfall + if(x<0) x=0; + if(x>m_Size.width()) x=m_Size.width(); bool ctrl = (event->modifiers() & Qt::ControlModifier); + int freq = int(FreqfromX(x)+0.5); + int tx_freq = m_txFreq; + if (ctrl or m_lockTxFreq) tx_freq = freq; + + emit setFreq1 (freq, tx_freq); + int n=1; if(ctrl) n+=100; emit freezeDecode1(n); - if(ctrl or m_lockTxFreq) setTxFreq(m_rxFreq); } void CPlotter::mouseDoubleClickEvent(QMouseEvent *event) //mouse2click { -// int x=event->x(); -// setRxFreq(x,false); bool ctrl = (event->modifiers() & Qt::ControlModifier); int n=2; if(ctrl) n+=100; @@ -464,7 +459,6 @@ void CPlotter::setNsps(int ntrperiod, int nsps) void CPlotter::setTxFreq(int n) //setTol() { m_txFreq=n; - emit setFreq1(m_rxFreq,m_txFreq); DrawOverlay(); update(); } diff --git a/plotter.h b/plotter.h index b824cc2c1..9589cacee 100644 --- a/plotter.h +++ b/plotter.h @@ -48,7 +48,7 @@ public: void setRxRange(int fMin); void setBinsPerPixel(int n); int binsPerPixel(); - void setRxFreq(int n, bool bf); + void setRxFreq(int n); void DrawOverlay(); int rxFreq(); void setFsample(int n); diff --git a/widegraph.cpp b/widegraph.cpp index 3212bc37b..d5d13d1f5 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -214,9 +214,8 @@ void WideGraph::keyPressEvent(QKeyEvent *e) void WideGraph::setRxFreq(int n) { - m_rxFreq=n; - ui->widePlot->setRxFreq(m_rxFreq,true); - if(m_lockTxFreq) setTxFreq(m_rxFreq); + ui->widePlot->setRxFreq(n); + if(m_lockTxFreq) setTxFreq(n); } int WideGraph::rxFreq() @@ -322,14 +321,11 @@ void WideGraph::setLockTxFreq(bool b) void WideGraph::setFreq2(int rxFreq, int txFreq) { - m_rxFreq=rxFreq; - m_txFreq=txFreq; emit setFreq3(rxFreq,txFreq); } void WideGraph::setDialFreq(double d) { - m_dialFreq=d; ui->widePlot->setDialFreq(d); } diff --git a/widegraph.h b/widegraph.h index 3ba972336..edd106d40 100644 --- a/widegraph.h +++ b/widegraph.h @@ -77,11 +77,6 @@ private: QDir m_palettes_path; WFPalette m_userPalette; - qint32 m_rxFreq; - qint32 m_txFreq; - - double m_dialFreq; - qint32 m_waterfallAvg; qint32 m_fSample; qint32 m_TRperiod;