Do not make unneeded rig adjustments when Doppler tracking disabled

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5595 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-06-12 00:26:44 +00:00
parent 98f84a5902
commit 588c037ae9
4 changed files with 45 additions and 19 deletions

View File

@ -36,6 +36,7 @@ Astro::Astro(QSettings * settings, Configuration const * configuration, QWidget
setWindowTitle (QApplication::applicationName () + " - " + tr ("Astronomical Data"));
setStyleSheet ("QWidget {background: white;}");
connect (ui_->cbDopplerTracking, &QAbstractButton::toggled, ui_->doppler_widget, &QWidget::setVisible);
connect (ui_->cbDopplerTracking, &QAbstractButton::toggled, this, &Astro::doppler_tracking_toggled);
read_settings ();
ui_->text_label->clear ();
}
@ -222,3 +223,8 @@ void Astro::on_HzSpinBox_valueChanged(int n)
{
m_Hz=n;
}
bool Astro::doppler_tracking () const
{
return ui_->cbDopplerTracking->isChecked ();
}

View File

@ -24,6 +24,8 @@ public:
~Astro ();
FrequencyDelta astroUpdate(QDateTime const& t, QString const& mygrid, QString const& hisgrid, Frequency frequency,
bool dx_is_self, bool bTx);
bool doppler_tracking () const;
Q_SIGNAL void doppler_tracking_toggled (bool);
protected:
void closeEvent (QCloseEvent *) override;

View File

@ -1362,6 +1362,8 @@ void MainWindow::on_actionAstronomical_data_triggered()
// hook up termination signal
connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close);
connect (m_astroWidget.data (), &Astro::doppler_tracking_toggled
, this, &MainWindow::DopplerTracking_toggled);
}
m_astroWidget->showNormal();
m_astroWidget->raise ();
@ -2147,23 +2149,9 @@ void MainWindow::guiUpdate()
if(m_monitoring or m_transmitting) ipct=int(100*m_nseq/txDuration);
progressBar->setValue(ipct);
}
QDateTime t = QDateTime::currentDateTimeUtc();
if (m_astroWidget) {
auto astro_correction = m_astroWidget->astroUpdate(t, m_config.my_grid (), m_hisGrid
, m_dialFreq, "Echo" == m_mode, m_transmitting);
if (!m_bSimplex // only adjust frequency if allowed by mode
&& m_dialFreq >= 50000000) { // and above 50MHz
if(m_transmitting) {
m_dialFreqTx = m_freqNominal + astro_correction;
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreqTx));
Q_EMIT m_config.transceiver_tx_frequency (m_dialFreqTx);
} else {
m_dialFreq = m_freqNominal + astro_correction;
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq));
Q_EMIT m_config.transceiver_frequency(m_dialFreq);
}
}
}
astroCalculations (t, m_astroWidget && m_astroWidget->doppler_tracking ());
if(m_transmitting) {
char s[37];
@ -4344,3 +4332,31 @@ void MainWindow::on_tabWidget_currentChanged (int new_value)
m_nonWSPRTab = new_value;
}
}
void MainWindow::DopplerTracking_toggled (bool enabled)
{
if (!enabled) {
// do one astro update and last adjustment
astroCalculations (QDateTime::currentDateTimeUtc(), true);
}
}
void MainWindow::astroCalculations (QDateTime const& time, bool adjust) {
if (m_astroWidget) {
auto astro_correction = m_astroWidget->astroUpdate(time, m_config.my_grid (), m_hisGrid
, m_dialFreq, "Echo" == m_mode, m_transmitting);
if (adjust && !m_bSimplex // only adjust frequency if
// requested and allowed by mode
&& m_dialFreq >= 50000000) { // and above 50MHz
if(m_transmitting) {
m_dialFreqTx = m_freqNominal + astro_correction;
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreqTx));
Q_EMIT m_config.transceiver_tx_frequency (m_dialFreqTx);
} else {
m_dialFreq = m_freqNominal + astro_correction;
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq));
Q_EMIT m_config.transceiver_frequency(m_dialFreq);
}
}
}
}

View File

@ -234,6 +234,7 @@ private slots:
void on_actionEcho_Graph_triggered();
void on_actionEcho_triggered();
void DopplerTracking_toggled (bool);
private:
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
@ -509,6 +510,7 @@ private:
void enable_DXCC_entity (bool on);
void switch_mode (Mode);
void WSPR_scheduling ();
void astroCalculations (QDateTime const&, bool adjust);
};
extern void getfile(QString fname, int ntrperiod);