| 752 | } |
| 753 | |
| 754 | void 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 | } |
nothing calls this directly
no test coverage detected