mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
Merge pull request #1449 from srcejon/fix_1445
Satellite Tracker: Fix for #1445.
This commit is contained in:
commit
1ff4249202
@ -1168,6 +1168,10 @@ QDateTime SatelliteTracker::currentDateTimeUtc()
|
||||
return QDateTime::currentDateTimeUtc();
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_dateTimeSelect == SatelliteTrackerSettings::CUSTOM)
|
||||
{
|
||||
return QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
|
||||
}
|
||||
else if (m_settings.m_dateTimeSelect == SatelliteTrackerSettings::FROM_MAP)
|
||||
{
|
||||
QString dateTimeStr;
|
||||
|
@ -289,11 +289,6 @@ SatelliteTrackerGUI::SatelliteTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *fea
|
||||
ui->dateTime->setDateTime(m_satelliteTracker->currentDateTime());
|
||||
ui->deviceFeatureSelect->setVisible(false);
|
||||
|
||||
// Use My Position from preferences, if none set
|
||||
if ((m_settings.m_latitude == 0.0) && (m_settings.m_longitude == 0.0)) {
|
||||
on_useMyPosition_clicked();
|
||||
}
|
||||
|
||||
resizeTable();
|
||||
// Allow user to reorder columns
|
||||
ui->satTable->horizontalHeader()->setSectionsMovable(true);
|
||||
@ -322,6 +317,11 @@ SatelliteTrackerGUI::SatelliteTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *fea
|
||||
|
||||
// Get initial list of satellites
|
||||
on_updateSatData_clicked();
|
||||
|
||||
// Use My Position from preferences, if none set
|
||||
if ((m_settings.m_latitude == 0.0) && (m_settings.m_longitude == 0.0)) {
|
||||
on_useMyPosition_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
SatelliteTrackerGUI::~SatelliteTrackerGUI()
|
||||
@ -399,6 +399,8 @@ void SatelliteTrackerGUI::onMenuDialogCalled(const QPoint &p)
|
||||
|
||||
void SatelliteTrackerGUI::aos(const QString& name, int duration, int maxElevation)
|
||||
{
|
||||
// Call plotChart() to start the periodic updates with sat position in polar chart
|
||||
plotChart();
|
||||
// Give speech notification of pass
|
||||
QString speech = m_settings.m_aosSpeech.trimmed();
|
||||
if (!speech.isEmpty())
|
||||
|
@ -306,6 +306,8 @@ void SatelliteTrackerWorker::update()
|
||||
else
|
||||
qdt = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs).toUTC();
|
||||
|
||||
bool timeReversed = m_lastUpdateDateTime > qdt;
|
||||
|
||||
QHashIterator<QString, SatWorkerState *> itr(m_workerState);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
@ -320,7 +322,7 @@ void SatelliteTrackerWorker::update()
|
||||
// Calculate position, AOS/LOS and other details for satellite
|
||||
int noOfPasses;
|
||||
bool recalcAsPastLOS = (satWorkerState->m_satState.m_passes.size() > 0) && (satWorkerState->m_satState.m_passes[0].m_los < qdt);
|
||||
if (m_recalculatePasses || recalcAsPastLOS)
|
||||
if (m_recalculatePasses || recalcAsPastLOS || timeReversed)
|
||||
noOfPasses = (name == m_settings.m_target) ? 99 : 1;
|
||||
else
|
||||
noOfPasses = 0;
|
||||
@ -330,10 +332,13 @@ void SatelliteTrackerWorker::update()
|
||||
m_settings.m_passStartTime, m_settings.m_passFinishTime, m_settings.m_utc,
|
||||
noOfPasses, m_settings.m_groundTrackPoints, &satWorkerState->m_satState);
|
||||
|
||||
// Update AOS/LOS (only set timers if using real time)
|
||||
if ((m_settings.m_dateTime == "") && (satWorkerState->m_satState.m_passes.size() > 0))
|
||||
// Update AOS/LOS
|
||||
if (satWorkerState->m_satState.m_passes.size() > 0)
|
||||
{
|
||||
// Do we have a new AOS?
|
||||
// Only use timers if using real time
|
||||
if (m_settings.m_dateTimeSelect == SatelliteTrackerSettings::NOW)
|
||||
{
|
||||
// Do we have a new pass?
|
||||
if ((satWorkerState->m_aos != satWorkerState->m_satState.m_passes[0].m_aos) || (satWorkerState->m_los != satWorkerState->m_satState.m_passes[0].m_los))
|
||||
{
|
||||
qDebug() << "SatelliteTrackerWorker: Current time: " << qdt.toString(Qt::ISODateWithMs);
|
||||
@ -341,6 +346,7 @@ void SatelliteTrackerWorker::update()
|
||||
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;
|
||||
satWorkerState->m_hasSignalledAOS = false;
|
||||
if (satWorkerState->m_aos.isValid())
|
||||
{
|
||||
if (satWorkerState->m_aos > qdt)
|
||||
@ -376,6 +382,27 @@ void SatelliteTrackerWorker::update()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do we need to signal LOS?
|
||||
if (satWorkerState->m_hasSignalledAOS && !satWorkerState->hasAOS(qdt))
|
||||
{
|
||||
los(satWorkerState);
|
||||
satWorkerState->m_hasSignalledAOS = false;
|
||||
}
|
||||
// Do we have a new pass?
|
||||
if ((satWorkerState->m_aos != satWorkerState->m_satState.m_passes[0].m_aos) || (satWorkerState->m_los != satWorkerState->m_satState.m_passes[0].m_los))
|
||||
{
|
||||
satWorkerState->m_aos = satWorkerState->m_satState.m_passes[0].m_aos;
|
||||
satWorkerState->m_los = satWorkerState->m_satState.m_passes[0].m_los;
|
||||
satWorkerState->m_hasSignalledAOS = false;
|
||||
}
|
||||
// Check if we need to signal AOS
|
||||
if (!satWorkerState->m_hasSignalledAOS && satWorkerState->m_aos.isValid() && satWorkerState->hasAOS(qdt)) {
|
||||
aos(satWorkerState);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
satWorkerState->m_aos = QDateTime();
|
||||
satWorkerState->m_los = QDateTime();
|
||||
@ -505,6 +532,7 @@ void SatelliteTrackerWorker::update()
|
||||
qDebug() << "SatelliteTrackerWorker::update: No TLE for " << sat->m_name << ". Can't compute position.";
|
||||
}
|
||||
}
|
||||
m_lastUpdateDateTime = qdt;
|
||||
m_recalculatePasses = false;
|
||||
}
|
||||
|
||||
@ -512,6 +540,8 @@ void SatelliteTrackerWorker::aos(SatWorkerState *satWorkerState)
|
||||
{
|
||||
qDebug() << "SatelliteTrackerWorker::aos " << satWorkerState->m_name;
|
||||
|
||||
satWorkerState->m_hasSignalledAOS = true;
|
||||
|
||||
// Indicate AOS to GUI
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
m_name(name)
|
||||
{
|
||||
m_satState.m_name = name;
|
||||
m_hasSignalledAOS = false;
|
||||
}
|
||||
|
||||
bool hasAOS(const QDateTime& currentTime);
|
||||
@ -60,6 +61,7 @@ protected:
|
||||
QTimer m_dopplerTimer;
|
||||
QList<int> m_initFrequencyOffset;
|
||||
SatelliteState m_satState;
|
||||
bool m_hasSignalledAOS; // For pass specified by m_aos and m_los
|
||||
|
||||
friend SatelliteTrackerWorker;
|
||||
};
|
||||
@ -114,6 +116,7 @@ private:
|
||||
bool m_recalculatePasses; //!< Recalculate passes as something has changed
|
||||
bool m_flipRotation; //!< Use 180 elevation to avoid 360/0 degree discontinutiy
|
||||
bool m_extendedAzRotation; //!< Use 450+ degree azimuth to avoid 360/0 degree discontinuity
|
||||
QDateTime m_lastUpdateDateTime;
|
||||
|
||||
bool handleMessage(const Message& cmd);
|
||||
void applySettings(const SatelliteTrackerSettings& settings, bool force = false);
|
||||
|
Loading…
Reference in New Issue
Block a user