Refactor astro functionality into Astro class

Improved astronomical data and Doppler tracking control window widgets
and layout  management to make  it more platform independent  and font
change tolerant.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5580 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-06-11 13:36:13 +00:00
parent e1728a9674
commit aa561deed2
5 changed files with 321 additions and 491 deletions

119
astro.cpp
View File

@ -13,24 +13,31 @@
#include <QDebug>
#include "commons.h"
#include "Configuration.hpp"
#include "SettingsGroup.hpp"
#include "qt_helpers.hpp"
#include "ui_astro.h"
#include "moc_astro.cpp"
Astro::Astro(QSettings * settings, QWidget * parent)
: QWidget {parent}
Astro::Astro(QSettings * settings, Configuration const * configuration, QWidget * parent)
: QWidget {parent, Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint}
, settings_ {settings}
, configuration_ {configuration}
, ui_ {new Ui::Astro}
, m_bRxAudioTrack {false}
, m_bTxAudioTrack {false}
, m_DopplerMethod {0}
, m_kHz {0}
, m_Hz {0}
, m_stepHz {1}
{
ui_->setupUi(this);
setWindowFlags (Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
setWindowTitle(QApplication::applicationName () + " - " + tr ("Astronomical Data"));
ui_->setupUi (this);
setWindowTitle (QApplication::applicationName () + " - " + tr ("Astronomical Data"));
setStyleSheet ("QWidget {background: white;}");
connect (ui_->cbDopplerTracking, &QAbstractButton::toggled, ui_->doppler_widget, &QWidget::setVisible);
read_settings ();
m_Hz=0;
ui_->text_label->clear();
ui_->text_label->clear ();
}
Astro::~Astro ()
@ -46,10 +53,10 @@ void Astro::closeEvent (QCloseEvent * e)
void Astro::read_settings ()
{
settings_->beginGroup ("Astro");
SettingsGroup g (settings_, "Astro");
restoreGeometry (settings_->value ("geometry", saveGeometry ()).toByteArray ());
m_bDopplerTracking=settings_->value("DopplerTracking",false).toBool();
ui_->cbDopplerTracking->setChecked(m_bDopplerTracking);
ui_->cbDopplerTracking->setChecked (settings_->value ("DopplerTracking",false).toBool ());
ui_->doppler_widget->setVisible (ui_->cbDopplerTracking->isChecked ());
m_DopplerMethod=settings_->value("DopplerMethod",0).toInt();
if(m_DopplerMethod==0) ui_->rbNoDoppler->setChecked(true);
if(m_DopplerMethod==1) ui_->rbFullTrack->setChecked(true);
@ -64,47 +71,48 @@ void Astro::read_settings ()
m_bTxAudioTrack=settings_->value("TxAudioTrack",false).toBool();
ui_->cbTxAudioTrack->setChecked(m_bTxAudioTrack);
move (settings_->value ("window/pos", pos ()).toPoint ());
settings_->endGroup ();
}
void Astro::write_settings ()
{
settings_->beginGroup ("Astro");
SettingsGroup g (settings_, "Astro");
settings_->setValue ("geometry", saveGeometry ());
settings_->setValue ("DopplerTracking",m_bDopplerTracking);
settings_->setValue ("DopplerTracking", ui_->cbDopplerTracking->isChecked ());
settings_->setValue ("DopplerMethod",m_DopplerMethod);
settings_->setValue ("StepHz",m_stepHz);
settings_->setValue ("kHzAdd",m_kHz);
settings_->setValue ("RxAudioTrack",m_bRxAudioTrack);
settings_->setValue ("TxAudioTrack",m_bTxAudioTrack);
settings_->setValue ("window/pos", pos ());
settings_->endGroup ();
}
void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, qint64 freqMoon,
qint32* ndop, qint32* ndop00, bool bTx, QString jpleph)
auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const& hisgrid, Frequency freq,
bool dx_is_self, bool bTx) -> FrequencyDelta
{
Frequency freq_moon {freq + 1000 * m_kHz + m_Hz};
double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx;
double ramoon,decmoon,dgrd,poloffset,xnr,techo,width1,width2;
int ntsky;
QString date = t.date().toString("yyyy MMM dd").trimmed ();
QString utc = t.time().toString().trimmed ();
int nyear=t.date().year();
int month=t.date().month();
int nday=t.date().day();
int nhr=t.time().hour();
int nmin=t.time().minute();
double sec=t.time().second() + 0.001*t.time().msec();
double uth=nhr + nmin/60.0 + sec/3600.0;
if(freqMoon < 1) freqMoon=144000000;
int nfreq=freqMoon/1000000;
double freq8=(double)freqMoon;
QString AzElFileName = QDir::toNativeSeparators(m_azelDir.absoluteFilePath ("azel.dat"));
QString date {t.date().toString("yyyy MMM dd").trimmed ()};
QString utc {t.time().toString().trimmed ()};
int nyear {t.date().year()};
int month {t.date().month()};
int nday {t.date().day()};
int nhr {t.time().hour()};
int nmin {t.time().minute()};
double sec {t.time().second() + 0.001*t.time().msec()};
double uth {nhr + nmin/60.0 + sec/3600.0};
if(freq_moon < 1) freq_moon = 144000000;
int nfreq {static_cast<int> (freq_moon / 1000000u)};
double freq8 {static_cast<double> (freq_moon)};
auto const& AzElFileName = QDir::toNativeSeparators (configuration_->azel_directory ().absoluteFilePath ("azel.dat"));
auto const& jpleph = configuration_->data_dir ().absoluteFilePath ("JPLEPH");
int ndop;
int ndop00;
astrosub_(&nyear, &month, &nday, &uth, &freq8, mygrid.toLatin1().constData(),
hisgrid.toLatin1().constData(), &azsun, &elsun, &azmoon, &elmoon,
&azmoondx, &elmoondx, &ntsky, ndop, ndop00, &ramoon, &decmoon,
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00, &ramoon, &decmoon,
&dgrd, &poloffset, &xnr, &techo, &width1, &width2, &bTx,
AzElFileName.toLatin1().constData(), jpleph.toLatin1().constData(), 6, 6,
AzElFileName.length(), jpleph.length());
@ -120,14 +128,14 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, qint64 fre
<< qSetRealNumberPrecision (1)
<< "Az: " << azmoon << "\n"
"El: " << elmoon << "\n"
"SelfDop:" << *ndop00 << "\n"
"SelfDop:" << ndop00 << "\n"
"Width: " << int(width1) << "\n"
<< qSetRealNumberPrecision (2)
<< "Delay: " << techo << "\n"
<< qSetRealNumberPrecision (1)
<< "DxAz: " << azmoondx << "\n"
"DxEl: " << elmoondx << "\n"
"DxDop: " << *ndop << "\n"
"DxDop: " << ndop << "\n"
"DxWid: " << int(width2) << "\n"
"Dec: " << decmoon << "\n"
"SunAz: " << azsun << "\n"
@ -192,18 +200,40 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, qint64 fre
}
f.close();
*/
}
void Astro::on_cbDopplerTracking_toggled(bool b)
{
QRect g=this->geometry();
if(b) {
g.setWidth(430);
} else {
g.setWidth(200);
FrequencyDelta astro_correction {0};
//Apply Doppler corrections only for 50 MHz and above
if (freq_moon >= 50000000) {
if (ui_->cbDopplerTracking->isChecked ()) {
switch (m_DopplerMethod)
{
case 1:
// All Doppler correction done here; DX station stays at nominal dial frequency.
if(dx_is_self) {
astro_correction = m_stepHz*qRound(double(ndop00)/m_stepHz);
} else {
astro_correction = m_stepHz*qRound(double(ndop)/m_stepHz);
}
break;
case 2:
// Doppler correction to constant frequency on Moon
astro_correction = m_stepHz*qRound(double(ndop00/2.0)/m_stepHz);
break;
}
if (bTx) {
astro_correction = 1000 * m_kHz + m_Hz - astro_correction;
} else {
if(dx_is_self && m_DopplerMethod==1) {
astro_correction = 1000*m_kHz + m_Hz;
} else {
astro_correction += 1000*m_kHz + m_Hz;
}
}
}
}
this->setGeometry(g);
m_bDopplerTracking=b;
return astro_correction;
}
void Astro::on_rbFullTrack_clicked()
@ -229,7 +259,6 @@ void Astro::on_rb1Hz_clicked()
void Astro::on_rb10Hz_clicked()
{
m_stepHz=10;
}
void Astro::on_rb100Hz_clicked()

37
astro.h
View File

@ -3,10 +3,10 @@
#define ASTRO_H
#include <QWidget>
#include <QDir>
#include "Radio.hpp"
class QSettings;
class Configuration;
namespace Ui {
class Astro;
}
@ -16,31 +16,19 @@ class Astro final
{
Q_OBJECT;
private:
Q_DISABLE_COPY (Astro);
using Frequency = Radio::Frequency;
using FrequencyDelta = Radio::FrequencyDelta;
public:
explicit Astro(QSettings * settings, QWidget * parent = nullptr);
explicit Astro(QSettings * settings, Configuration const *, QWidget * parent = nullptr);
~Astro ();
void astroUpdate(QDateTime t, QString mygrid, QString hisgrid, qint64 freqMoon,
qint32* ndop, qint32 *ndop00, bool bTx, QString jpleph);
bool m_bDopplerTracking;
bool m_bRxAudioTrack;
bool m_bTxAudioTrack;
qint32 m_DopplerMethod;
qint32 m_kHz;
qint32 m_Hz;
qint32 m_stepHz;
QDir m_azelDir;
FrequencyDelta astroUpdate(QDateTime const& t, QString const& mygrid, QString const& hisgrid, Frequency frequency,
bool dx_is_self, bool bTx);
protected:
void closeEvent (QCloseEvent *) override;
private slots:
void on_cbDopplerTracking_toggled(bool b);
void on_rbConstFreqOnMoon_clicked();
void on_rbFullTrack_clicked();
void on_rbNoDoppler_clicked();
@ -56,8 +44,15 @@ private:
void write_settings ();
QSettings * settings_;
// QScopedPointer<Ui::Astro> ui_;
Ui::Astro *ui_;
Configuration const * configuration_;
Ui::Astro * ui_;
bool m_bRxAudioTrack;
bool m_bTxAudioTrack;
qint32 m_DopplerMethod;
qint32 m_kHz;
qint32 m_Hz;
qint32 m_stepHz;
};
extern "C" {

555
astro.ui
View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>445</height>
<width>325</width>
<height>339</height>
</rect>
</property>
<property name="sizePolicy">
@ -16,359 +16,240 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>440</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QLabel" name="text_label">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>201</width>
<height>410</height>
</rect>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>14</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>Astro Data</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>6</number>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>1</x>
<y>410</y>
<width>195</width>
<height>22</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="cbDopplerTracking">
<property name="text">
<string>Doppler tracking</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget_1">
<property name="geometry">
<rect>
<x>200</x>
<y>12</y>
<width>198</width>
<height>411</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>196</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="title">
<string>Frequency above nominal band edge</string>
</property>
<widget class="QSpinBox" name="kHzSpinBox">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>75</width>
<height>22</height>
</rect>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="text_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">* {
font-family: Courier;
font-size: 12pt;
font-weight: bold;
}</string>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>Astro Data</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string> kHz</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>200</number>
<property name="margin">
<number>6</number>
</property>
</widget>
<widget class="QSpinBox" name="HzSpinBox">
<property name="geometry">
<rect>
<x>100</x>
<y>20</y>
<width>75</width>
<height>22</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string> Hz</string>
</property>
<property name="minimum">
<number>-2000</number>
</property>
<property name="maximum">
<number>2000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>196</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<property name="title">
<string>Doppler tracking</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="rbFullTrack">
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="cbDopplerTracking">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Full Doppler to DX Grid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbConstFreqOnMoon">
<property name="text">
<string>Constant frequency on Moon</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="rbNoDoppler">
<property name="text">
<string>None</string>
</property>
<property name="checked">
<bool>false</bool>
<string>Doppler tracking</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>196</width>
<height>0</height>
</size>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QWidget" name="doppler_widget" native="true">
<property name="styleSheet">
<string notr="true">* {
font-weight: normal;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>7</number>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>90</height>
</size>
<property name="leftMargin">
<number>0</number>
</property>
<property name="title">
<string>Transceiver step size</string>
<property name="topMargin">
<number>0</number>
</property>
<widget class="QRadioButton" name="rb1Hz">
<property name="geometry">
<rect>
<x>10</x>
<y>23</y>
<width>61</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>1 Hz</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="rb10Hz">
<property name="geometry">
<rect>
<x>10</x>
<y>46</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>10 Hz</string>
</property>
</widget>
<widget class="QRadioButton" name="rb100Hz">
<property name="geometry">
<rect>
<x>10</x>
<y>69</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>100 Hz</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="minimumSize">
<size>
<width>196</width>
<height>0</height>
</size>
<property name="rightMargin">
<number>0</number>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="title">
<string>Tx audio tracking</string>
</property>
<widget class="QCheckBox" name="cbTxAudioTrack">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>105</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Enable</string>
</property>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>44</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Frequency above nominal band edge</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSpinBox" name="kHzSpinBox">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string> kHz</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>200</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="HzSpinBox">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string> Hz</string>
</property>
<property name="minimum">
<number>-2000</number>
</property>
<property name="maximum">
<number>2000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Doppler tracking</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="rbFullTrack">
<property name="text">
<string>Full Doppler to DX Grid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbConstFreqOnMoon">
<property name="text">
<string>Constant frequency on Moon</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbNoDoppler">
<property name="text">
<string>None</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Transceiver step size</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QRadioButton" name="rb1Hz">
<property name="text">
<string>1 Hz</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb10Hz">
<property name="text">
<string>10 Hz</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb100Hz">
<property name="text">
<string>100 Hz</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Tx audio tracking</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="cbTxAudioTrack">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>

View File

@ -432,15 +432,11 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
m_DTtol=0.5;
m_wideGraph->setTol(m_tol);
m_bShMsgs=false;
m_bDopplerTracking0=false;
m_bTxTime=false;
m_rxDone=false;
m_bHaveTransmitted=false;
m_bEchoTxOK=false;
m_bTransmittedEcho=false;
m_nDop=0;
m_nDop00=0;
m_nDopr=0;
m_nclearave=1;
signalMeter = new SignalMeter(ui->meterFrame);
@ -962,7 +958,6 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
{
Q_EMIT m_config.transceiver_frequency (m_dialFreq);
}
if(m_astroWidget) m_astroWidget->m_azelDir=m_config.azel_directory();
}
void MainWindow::on_monitorButton_clicked (bool checked)
@ -1223,11 +1218,7 @@ void MainWindow::displayDialFrequency ()
valid = true;
}
ui->labDialFreq->setProperty ("oob", !valid);
// the following sequence is necessary to update the style
ui->labDialFreq->style ()->unpolish (ui->labDialFreq);
ui->labDialFreq->style ()->polish (ui->labDialFreq);
ui->labDialFreq->update ();
update_dynamic_property (ui->labDialFreq, "oob", !valid);
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq));
}
@ -1357,13 +1348,12 @@ void MainWindow::on_actionAstronomical_data_triggered()
{
if (!m_astroWidget)
{
m_astroWidget.reset (new Astro {m_settings});
m_astroWidget.reset (new Astro {m_settings, &m_config});
// hook up termination signal
connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close);
}
m_astroWidget->showNormal();
m_astroWidget->m_azelDir=m_config.azel_directory();
}
void MainWindow::on_actionMessage_averaging_triggered()
@ -2137,28 +2127,6 @@ void MainWindow::guiUpdate()
on_actionOpen_next_in_directory_triggered();
}
Frequency f;
if(m_astroWidget) {
m_bDopplerTracking = m_astroWidget->m_bDopplerTracking;
m_DopplerMethod = m_astroWidget->m_DopplerMethod;
if((m_bDopplerTracking0 and !m_bDopplerTracking) or
(m_DopplerMethod==0 and m_DopplerMethod0>0)) {
//Doppler tracking has just been turned off. Reset dial frequency to "nominal + kHz"
if(m_transmitting) {
m_dialFreqTx=m_freqNominal + 1000*m_astroWidget->m_kHz + m_astroWidget->m_Hz;
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreqTx));
Q_EMIT m_config.transceiver_tx_frequency (m_dialFreqTx);
} else {
f=m_freqNominal + 1000*m_astroWidget->m_kHz + m_astroWidget->m_Hz;
// m_dialFreq=f;
// ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq));
Q_EMIT m_config.transceiver_frequency(f);
}
}
m_bDopplerTracking0 = m_bDopplerTracking;
m_DopplerMethod0 = m_DopplerMethod;
}
if(m_auto and m_mode=="Echo" and m_bEchoTxOK) progressBar->setValue(
int(100*m_s6/6.0));
@ -2169,53 +2137,17 @@ void MainWindow::guiUpdate()
progressBar->setValue(ipct);
}
QDateTime t = QDateTime::currentDateTimeUtc();
if(m_astroWidget) {
m_freqMoon=m_dialFreq + 1000*m_astroWidget->m_kHz + m_astroWidget->m_Hz;
m_astroWidget->astroUpdate(t, m_config.my_grid (), m_hisGrid,m_freqMoon,
&m_nDop, &m_nDop00, m_transmitting,
m_config.data_dir().absoluteFilePath("JPLEPH"));
//Apply Doppler corrections only for 50 MHz and above
if(m_freqNominal>=50000000) {
if(m_astroWidget->m_bDopplerTracking) {
m_nDopr=0;
if(m_DopplerMethod==1) {
// All Doppler correction done here; DX station stays at nominal dial frequency.
if(m_mode=="Echo") {
m_nDopr=m_astroWidget->m_stepHz*qRound(double(m_nDop00)/double(
m_astroWidget->m_stepHz));
} else {
m_nDopr=m_astroWidget->m_stepHz*qRound(double(m_nDop)/double(
m_astroWidget->m_stepHz));
}
}
if(m_DopplerMethod==2) {
// Doppler correction to constant frequency on Moon
m_nDopr=m_astroWidget->m_stepHz*qRound(double(m_nDop00/2.0)/double(
m_astroWidget->m_stepHz));
}
if(m_transmitting) {
m_dialFreqTx=m_freqNominal + 1000*m_astroWidget->m_kHz +
m_astroWidget->m_Hz - m_nDopr;
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (
m_dialFreqTx));
Q_EMIT m_config.transceiver_tx_frequency (m_dialFreqTx);
} else {
if(m_mode=="Echo" and m_DopplerMethod==1) {
m_dialFreq=m_freqNominal + 1000*m_astroWidget->m_kHz +
m_astroWidget->m_Hz;
} else {
m_dialFreq=m_freqNominal + 1000*m_astroWidget->m_kHz +
m_astroWidget->m_Hz + m_nDopr;
}
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (
m_dialFreq));
Q_EMIT m_config.transceiver_frequency(m_dialFreq);
}
}
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_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

@ -327,15 +327,10 @@ private:
qint32 m_MinW;
qint32 m_tol;
qint32 m_nclearave;
qint32 m_DopplerMethod;
qint32 m_DopplerMethod0;
qint32 m_minSync;
qint32 m_dBm;
qint32 m_pctx;
qint32 m_nseq;
qint32 m_nDop; //Doppler shift of EME DX station
qint32 m_nDop00; //EME self-Doppler
qint32 m_nDopr; //Applied Doppler (rounded to nearest 1, 10 or 100 Hz)
bool m_btxok; //True if OK to transmit
bool m_diskData;
@ -380,8 +375,6 @@ private:
bool m_bAstroData;
bool m_bEME;
bool m_bShMsgs;
bool m_bDopplerTracking;
bool m_bDopplerTracking0;
bool m_uploadSpots;
bool m_uploading;
bool m_txNext;