Skip to content

Commit

Permalink
Issue #93 Reduce update offset for 5 Hz updates and rename member
Browse files Browse the repository at this point in the history
  • Loading branch information
oktal3700 committed Feb 28, 2021
1 parent 2426494 commit 4fda69d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/blackcore/fsd/fsdclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1665,13 +1665,13 @@ namespace BlackCore
this->insertLatestOffsetTime(callsign, diff);

int count = 0;
static const qint64 minOffsetTime = CFsdSetup::c_interimPositionTimeOffsetMsec; // no longer needed with C++17
static const qint64 minOffsetTime = CFsdSetup::c_minimumPositionTimeOffsetMsec; // no longer needed with C++17
const qint64 avgTimeMs = this->averageOffsetTimeMs(callsign, count, 3); // latest average
qint64 offsetTime = CFsdSetup::c_positionTimeOffsetMsec;

if (avgTimeMs < minOffsetTime && count >= 3)
{
offsetTime = CFsdSetup::c_interimPositionTimeOffsetMsec;
offsetTime = CFsdSetup::c_minimumPositionTimeOffsetMsec;
}

return m_additionalOffsetTime + offsetTime;
Expand Down
2 changes: 1 addition & 1 deletion src/blackmisc/network/fsdsetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace BlackMisc
//! \remark related to CNetworkVatlib::c_updatePostionIntervalMsec / c_updateInterimPostionIntervalMsec
//! @{
static constexpr qint64 c_positionTimeOffsetMsec = 6000; //!< offset time for received position updates Ref T297
static constexpr qint64 c_interimPositionTimeOffsetMsec = 1500; //!< offset time for received interim position updates Ref T297
static constexpr qint64 c_minimumPositionTimeOffsetMsec = 700; //!< offset time for vatsim high frequency position updates
//! @}

//! Default constructor.
Expand Down
2 changes: 1 addition & 1 deletion src/blackmisc/simulation/interpolatorspline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace BlackMisc
}

// set some default values
const qint64 defaultValueMs = CFsdSetup::c_interimPositionTimeOffsetMsec; // CLANG cannot use reference in qMax
const qint64 defaultValueMs = CFsdSetup::c_minimumPositionTimeOffsetMsec; // CLANG cannot use reference in qMax
const qint64 os = qMax(defaultValueMs, m_s[2].getTimeOffsetMs());
m_s[0].addMsecs(-os); // oldest, Ref T297 default offset time to fill data
m_s[2].addMsecs(os); // latest, Ref T297 default offset time to fill data
Expand Down

0 comments on commit 4fda69d

Please sign in to comment.