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

◆ trigger()

void fl::TimeRamp::trigger ( u32 now)
overridevirtual

Call this when you want to (re)start the ramp cycle.

Smart re-trigger that preserves state when already active:

  • If in plateau: extends the plateau time
  • If falling: reverses back to plateau
  • If rising: continues rising
  • If inactive: starts new cycle

Implements fl::TimeAlpha.

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

83 {
84 RampPhase phase = getCurrentPhase(now);
85
86 switch (phase) {
88 // Not active, start fresh
89 mStart = now;
93 break;
94
96 // Continue rising, just extend the plateau end time
99 break;
100
102 // Extend the plateau by the full latch time from now
105 break;
106
108 // Reverse back to plateau
109 // Jump immediately to plateau and hold for latch time
113 mStart = now - mRisingTime; // Adjust start so timing stays consistent
114 break;
115 }
116}
u32 mFinishedPlateauTime
Definition time_alpha.h:94
RampPhase getCurrentPhase(u32 now) const FL_NOEXCEPT
Get the current phase of the ramp.
u32 mFinishedRisingTime
Definition time_alpha.h:93
u32 mFinishedFallingTime
Definition time_alpha.h:95
RampPhase
Definition time_alpha.h:12

References fl::Falling, FL_NOEXCEPT, getCurrentPhase(), fl::Inactive, mFallingTime, mFinishedFallingTime, mFinishedPlateauTime, mFinishedRisingTime, mLatchMs, mRisingTime, mStart, fl::Plateau, and fl::Rising.

+ Here is the call graph for this function: