From 059831534c7e884f0a607ed86b582fd00d821731 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sat, 26 Sep 2026 23:24:03 +0200 Subject: New upstream version 3.2.0~rc1+dfsg --- widgets/astro.cpp | 82 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 10 deletions(-) (limited to 'widgets/astro.cpp') diff --git a/widgets/astro.cpp b/widgets/astro.cpp index c96eee6e..dcdbac44 100644 --- a/widgets/astro.cpp +++ b/widgets/astro.cpp @@ -1,7 +1,5 @@ #include "astro.h" -#include - #include #include #include @@ -13,8 +11,6 @@ #include #include -#include "commons.h" -#include "MessageBox.hpp" #include "Configuration.hpp" #include "SettingsGroup.hpp" #include "qt_helpers.hpp" @@ -32,7 +28,15 @@ extern "C" { int * ndop, int * ndop00, double * ramoon, double * decmoon, double * dgrd, double * poloffset, double * xnr, bool extraazel, double * techo, double * width1, double * width2, bool bTx, const char * AzElFileName, - const char * jpleph); + const char * jpleph, int * ephemeris_result); +} + +namespace +{ + constexpr int ephemeris_jpl = 0; + constexpr int ephemeris_analytic_fallback = 1; + constexpr int ephemeris_invalid_input = 2; + constexpr int ephemeris_unavailable = 3; } Astro::Astro(QSettings * settings, Configuration const * configuration, QWidget * parent) @@ -110,7 +114,7 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const Frequency freq_moon {freq}; double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx; double ramoon,decmoon,dgrd,poloffset,xnr,techo,width1,width2; - int ntsky; + int ntsky, ephemeris_result; QString date {t.date().toString("yyyy MMM dd").trimmed ()}; QString utc {t.time().toString().trimmed ()}; int nyear {t.date().year()}; @@ -125,15 +129,56 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const auto const& jpleph = configuration_->data_dir ().absoluteFilePath ("JPLEPH"); SettingsGroup g (settings_, "Configuration"); bool extraazel=settings_->value("AzElExtraLines",false).toBool(); + + // changed argument from &dgrd to &m_dgrd added for Bob KA1GT astrosub(nyear, month, nday, uth, static_cast (freq_moon), mygrid.toLatin1 ().data (), hisgrid.toLatin1().data(), &azsun, &elsun, &azmoon, &elmoon, &azmoondx, &elmoondx, &ntsky, &m_dop, &m_dop00, &ramoon, &decmoon, - &dgrd, &poloffset, &xnr, extraazel, &techo, &width1, &width2, + &m_dgrd, &poloffset, &xnr, extraazel, &techo, &width1, &width2, bTx, AzElFileName.toLocal8Bit ().constData (), - jpleph.toLocal8Bit ().constData ()); + jpleph.toLocal8Bit ().constData (), &ephemeris_result); + + auto report_ephemeris_transition = [this] (int result) + { + if (result == m_ephemeris_result) + { + return; + } + if (result == ephemeris_analytic_fallback) + { + qWarning () << "JPL ephemeris unavailable; using analytic fallback"; + } + else if (result == ephemeris_invalid_input) + { + qWarning () << "Invalid astronomical date or time"; + } + else if (result == ephemeris_unavailable) + { + qWarning () << "No valid lunar ephemeris result"; + } + else if (result == ephemeris_jpl && m_ephemeris_result >= 0) + { + qInfo () << "JPL ephemeris available again"; + } + m_ephemeris_result = result; + }; + + report_ephemeris_transition (ephemeris_result); + if (ephemeris_result == ephemeris_invalid_input) + { + ui_->text_label->setText (" " + date + "\nUTC: " + utc + + "\nEphem: Invalid input"); + return {}; + } + if (ephemeris_result == ephemeris_unavailable) + { + ui_->text_label->setText (" " + date + "\nUTC: " + utc + + "\nEphem: Unavailable"); + return {}; + } QString message; { @@ -162,12 +207,16 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const "SunAz: " << azsun << "\n" "SunEl: " << elsun << "\n" "Freq: " << freq / 1.e6 << "\n"; + if (ephemeris_result == ephemeris_analytic_fallback) + { + out << "Ephem: Analytic fallback\n"; + } if(freq>=5000000ull) { //Suppress data not relevant below VHF out << "Tsky: " << ntsky << "\n" "Dpol: " << poloffset << "\n" "MNR: " << xnr << "\n" "Dist: " << int((techo*149896)) << "\n" //wdg - "Dgrd: " << dgrd; + "Dgrd: " << m_dgrd; //changed dgrd to m_dgrd added for Bob KA1GT } } ui_->text_label->setText(message); @@ -265,7 +314,14 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const &dgrd, &poloffset, &xnr, extraazel, &techo, &width1, &width2, bTx, nullptr, // don't overwrite azel.dat - jpleph.toLocal8Bit ().constData ()); + jpleph.toLocal8Bit ().constData (), &ephemeris_result); + + report_ephemeris_transition (ephemeris_result); + if (ephemeris_result == ephemeris_invalid_input + || ephemeris_result == ephemeris_unavailable) + { + return {}; + } FrequencyDelta offset {0}; switch (m_DopplerMethod) @@ -303,6 +359,12 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const return correction; } +//added for Bob KA1GT +double Astro::getDgrd() const +{ + return m_dgrd; +} + void Astro::check_split () { /* TEMPORARILY DISABLE -- cgit v1.2.3