FastLED 3.9.15
Loading...
Searching...
No Matches

◆ update8()

u8 fl::TimeRamp::update8 ( u32 now)
overridevirtual

Compute current 0–255 output based on how much time has elapsed since trigger().

Implements fl::TimeAlpha.

Definition at line 118 of file time_alpha.cpp.hpp.

118 {
119 if (!isActive(now)) {
120 return 0;
121 }
122 // u32 elapsed = now - mStart;
123 u8 out = 0;
124 if (now < mFinishedRisingTime) {
126 } else if (now < mFinishedPlateauTime) {
127 // plateau
128 out = 255;
129 } else if (now < mFinishedFallingTime) {
130 // ramp down
131 u8 alpha =
133 out = 255 - alpha;
134 } else {
135 // finished
136 out = 0;
137 }
138
139 mLastValue = out;
140 return out;
141}
u32 mFinishedPlateauTime
Definition time_alpha.h:94
u32 mFinishedRisingTime
Definition time_alpha.h:93
bool isActive(u32 now) const FL_NOEXCEPT override
u32 mFinishedFallingTime
Definition time_alpha.h:95
unsigned char u8
Definition stdint.h:131
u8 time_alpha8(u32 now, u32 start, u32 end) FL_NOEXCEPT

References FL_NOEXCEPT, isActive(), mFinishedFallingTime, mFinishedPlateauTime, mFinishedRisingTime, mLastValue, mStart, and fl::time_alpha8().

+ Here is the call graph for this function: