From 5e9843256fdaf1aa0d262a5c5c76964ce3c889ee Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Mon, 15 Jan 2024 21:11:38 +0100 Subject: [PATCH] Revert "Interpolate the dynamic offset time for aircraft situations" This reverts commit efb6a3211d899fdb35e3a6874f4fd0fe4ff5a796. --- src/blackcore/fsd/fsdclient.cpp | 17 ++--------------- src/blackcore/fsd/fsdclient.h | 2 -- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/blackcore/fsd/fsdclient.cpp b/src/blackcore/fsd/fsdclient.cpp index adbc21cb34..3eba93f7e2 100644 --- a/src/blackcore/fsd/fsdclient.cpp +++ b/src/blackcore/fsd/fsdclient.cpp @@ -1907,7 +1907,6 @@ namespace BlackCore::Fsd qint64 CFSDClient::receivedPositionFixTsAndGetOffsetTime(const CCallsign &callsign, qint64 markerTs) { - // \fixme This logic should be in a different class Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign"); if (markerTs < 0) { markerTs = QDateTime::currentMSecsSinceEpoch(); } @@ -1925,25 +1924,13 @@ namespace BlackCore::Fsd int count = 0; const qint64 avgTimeMs = this->averageOffsetTimeMs(callsign, count, 3); // latest average - qint64 targetOffsetTime = CFsdSetup::c_positionTimeOffsetMsec; + qint64 offsetTime = CFsdSetup::c_positionTimeOffsetMsec; if (avgTimeMs < CFsdSetup::c_minimumPositionTimeOffsetMsec && count >= 3) { - targetOffsetTime = CFsdSetup::c_minimumPositionTimeOffsetMsec; + offsetTime = CFsdSetup::c_minimumPositionTimeOffsetMsec; } - const qint64 previousInterpolatedOffsetTime = m_interpolatedOffsetTime.value(callsign, 0); - qint64 offsetDiff = 0; - if (targetOffsetTime < previousInterpolatedOffsetTime) - { - offsetDiff = std::max(targetOffsetTime - previousInterpolatedOffsetTime, diff / -c_offsetTimeInterpolationInverseRate); - } - else - { - offsetDiff = std::min(targetOffsetTime - previousInterpolatedOffsetTime, diff / c_offsetTimeInterpolationInverseRate); - } - qint64 offsetTime = previousInterpolatedOffsetTime + offsetDiff; - m_interpolatedOffsetTime.insert(callsign, offsetTime); return m_additionalOffsetTime + offsetTime; } diff --git a/src/blackcore/fsd/fsdclient.h b/src/blackcore/fsd/fsdclient.h index 40b59ac520..aae30686b9 100644 --- a/src/blackcore/fsd/fsdclient.h +++ b/src/blackcore/fsd/fsdclient.h @@ -575,8 +575,6 @@ namespace BlackCore::Fsd QHash m_pendingAtisQueries; QHash m_lastPositionUpdate; QHash> m_lastOffsetTimes; //!< latest offset first - QHash m_interpolatedOffsetTime; - static const int c_offsetTimeInterpolationInverseRate = 4; BlackMisc::Aviation::CAtcStationList m_atcStations;