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

Function loop

examples/FestivalStick/curr.h:754–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

752}
753
754void loop() {
755
756 delay(4);
757 uint32_t now = fl::millis();
758 frameBufferPtr->clear();
759
760 if (allWhite) {
761 fl::CRGB whiteColor = fl::CRGB(8, 8, 8);
762 for (fl::u32 x = 0; x < frameBufferPtr->width(); x++) {
763 for (fl::u32 y = 0; y < frameBufferPtr->height(); y++) {
764 frameBufferPtr->at(x, y) = whiteColor;
765 }
766 }
767 }
768
769
770 // Update the corkscrew mapping with auto-advance or manual position control
771 float combinedPosition = get_position(now);
772 float pos = combinedPosition * (corkscrew.size() - 1);
773
774
775 if (renderModeDropdown.value() == "Noise") {
776 drawNoise(now);
777 } else if (renderModeDropdown.value() == "Fire") {
778 drawFire(now);
779 } else if (renderModeDropdown.value() == "Wave") {
780
781 drawWave(now);
782 } else if (renderModeDropdown.value() == "fl::Animartrix") {
783 drawAnimartrix(now);
784 } else {
785 draw(pos);
786 }
787
788
789 // Use the new readFrom workflow:
790 // 1. Read directly from the frameBuffer fl::Grid into the corkscrew's internal buffer
791 // use_multi_sampling = true will use multi-sampling to sample from the source grid,
792 // this will give a little bit better accuracy and the screenmap will be more accurate.
793 const bool use_multi_sampling = splatRendering;
794 // corkscrew.readFrom(frameBuffer, use_multi_sampling);
795 corkscrew.draw(use_multi_sampling);
796
797 // The corkscrew's buffer is now populated and FastLED will display it directly
798
799 FastLED.setBrightness(brightness.value());
800 FastLED.show();
801}

Callers

nothing calls this directly

Calls 15

get_positionFunction · 0.85
drawNoiseFunction · 0.85
drawFireFunction · 0.85
drawWaveFunction · 0.85
drawAnimartrixFunction · 0.85
drawFunction · 0.85
delayFunction · 0.50
millisFunction · 0.50
CRGBClass · 0.50
clearMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected