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

Function setup

examples/Corkscrew/Corkscrew.h:104–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102fl::Grid<CRGB> frameBuffer;
103
104void setup() {
105 int width = corkscrew.cylinderWidth();
106 int height = corkscrew.cylinderHeight();
107
108 frameBuffer.reset(width, height);
109 fl::XYMap xyMap = fl::XYMap::constructRectangularGrid(width, height, 0);
110
111 fl::span<CRGB> leds = frameBuffer.span();
112
113 CLEDController *controller =
114 &FastLED.addLeds<WS2812, 3, BGR>(leds.data(), leds.size());
115
116 // NEW: Create ScreenMap directly from Corkscrew using toScreenMap()
117 // This maps each LED index to its exact position on the cylindrical surface
118 fl::ScreenMap corkscrewScreenMap = corkscrew.toScreenMap(0.2f);
119
120 // Alternative: Create ScreenMap from rectangular XYMap (old way)
121 // fl::ScreenMap screenMap = xyMap.toScreenMap();
122 // screenMap.setDiameter(.2f);
123
124 // Set the corkscrew screen map for the controller
125 // This allows the web interface to display the actual corkscrew shape
126 controller->setScreenMap(corkscrewScreenMap);
127
128 // Initialize caching based on UI setting
129 corkscrew.setCachingEnabled(cachingEnabled.value());
130}
131
132void loop() {
133 fl::clear(frameBuffer);

Callers

nothing calls this directly

Calls 10

cylinderWidthMethod · 0.80
cylinderHeightMethod · 0.80
setCachingEnabledMethod · 0.80
resetMethod · 0.45
spanMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
toScreenMapMethod · 0.45
setScreenMapMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected