MCPcopy Create free account
hub / github.com/FastLED/FastLED / trigger

Method trigger

src/fl/math/time_alpha.cpp.hpp:83–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void TimeRamp::trigger(u32 now) FL_NOEXCEPT {
84 RampPhase phase = getCurrentPhase(now);
85
86 switch (phase) {
87 case RampPhase::Inactive:
88 // Not active, start fresh
89 mStart = now;
90 mFinishedRisingTime = mStart + mRisingTime;
91 mFinishedPlateauTime = mFinishedRisingTime + mLatchMs;
92 mFinishedFallingTime = mFinishedPlateauTime + mFallingTime;
93 break;
94
95 case RampPhase::Rising:
96 // Continue rising, just extend the plateau end time
97 mFinishedPlateauTime = mFinishedRisingTime + mLatchMs;
98 mFinishedFallingTime = mFinishedPlateauTime + mFallingTime;
99 break;
100
101 case RampPhase::Plateau:
102 // Extend the plateau by the full latch time from now
103 mFinishedPlateauTime = now + mLatchMs;
104 mFinishedFallingTime = mFinishedPlateauTime + mFallingTime;
105 break;
106
107 case RampPhase::Falling:
108 // Reverse back to plateau
109 // Jump immediately to plateau and hold for latch time
110 mFinishedRisingTime = now;
111 mFinishedPlateauTime = now + mLatchMs;
112 mFinishedFallingTime = mFinishedPlateauTime + mFallingTime;
113 mStart = now - mRisingTime; // Adjust start so timing stays consistent
114 break;
115 }
116}
117
118u8 TimeRamp::update8(u32 now) FL_NOEXCEPT {
119 if (!isActive(now)) {

Callers 3

PirMethod · 0.45
detectMethod · 0.45
activateMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected