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

◆ emitPulse()

void mood_ring::MoodPainter::emitPulse ( float strength,
bool downbeat,
fl::u32 nowMs )
private

Definition at line 146 of file mood_painter.cpp.

146 {
147 if (strength <= 0.02f)
148 return;
149 int slot = -1;
150 for (int i = 0; i < kMaxPulses; ++i) {
151 if (!mPulses[i].active) {
152 slot = i;
153 break;
154 }
155 }
156 if (slot < 0) {
157 // All busy: recycle the oldest. The newest hits are the ones the
158 // eye is tracking.
159 slot = 0;
160 for (int i = 1; i < kMaxPulses; ++i) {
161 if (mPulses[i].startMs < mPulses[slot].startMs)
162 slot = i;
163 }
164 }
165 mPulses[slot].startMs = nowMs;
166 mPulses[slot].strength = strength;
167 mPulses[slot].downbeat = downbeat;
168 mPulses[slot].active = true;
169}
Pulse mPulses[kMaxPulses]
static const int kMaxPulses
fl::u8 strength(HandleResult r) FL_NO_EXCEPT

References kMaxPulses, and mPulses.

Referenced by draw().

+ Here is the caller graph for this function: