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

Method mapWaveToLEDs

src/fl/fx/2d/wave.h:53–64  ·  view source on GitHub ↗

@brief Map wave values to grayscale LED colors @param xymap Coordinate mapping from 2D grid to 1D LED array @param waveSim Wave simulation containing amplitude values @param leds Output LED array to write colors to

Source from the content-addressed store, hash-verified

51 /// @param waveSim Wave simulation containing amplitude values
52 /// @param leds Output LED array to write colors to
53 void mapWaveToLEDs(const XYMap &xymap, WaveSimulation2D &waveSim,
54 fl::span<CRGB> leds) override {
55 const fl::u32 width = waveSim.getWidth();
56 const fl::u32 height = waveSim.getHeight();
57 for (fl::u32 y = 0; y < height; y++) {
58 for (fl::u32 x = 0; x < width; x++) {
59 fl::u32 idx = xymap(x, y);
60 u8 value8 = waveSim.getu8(x, y);
61 leds[idx] = CRGB(value8, value8, value8);
62 }
63 }
64 }
65};
66
67/// @brief Wave-to-color mapper using gradient/palette coloring

Callers 1

drawMethod · 0.45

Calls 4

CRGBClass · 0.50
getWidthMethod · 0.45
getHeightMethod · 0.45
getu8Method · 0.45

Tested by

no test coverage detected