FastLED 3.10.6
Loading...
Searching...
No Matches

◆ update()

float mood_ring::Follower::update ( float target,
float dtMs,
float attackMs,
float releaseMs )

Definition at line 54 of file room_sense.cpp.

55 {
56 if (dtMs <= 0.0f)
57 return mValue;
58 const float tau = (target > mValue) ? attackMs : releaseMs;
59 if (tau <= 0.0f) {
60 mValue = target;
61 return mValue;
62 }
63 // One-pole with alpha = dt / (tau + dt): no expf, never overshoots.
64 float alpha = dtMs / (tau + dtMs);
65 if (alpha > 1.0f)
66 alpha = 1.0f;
67 mValue += (target - mValue) * alpha;
68 return mValue;
69}

References mValue.