use timer instead of home spun time math

This commit is contained in:
Matthew Kennedy 2024-04-25 15:07:21 -07:00 committed by rusefi
parent 005d2eb21a
commit 2c33abbf7b
2 changed files with 2 additions and 3 deletions

View File

@ -413,8 +413,7 @@ expected<percent_t> EtbController::getClosedLoopAutotune(percent_t target, perce
efitick_t now = getTimeNowNt();
// Determine period
float tu = NT2US((float)(now - m_cycleStartTime)) / 1e6;
m_cycleStartTime = now;
float tu = m_autotuneCycleStart.getElapsedSecondsAndReset(now);
// Determine amplitude
float a = m_maxCycleTps - m_minCycleTps;

View File

@ -117,7 +117,7 @@ private:
// Autotune helpers
bool m_lastIsPositive = false;
efitick_t m_cycleStartTime = 0;
Timer m_autotuneCycleStart;
float m_minCycleTps = 0;
float m_maxCycleTps = 0;
// Autotune measured parameters: gain and ultimate period