cache SEGMENT
actually its just a minor speedup, at least with -O2
This commit is contained in:
@@ -10,6 +10,13 @@
|
||||
#include "FX.h"
|
||||
#include "fcn_declare.h"
|
||||
|
||||
#ifdef WLEDMM_FASTPATH
|
||||
#undef SEGMENT
|
||||
#undef SEGENV
|
||||
#define SEGMENT (*strip._currentSeg) // saves us many calls to strip._segments[strip.getCurrSegmentId()]
|
||||
#define SEGENV SEGMENT
|
||||
#endif
|
||||
|
||||
#define IBN 5100
|
||||
|
||||
// paletteBlend: 0 - wrap when moving, 1 - always wrap, 2 - never wrap, 3 - none (undefined)
|
||||
|
||||
@@ -1056,6 +1056,9 @@ class WS2812FX { // 96 bytes
|
||||
// and color transitions
|
||||
uint32_t _colors_t[3]; // color used for effect (includes transition)
|
||||
uint16_t _virtualSegmentLength;
|
||||
#ifdef WLEDMM_FASTPATH
|
||||
segment* _currentSeg = nullptr; // WLEDMM speed up SEGMENT access
|
||||
#endif
|
||||
|
||||
std::vector<segment> _segments;
|
||||
friend class Segment;
|
||||
|
||||
@@ -1884,6 +1884,9 @@ void WS2812FX::service() {
|
||||
_isServicing = true;
|
||||
_segment_index = 0;
|
||||
for (segment &seg : _segments) {
|
||||
#ifdef WLEDMM_FASTPATH
|
||||
_currentSeg = &seg;
|
||||
#endif
|
||||
// reset the segment runtime data if needed
|
||||
seg.resetIfRequired();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user