From 25491c047892db30d16032ca546caa60c7a56214 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Fri, 10 Sep 2021 18:29:39 +0100 Subject: [PATCH] Issue #37 Inhibit monitoring FPS for the first 10 seconds So we ignore transient FPS drops caused by initial scenery load time. --- src/xswiftbus/service.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/xswiftbus/service.cpp b/src/xswiftbus/service.cpp index 16f2fcbdc..07cc4fb1b 100644 --- a/src/xswiftbus/service.cpp +++ b/src/xswiftbus/service.cpp @@ -29,6 +29,7 @@ namespace XSwiftBus { DataRef m_thisFramePeriod; DataRef m_thisFramePeriodXP11; + DataRef m_secondsSinceReset; DataRef m_groundSpeed; std::vector m_samples; @@ -78,11 +79,14 @@ namespace XSwiftBus if (current > c_framePeriodBudget) { m_totalOverBudget += current - c_framePeriodBudget; - } - const float metersShort = m_groundSpeed.get() * std::max(0.0f, current - c_framePeriodBudget); - m_totalMetersShort += metersShort; - if (m_groundSpeed.get() > 1.0f) { m_totalSecondsLate += std::max(0.0f, current - c_framePeriodBudget); } + if (m_secondsSinceReset.get() > 10) + { + const float metersShort = m_groundSpeed.get() * std::max(0.0f, current - c_framePeriodBudget); + m_totalMetersShort += metersShort; + if (m_groundSpeed.get() > 1.0f) { m_totalSecondsLate += std::max(0.0f, current - c_framePeriodBudget); } + } + } } };