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

37
astro.h
View File

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

555
astro.ui
View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>325</width>
<height>445</height> <height>339</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -16,359 +16,240 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <layout class="QGridLayout" name="gridLayout">
<size> <property name="sizeConstraint">
<width>200</width> <enum>QLayout::SetFixedSize</enum>
<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>
</property> </property>
<property name="sizePolicy"> <item row="0" column="0">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <layout class="QVBoxLayout" name="verticalLayout_3">
<horstretch>0</horstretch> <item alignment="Qt::AlignHCenter">
<verstretch>0</verstretch> <widget class="QLabel" name="text_label">
</sizepolicy> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<property name="maximumSize"> <horstretch>1</horstretch>
<size> <verstretch>0</verstretch>
<width>300</width> </sizepolicy>
<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>
</property> </property>
<property name="minimumSize"> <property name="font">
<size> <font>
<width>75</width> <family>Courier</family>
<height>0</height> <pointsize>12</pointsize>
</size> <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>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
<property name="suffix"> <property name="margin">
<string> kHz</string> <number>6</number>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>200</number>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="HzSpinBox"> </item>
<property name="geometry"> <item>
<rect> <layout class="QHBoxLayout" name="horizontalLayout">
<x>100</x> <item>
<y>20</y> <widget class="QCheckBox" name="cbDopplerTracking">
<width>75</width> <property name="styleSheet">
<height>22</height> <string notr="true"/>
</rect> </property>
</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">
<property name="text"> <property name="text">
<string>Full Doppler to DX Grid</string> <string>Doppler tracking</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>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </item>
</item> </layout>
<item> </item>
<widget class="QGroupBox" name="groupBox_2"> <item row="0" column="1">
<property name="minimumSize"> <widget class="QWidget" name="doppler_widget" native="true">
<size> <property name="styleSheet">
<width>196</width> <string notr="true">* {
<height>0</height> font-weight: normal;
</size> }</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>7</number>
</property> </property>
<property name="maximumSize"> <property name="leftMargin">
<size> <number>0</number>
<width>16777215</width>
<height>90</height>
</size>
</property> </property>
<property name="title"> <property name="topMargin">
<string>Transceiver step size</string> <number>0</number>
</property> </property>
<widget class="QRadioButton" name="rb1Hz"> <property name="rightMargin">
<property name="geometry"> <number>0</number>
<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> </property>
<property name="maximumSize"> <property name="bottomMargin">
<size> <number>0</number>
<width>16777215</width>
<height>60</height>
</size>
</property> </property>
<property name="title"> <item>
<string>Tx audio tracking</string> <widget class="QGroupBox" name="groupBox_4">
</property> <property name="title">
<widget class="QCheckBox" name="cbTxAudioTrack"> <string>Frequency above nominal band edge</string>
<property name="enabled"> </property>
<bool>false</bool> <layout class="QHBoxLayout" name="horizontalLayout_3">
</property> <item>
<property name="geometry"> <widget class="QSpinBox" name="kHzSpinBox">
<rect> <property name="alignment">
<x>20</x> <set>Qt::AlignCenter</set>
<y>20</y> </property>
<width>105</width> <property name="suffix">
<height>17</height> <string> kHz</string>
</rect> </property>
</property> <property name="maximum">
<property name="text"> <number>999</number>
<string>Enable</string> </property>
</property> <property name="value">
</widget> <number>200</number>
</widget> </property>
</item> </widget>
<item> </item>
<spacer name="verticalSpacer"> <item>
<property name="orientation"> <widget class="QSpinBox" name="HzSpinBox">
<enum>Qt::Vertical</enum> <property name="alignment">
</property> <set>Qt::AlignCenter</set>
<property name="sizeType"> </property>
<enum>QSizePolicy::Fixed</enum> <property name="suffix">
</property> <string> Hz</string>
<property name="sizeHint" stdset="0"> </property>
<size> <property name="minimum">
<width>20</width> <number>-2000</number>
<height>44</height> </property>
</size> <property name="maximum">
</property> <number>2000</number>
</spacer> </property>
</item> <property name="singleStep">
</layout> <number>100</number>
</widget> </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> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -432,15 +432,11 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
m_DTtol=0.5; m_DTtol=0.5;
m_wideGraph->setTol(m_tol); m_wideGraph->setTol(m_tol);
m_bShMsgs=false; m_bShMsgs=false;
m_bDopplerTracking0=false;
m_bTxTime=false; m_bTxTime=false;
m_rxDone=false; m_rxDone=false;
m_bHaveTransmitted=false; m_bHaveTransmitted=false;
m_bEchoTxOK=false; m_bEchoTxOK=false;
m_bTransmittedEcho=false; m_bTransmittedEcho=false;
m_nDop=0;
m_nDop00=0;
m_nDopr=0;
m_nclearave=1; m_nclearave=1;
signalMeter = new SignalMeter(ui->meterFrame); signalMeter = new SignalMeter(ui->meterFrame);
@ -962,7 +958,6 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
{ {
Q_EMIT m_config.transceiver_frequency (m_dialFreq); 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) void MainWindow::on_monitorButton_clicked (bool checked)
@ -1223,11 +1218,7 @@ void MainWindow::displayDialFrequency ()
valid = true; valid = true;
} }
ui->labDialFreq->setProperty ("oob", !valid); update_dynamic_property (ui->labDialFreq, "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 ();
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq)); ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq));
} }
@ -1357,13 +1348,12 @@ void MainWindow::on_actionAstronomical_data_triggered()
{ {
if (!m_astroWidget) if (!m_astroWidget)
{ {
m_astroWidget.reset (new Astro {m_settings}); m_astroWidget.reset (new Astro {m_settings, &m_config});
// hook up termination signal // hook up termination signal
connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close); connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close);
} }
m_astroWidget->showNormal(); m_astroWidget->showNormal();
m_astroWidget->m_azelDir=m_config.azel_directory();
} }
void MainWindow::on_actionMessage_averaging_triggered() void MainWindow::on_actionMessage_averaging_triggered()
@ -2137,28 +2127,6 @@ void MainWindow::guiUpdate()
on_actionOpen_next_in_directory_triggered(); 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( if(m_auto and m_mode=="Echo" and m_bEchoTxOK) progressBar->setValue(
int(100*m_s6/6.0)); int(100*m_s6/6.0));
@ -2169,53 +2137,17 @@ void MainWindow::guiUpdate()
progressBar->setValue(ipct); progressBar->setValue(ipct);
} }
QDateTime t = QDateTime::currentDateTimeUtc(); QDateTime t = QDateTime::currentDateTimeUtc();
if(m_astroWidget) { if (m_astroWidget) {
m_freqMoon=m_dialFreq + 1000*m_astroWidget->m_kHz + m_astroWidget->m_Hz; auto astro_correction = m_astroWidget->astroUpdate(t, m_config.my_grid (), m_hisGrid
m_astroWidget->astroUpdate(t, m_config.my_grid (), m_hisGrid,m_freqMoon, , m_dialFreq, "Echo" == m_mode, m_transmitting);
&m_nDop, &m_nDop00, m_transmitting, if(m_transmitting) {
m_config.data_dir().absoluteFilePath("JPLEPH")); m_dialFreqTx = m_freqNominal + astro_correction;
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreqTx));
//Apply Doppler corrections only for 50 MHz and above Q_EMIT m_config.transceiver_tx_frequency (m_dialFreqTx);
if(m_freqNominal>=50000000) { } else {
m_dialFreq = m_freqNominal + astro_correction;
if(m_astroWidget->m_bDopplerTracking) { ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq));
Q_EMIT m_config.transceiver_frequency(m_dialFreq);
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);
}
}
} }
} }

View File

@ -327,15 +327,10 @@ private:
qint32 m_MinW; qint32 m_MinW;
qint32 m_tol; qint32 m_tol;
qint32 m_nclearave; qint32 m_nclearave;
qint32 m_DopplerMethod;
qint32 m_DopplerMethod0;
qint32 m_minSync; qint32 m_minSync;
qint32 m_dBm; qint32 m_dBm;
qint32 m_pctx; qint32 m_pctx;
qint32 m_nseq; 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_btxok; //True if OK to transmit
bool m_diskData; bool m_diskData;
@ -380,8 +375,6 @@ private:
bool m_bAstroData; bool m_bAstroData;
bool m_bEME; bool m_bEME;
bool m_bShMsgs; bool m_bShMsgs;
bool m_bDopplerTracking;
bool m_bDopplerTracking0;
bool m_uploadSpots; bool m_uploadSpots;
bool m_uploading; bool m_uploading;
bool m_txNext; bool m_txNext;