mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -05:00
Satellite Tracker: Ensure LOS is signalled if new AOS is calculated within a second of LOS
This commit is contained in:
parent
147e3881e6
commit
3524e5856b
@ -990,3 +990,19 @@ void SatelliteTracker::updateSatData()
|
||||
else
|
||||
qDebug() << "SatelliteTracker::updateSatData: update in progress";
|
||||
}
|
||||
|
||||
// Redirect requests for current time via these methods, so it can be adjusted when testing
|
||||
|
||||
QDateTime SatelliteTracker::currentDateTimeUtc()
|
||||
{
|
||||
QDateTime now = QDateTime::currentDateTimeUtc();
|
||||
//now = now.addSecs(26*60);
|
||||
return now;
|
||||
}
|
||||
|
||||
QDateTime SatelliteTracker::currentDateTime()
|
||||
{
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
//now = now.addSecs(26*60);
|
||||
return now;
|
||||
}
|
||||
|
@ -153,6 +153,9 @@ public:
|
||||
const QStringList& featureSettingsKeys,
|
||||
SWGSDRangel::SWGFeatureSettings& response);
|
||||
|
||||
static QDateTime currentDateTimeUtc();
|
||||
static QDateTime currentDateTime();
|
||||
|
||||
static const char* const m_featureIdURI;
|
||||
static const char* const m_featureId;
|
||||
|
||||
|
@ -263,7 +263,7 @@ SatelliteTrackerGUI::SatelliteTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *fea
|
||||
ui->passChart->setChart(&m_emptyChart);
|
||||
ui->passChart->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
ui->dateTime->setDateTime(QDateTime::currentDateTime());
|
||||
ui->dateTime->setDateTime(SatelliteTracker::currentDateTime());
|
||||
|
||||
// Use My Position from preferences, if none set
|
||||
if ((m_settings.m_latitude == 0.0) && (m_settings.m_longitude == 0.0))
|
||||
@ -595,7 +595,7 @@ void SatelliteTrackerGUI::updateTimeToAOS()
|
||||
ui->aos->setText("Now");
|
||||
else if (m_nextTargetAOS.isValid())
|
||||
{
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
QDateTime currentTime = SatelliteTracker::currentDateTime();
|
||||
int secondsToAOS = m_nextTargetAOS.toSecsSinceEpoch() - currentTime.toSecsSinceEpoch();
|
||||
if (secondsToAOS > 0)
|
||||
{
|
||||
@ -824,7 +824,7 @@ void SatelliteTrackerGUI::plotPolarChart()
|
||||
|
||||
QDateTime currentTime;
|
||||
if (m_settings.m_dateTime == "")
|
||||
currentTime = QDateTime::currentDateTimeUtc();
|
||||
currentTime = SatelliteTracker::currentDateTimeUtc();
|
||||
else if (m_settings.m_utc)
|
||||
currentTime = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
|
||||
else
|
||||
@ -854,7 +854,7 @@ void SatelliteTrackerGUI::plotPolarChart()
|
||||
// Possibly geostationary, just plot current position
|
||||
QDateTime currentTime;
|
||||
if (m_settings.m_dateTime == "")
|
||||
currentTime = QDateTime::currentDateTimeUtc();
|
||||
currentTime = SatelliteTracker::currentDateTimeUtc();
|
||||
else if (m_settings.m_utc)
|
||||
currentTime = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
|
||||
else
|
||||
|
@ -283,7 +283,7 @@ void SatelliteTrackerWorker::update()
|
||||
// Get date and time to calculate position at
|
||||
QDateTime qdt;
|
||||
if (m_settings.m_dateTime == "")
|
||||
qdt = QDateTime::currentDateTimeUtc();
|
||||
qdt = SatelliteTracker::currentDateTimeUtc();
|
||||
else if (m_settings.m_utc)
|
||||
qdt = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
|
||||
else
|
||||
@ -316,54 +316,11 @@ void SatelliteTrackerWorker::update()
|
||||
// Update AOS/LOS (only set timers if using real time)
|
||||
if ((m_settings.m_dateTime == "") && (satWorkerState->m_satState.m_passes.size() > 0))
|
||||
{
|
||||
/*int min = 8;
|
||||
QDateTime p1a = QDateTime(QDateTime::currentDateTime().date(), QTime(16, min, 0));
|
||||
QDateTime p1s = QDateTime(QDateTime::currentDateTime().date(), QTime(16, min, 30));
|
||||
|
||||
QDateTime p2a = QDateTime(QDateTime::currentDateTime().date(), QTime(16, min+1, 0));
|
||||
QDateTime p2s = QDateTime(QDateTime::currentDateTime().date(), QTime(16, min+1, 30));
|
||||
|
||||
if (qdt > p1a)
|
||||
{
|
||||
satWorkerState->m_satState.m_passes[0]->m_aos = p2a;
|
||||
satWorkerState->m_satState.m_passes[0]->m_los = p2s;
|
||||
}
|
||||
else
|
||||
{
|
||||
satWorkerState->m_satState.m_passes[0]->m_aos = p1a;
|
||||
satWorkerState->m_satState.m_passes[0]->m_los = p1s;
|
||||
} */
|
||||
|
||||
|
||||
/* if (name == "NOAA 18")
|
||||
{
|
||||
satWorkerState->m_satState.m_passes[0]->m_aos = QDateTime(QDateTime::currentDateTime().date(), QTime(11, 10, 0));
|
||||
satWorkerState->m_satState.m_passes[0]->m_los = QDateTime(QDateTime::currentDateTime().date(), QTime(11, 10, 30));
|
||||
} */
|
||||
|
||||
|
||||
/*if (name == "ISS")
|
||||
{
|
||||
if (m_settings.m_minAOSElevation == 5)
|
||||
{
|
||||
qDebug() << "*********** seting first AOS";
|
||||
satWorkerState->m_satState.m_passes[0]->m_aos = QDateTime(QDateTime::currentDateTime().date(), QTime(14, 10, 0));
|
||||
satWorkerState->m_satState.m_passes[0]->m_los = QDateTime(QDateTime::currentDateTime().date(), QTime(14, 10, 30));
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "*********** seting second AOS";
|
||||
satWorkerState->m_satState.m_passes[0]->m_aos = QDateTime(QDateTime::currentDateTime().date(), QTime(14, 11, 0));
|
||||
satWorkerState->m_satState.m_passes[0]->m_los = QDateTime(QDateTime::currentDateTime().date(), QTime(14, 11, 30));
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// Do we have a new AOS?
|
||||
if ((satWorkerState->m_aos != satWorkerState->m_satState.m_passes[0]->m_aos) || (satWorkerState->m_los != satWorkerState->m_satState.m_passes[0]->m_los))
|
||||
{
|
||||
qDebug() << "New AOS: " << name << " new: " << satWorkerState->m_satState.m_passes[0]->m_aos << " old: " << satWorkerState->m_aos;
|
||||
qDebug() << "New LOS: " << name << " new: " << satWorkerState->m_satState.m_passes[0]->m_los << " old: " << satWorkerState->m_los;
|
||||
qDebug() << "SatelliteTrackerWorker: New AOS: " << name << " new: " << satWorkerState->m_satState.m_passes[0]->m_aos << " old: " << satWorkerState->m_aos;
|
||||
qDebug() << "SatelliteTrackerWorker: New LOS: " << name << " new: " << satWorkerState->m_satState.m_passes[0]->m_los << " old: " << satWorkerState->m_los;
|
||||
satWorkerState->m_aos = satWorkerState->m_satState.m_passes[0]->m_aos;
|
||||
satWorkerState->m_los = satWorkerState->m_satState.m_passes[0]->m_los;
|
||||
if (satWorkerState->m_aos.isValid())
|
||||
@ -382,10 +339,14 @@ void SatelliteTrackerWorker::update()
|
||||
}
|
||||
if (satWorkerState->m_los.isValid() && (satWorkerState->m_los > qdt))
|
||||
{
|
||||
if (satWorkerState->m_losTimer.isActive() && (satWorkerState->m_losTimer.remainingTime() == 0))
|
||||
if (satWorkerState->m_losTimer.isActive()) {
|
||||
qDebug() << "SatelliteTrackerWorker::update m_losTimer.remainingTime: " << satWorkerState->m_losTimer.remainingTime();
|
||||
}
|
||||
// We can detect a new AOS for a satellite, a little bit before the LOS has occured, presumably
|
||||
// because the calculations aren't accurate to fractions of a second. Allow for 1s here
|
||||
if (satWorkerState->m_losTimer.isActive() && (satWorkerState->m_losTimer.remainingTime() <= 1000))
|
||||
{
|
||||
qDebug() << "****** m_losTimer.remainingTime: " << satWorkerState->m_losTimer.remainingTime();
|
||||
qDebug() << "****** m_losTimer.active: " << satWorkerState->m_losTimer.isActive();
|
||||
satWorkerState->m_losTimer.stop();
|
||||
// LOS hasn't been called yet - do so, before we reset timer
|
||||
los(satWorkerState);
|
||||
}
|
||||
@ -844,3 +805,9 @@ void SatelliteTrackerWorker::los(SatWorkerState *satWorkerState)
|
||||
|
||||
m_recalculatePasses = true;
|
||||
}
|
||||
|
||||
bool SatWorkerState::hasAOS()
|
||||
{
|
||||
QDateTime currentTime = SatelliteTracker::currentDateTimeUtc();
|
||||
return (m_aos <= currentTime) && (m_los > currentTime);
|
||||
}
|
||||
|
@ -48,11 +48,7 @@ public:
|
||||
m_satState.m_name = name;
|
||||
}
|
||||
|
||||
bool hasAOS()
|
||||
{
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
return (m_aos <= currentTime) && (m_los > currentTime);
|
||||
}
|
||||
bool hasAOS();
|
||||
|
||||
protected:
|
||||
QString m_name; // Name of the satellite
|
||||
|
Loading…
Reference in New Issue
Block a user