| 102 | fl::Grid<CRGB> frameBuffer; |
| 103 | |
| 104 | void 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 | |
| 132 | void loop() { |
| 133 | fl::clear(frameBuffer); |
nothing calls this directly
no test coverage detected