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

◆ setup()

void setup ( )

Definition at line 106 of file Corkscrew.h.

106 {
107 int width = corkscrew.cylinderWidth();
108 int height = corkscrew.cylinderHeight();
109
110 frameBuffer.reset(width, height);
111 XYMap xyMap = XYMap::constructRectangularGrid(width, height, 0);
112
113 CRGB *leds = frameBuffer.data();
114 size_t num_leds = frameBuffer.size();
115
117 &FastLED.addLeds<WS2812, 3, BGR>(leds, num_leds);
118
119 // NEW: Create ScreenMap directly from Corkscrew using toScreenMap()
120 // This maps each LED index to its exact position on the cylindrical surface
121 fl::ScreenMap corkscrewScreenMap = corkscrew.toScreenMap(0.2f);
122
123 // Alternative: Create ScreenMap from rectangular XYMap (old way)
124 // fl::ScreenMap screenMap = xyMap.toScreenMap();
125 // screenMap.setDiameter(.2f);
126
127 // Set the corkscrew screen map for the controller
128 // This allows the web interface to display the actual corkscrew shape
129 controller->setScreenMap(corkscrewScreenMap);
130
131 // Initialize caching based on UI setting
132 corkscrew.setCachingEnabled(cachingEnabled.value());
133}
CRGB leds[NUM_LEDS]
fl::XYMap xyMap
Definition ColorBoost.h:61
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
CLEDController * controller
Base definition for an LED controller.
WS2812 controller class.
Definition FastLED.h:218
static XYMap constructRectangularGrid(u16 width, u16 height, u16 offset=0)
Definition xymap.cpp:34
UICheckbox cachingEnabled("Enable Tile Caching", true)
Corkscrew corkscrew(CORKSCREW_TURNS, NUM_LEDS)
fl::Grid< CRGB > frameBuffer
Definition Corkscrew.h:104
@ BGR
Blue, Green, Red (0210)
Definition eorder.h:19
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86

References fl::BGR, cachingEnabled(), fl::XYMap::constructRectangularGrid(), controller, corkscrew(), FastLED, frameBuffer, leds, and xyMap.

+ Here is the call graph for this function: