mirror of
https://github.com/wled/WLED.git
synced 2025-07-10 04:16:36 +00:00
Clean up addEffect() changes.
This commit is contained in:
parent
cde5314d41
commit
b73f049484
@ -7909,11 +7909,13 @@ uint8_t WS2812FX::addEffect(uint8_t id, mode_ptr mode_fn, const char *mode_name)
|
|||||||
_mode[id] = mode_fn;
|
_mode[id] = mode_fn;
|
||||||
_modeData[id] = mode_name;
|
_modeData[id] = mode_name;
|
||||||
return id;
|
return id;
|
||||||
} else {
|
} else if(_mode.size() < 255) { // 255 is reserved for indicating the effect wasn't added
|
||||||
_mode.push_back(mode_fn);
|
_mode.push_back(mode_fn);
|
||||||
_modeData.push_back(mode_name);
|
_modeData.push_back(mode_name);
|
||||||
if (_modeCount < _mode.size()) _modeCount++;
|
if (_modeCount < _mode.size()) _modeCount++;
|
||||||
return (_mode.size() <= 255) ? _mode.size() - 1 : 255;
|
return _mode.size() - 1;
|
||||||
|
} else {
|
||||||
|
return 255; // The vector is full so return 255
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,7 +772,6 @@ class WS2812FX { // 96 bytes
|
|||||||
show(void), // initiates LED output
|
show(void), // initiates LED output
|
||||||
setTargetFps(uint8_t fps),
|
setTargetFps(uint8_t fps),
|
||||||
setupEffectData(void); // add default effects to the list; defined in FX.cpp
|
setupEffectData(void); // add default effects to the list; defined in FX.cpp
|
||||||
uint8_t addEffect(uint8_t id, mode_ptr mode_fn, const char *mode_name); // add effect to the list; defined in FX.cpp
|
|
||||||
|
|
||||||
inline void restartRuntime() { for (Segment &seg : _segments) seg.markForReset(); }
|
inline void restartRuntime() { for (Segment &seg : _segments) seg.markForReset(); }
|
||||||
inline void setTransitionMode(bool t) { for (Segment &seg : _segments) seg.startTransition(t ? _transitionDur : 0); }
|
inline void setTransitionMode(bool t) { for (Segment &seg : _segments) seg.startTransition(t ? _transitionDur : 0); }
|
||||||
@ -808,7 +807,8 @@ class WS2812FX { // 96 bytes
|
|||||||
getActiveSegmentsNum(void),
|
getActiveSegmentsNum(void),
|
||||||
getFirstSelectedSegId(void),
|
getFirstSelectedSegId(void),
|
||||||
getLastActiveSegmentId(void),
|
getLastActiveSegmentId(void),
|
||||||
getActiveSegsLightCapabilities(bool selectedOnly = false);
|
getActiveSegsLightCapabilities(bool selectedOnly = false),
|
||||||
|
addEffect(uint8_t id, mode_ptr mode_fn, const char *mode_name); // add effect to the list; defined in FX.cpp
|
||||||
|
|
||||||
inline uint8_t getBrightness(void) { return _brightness; } // returns current strip brightness
|
inline uint8_t getBrightness(void) { return _brightness; } // returns current strip brightness
|
||||||
inline uint8_t getMaxSegments(void) { return MAX_NUM_SEGMENTS; } // returns maximum number of supported segments (fixed value)
|
inline uint8_t getMaxSegments(void) { return MAX_NUM_SEGMENTS; } // returns maximum number of supported segments (fixed value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user