mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 01:34:15 -05:00
Improve PSK Reporter spotting for upcoming HamSCI Festivals of Eclipse Ionospheric Science.
This commit is contained in:
parent
be4b56139f
commit
61ac076f7d
@ -32,6 +32,8 @@
|
||||
|
||||
#include "moc_PSKReporter.cpp"
|
||||
|
||||
#define DEBUGECLIPSE 0
|
||||
|
||||
namespace
|
||||
{
|
||||
QLatin1String HOST {"report.pskreporter.info"};
|
||||
@ -291,19 +293,28 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
bool PSKReporter::impl::eclipse_active(QDateTime now)
|
||||
bool PSKReporter::impl::eclipse_active(QDateTime timeutc)
|
||||
{
|
||||
#ifdef DEBUGECLIPSE
|
||||
std::ofstream mylog("/temp/eclipse.log", std::ios_base::app);
|
||||
#endif
|
||||
QDateTime dateNow = QDateTime::currentDateTimeUtc();
|
||||
for (int i=0; i< eclipseDates.size(); ++i)
|
||||
{
|
||||
QDateTime check = eclipseDates.at(i);
|
||||
QDateTime check = eclipseDates.at(i); // already in UTC time
|
||||
// +- 6 hour window
|
||||
QDateTime date1 = check.addSecs(-3600*6);
|
||||
QDateTime date2 = check.addSecs( 3600*6);
|
||||
if (now > date1 && now < date2)
|
||||
qint64 secondsDiff = qAbs(check.secsTo(dateNow));
|
||||
if (secondsDiff <= 3600*6) // 6 hour check
|
||||
{
|
||||
#ifdef DEBUGECLIPSE
|
||||
mylog << dateNow.toString(Qt::ISODate) << " Eclipse! " << "secondsDiff=" << secondsDiff << std::endl;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUGECLIPSE
|
||||
mylog << timeutc.toString("yyyy-MM-dd HH:mm:ss") << " no eclipse" << "\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -312,7 +323,7 @@ void PSKReporter::impl::eclipse_load(QString eclipse_file)
|
||||
std::ifstream fs(qPrintable(eclipse_file));
|
||||
std::string mydate,mytime,myline;
|
||||
#ifdef DEBUGECLIPSE
|
||||
std::ofstream mylog("eclipse.log");
|
||||
std::ofstream mylog("c:/temp/eclipse.log");
|
||||
mylog << "eclipse_file=" << eclipse_file << std::endl;
|
||||
#endif
|
||||
if (fs.is_open())
|
||||
@ -320,11 +331,19 @@ void PSKReporter::impl::eclipse_load(QString eclipse_file)
|
||||
while(!fs.eof())
|
||||
{
|
||||
std::getline(fs, myline);
|
||||
if (myline[0] != '#')
|
||||
if (myline[0] != '#' && myline.length() > 2) // make sure to skip blank lines
|
||||
{
|
||||
QString format = "yyyy-MM-dd hh:mm:ss";
|
||||
QDateTime qdate = QDateTime::fromString(QString::fromStdString(myline), format);
|
||||
eclipseDates.append(qdate);
|
||||
//QString format = "yyyy-MM-dd hh:mm:ss";
|
||||
QDateTime qdate = QDateTime::fromString(QString::fromStdString(myline), Qt::ISODate);
|
||||
QDateTime now = QDateTime::currentDateTimeUtc();
|
||||
// only add the date if we can cover the whole 12 hours
|
||||
//if (now < qdate.toUTC().addSecs(-3600*6))
|
||||
eclipseDates.append(qdate);
|
||||
#ifdef DEBUGECLIPSE
|
||||
//else
|
||||
// mylog << "not adding " << myline << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
#ifdef DEBUGECLIPSE
|
||||
mylog << myline << std::endl;
|
||||
@ -332,7 +351,7 @@ void PSKReporter::impl::eclipse_load(QString eclipse_file)
|
||||
}
|
||||
}
|
||||
#ifdef DEBUGECLIPSE
|
||||
if (eclipse_active(QDateTime::currentDateTime())) mylog << "Eclipse is active" << std::endl;
|
||||
if (eclipse_active(QDateTime::currentDateTime().toUTC())) mylog << "Eclipse is active" << std::endl;
|
||||
else mylog << "Eclipse is not active" << std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -619,7 +638,7 @@ bool PSKReporter::addRemoteStation (QString const& call, QString const& grid, Ra
|
||||
#endif
|
||||
added++;
|
||||
|
||||
QDateTime qdateNow = QDateTime::currentDateTime();
|
||||
QDateTime qdateNow = QDateTime::currentDateTime().toUTC();
|
||||
// we allow all spots through +/- 6 hours around an eclipse for the HamSCI group
|
||||
if (!spot_cache.contains(call) || freq > 49000000 || eclipse_active(qdateNow)) // then it's a new spot
|
||||
{
|
||||
|
57
eclipse.txt
57
eclipse.txt
@ -1,31 +1,28 @@
|
||||
# Some test dates added for PSKReporter testing#
|
||||
2023-06-10T21:30:00Z
|
||||
2023-06-15T18:00:00Z
|
||||
2023-07-01T18:00:00Z
|
||||
2023-07-15T18:00:00Z
|
||||
2023-08-01T18:00:00Z
|
||||
2023-08-15T18:00:00Z
|
||||
2023-09-01T18:00:00Z
|
||||
2023-09-15T18:00:00Z
|
||||
2023-10-01T18:00:00Z
|
||||
# From https://eclipse.gsfc.nasa.gov/SEdecade/SEdecade2021.html
|
||||
2023-10-14 18:00:40
|
||||
2024-04-08 18:18:29
|
||||
2024-10-02 18:46:13
|
||||
2025-03-29 10:48:36
|
||||
2025-09-21 19:43:04
|
||||
2026-02-17 12:13:05
|
||||
2026-08-12 17:47:05
|
||||
2027-02-06 16:00:47
|
||||
2027-08-02 10:04:49
|
||||
2028-01-26 15:08:58
|
||||
2028-07-22 02:56:39
|
||||
2029-01-14 17:13:47
|
||||
2029-06-12 04:06:13
|
||||
2029-07-11 15:37:18
|
||||
2029-12-05 15:03:57
|
||||
2030-06-01 06:29:13
|
||||
2030-11-25 06:51:37
|
||||
# Some test dates added for PSKReporter testing
|
||||
2023-04-20 04:17:55
|
||||
2023-05-01 18:00:00
|
||||
2023-05-15 18:00:00
|
||||
2023-06-01 18:00:00
|
||||
2023-06-15 18:00:00
|
||||
2023-07-01 18:00:00
|
||||
2023-07-15 18:00:00
|
||||
2023-08-01 18:00:00
|
||||
2023-08-15 18:00:00
|
||||
2023-09-01 18:00:00
|
||||
2023-09-15 18:00:00
|
||||
2023-10-01 18:00:00
|
||||
2023-10-14T18:00:40Z
|
||||
2024-04-08T18:18:29Z
|
||||
2024-10-02T18:46:13Z
|
||||
2025-03-29T10:48:36Z
|
||||
2025-09-21T19:43:04Z
|
||||
2026-02-17T12:13:05Z
|
||||
2026-08-12T17:47:05Z
|
||||
2027-02-06T16:00:47Z
|
||||
2027-08-02T10:04:49Z
|
||||
2028-01-26T15:08:58Z
|
||||
2028-07-22T02:56:39Z
|
||||
2029-01-14T17:13:47Z
|
||||
2029-06-12T04:06:13Z
|
||||
2029-07-11T15:37:18Z
|
||||
2029-12-05T15:03:57Z
|
||||
2030-06-01T06:29:13Z
|
||||
2030-11-25T06:51:37Z
|
||||
|
Loading…
Reference in New Issue
Block a user