Fix mick mode

This commit is contained in:
Michael Ehrenreich
2022-05-19 18:21:08 +02:00
parent b7b86a5e8a
commit 884ac87314

View File

@ -36,9 +36,9 @@ void MickMode::update()
else else
{ {
auto now = espchrono::millis_clock::now(); auto now = espchrono::millis_clock::now();
auto timeDelta = std::chrono::floor<std::chrono::milliseconds>(now - lastUpdate_).count(); float timeDelta = std::chrono::floor<std::chrono::milliseconds>(now - lastUpdate_).count();
// Make sure timeDelta can never be negative, otherwise the exponential below may explode // Make sure timeDelta can never be negative, otherwise the exponential below may explode
timeDelta = std::max(timeDelta, 0ll); timeDelta = std::max(timeDelta, 0.f);
lastUpdate_ = now; lastUpdate_ = now;
float alpha = 1.f - expf(-timeDelta / profileSettings.mickMode.smoothing); float alpha = 1.f - expf(-timeDelta / profileSettings.mickMode.smoothing);