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

◆ loop()

void loop ( )

Definition at line 754 of file curr.h.

754 {
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}
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
int y
Definition simple.h:93
int x
Definition simple.h:92
uint8_t pos
Definition Blur.ino:11
fl::UICheckbox allWhite("All White", false)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::UIDropdown renderModeDropdown("Render Mode", renderModeOptions)
FL_OPTIMIZATION_LEVEL_O0_BEGIN float get_position(uint32_t now)
Definition curr.h:413
void draw(float pos)
Definition curr.h:526
void drawWave(uint32_t now)
Definition curr.h:705
fl::shared_ptr< fl::Grid< fl::CRGB > > frameBufferPtr
Definition curr.h:279
void drawNoise(uint32_t now)
Definition curr.h:521
void drawAnimartrix(uint32_t now)
Definition curr.h:739
void drawFire(uint32_t now)
Definition curr.h:639
fl::UICheckbox splatRendering("Splat Rendering", true)
fl::Corkscrew corkscrew(CORKSCREW_TURNS, NUM_LEDS)
fl::CRGB CRGB
Definition video.h:15
fl::u32 uint32_t
Definition s16x16x4.h:219
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38

References allWhite, brightness, corkscrew(), draw(), drawAnimartrix(), drawFire(), drawNoise(), drawWave(), FastLED, frameBufferPtr, get_position(), fl::millis(), pos, renderModeDropdown(), splatRendering(), x, and y.

+ Here is the call graph for this function: