Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Particle System with many new FX #4506

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

DedeHai
Copy link
Collaborator

@DedeHai DedeHai commented Jan 19, 2025

this replaces the previous PR (#3823) since I made too many changes and a rebase was needed.
Some info on the particle system:

  • effects look best at 40-80FPS
  • all FX can be overlaid: overlay is auto-detected, blurring may not work properly in multi-overlay
  • PS and its buffers reside in segment data and is dynamically managed to keep a small RAM memory footprint (local render buffers are shared between segments)
  • since most FX are random number based, segments do not run in sync
  • 1M and 2M ESP8266 have the particle effects disabled for memory reasons

there are three compile time defines

  • WLED_DISABLE_PARTICLESYSTEM2D -> disables 2D system and FX, automatically set if WLED_DISABLE_2D is set
  • WLED_DISABLE_PARTICLESYSTEM1D -> disables 1D system and FX
  • WLED_PS_DONT_REPLACE_FX -> re-enables the replaced FX (uses 12k more flash)

Replaced FX
to save on flash, effects that have a particle system based replacement are disabled. This saves 12k of flash. Users who want the originals back can custom compile using compile flag.

  • Ghost Rider -> PS Ghost Rider (with new options and faster rendering)
  • Blobs -> PS Blobs (with new options, optional AR functionality and nicer rendering)
  • Fire 2012 -> PS Fire (1D and 2D versions)
  • Fireworks 1D -> PS Fireworks (1D and 2D versions)
  • Dancing Shadows -> PS Dancing Shadows
  • Fireworks Starburst -> PS Starburst
  • Glitter & Solid Glitter -> PS Sparkler (with overlay and settings tweked to users liking)
  • Sparkle -> PS Sparkler
  • Rolling Balls -> PS Pinball with checkmark "rolling"
  • Multi Comet -> PS Pinball with gravity set to 0

Known issues:

  • ESP8266 truncates the FX info JSON, the last added FX have missing sliders
  • changing segment arrangements or changing FX during transitions can somettimes lead to crashes due memory race conditions/pointer issues
  • replaced FX are not 100% identical

@DedeHai
Copy link
Collaborator Author

DedeHai commented Jan 19, 2025

the issue with truncated FXdata on ESP8266 can only be solved by increasing the JSON_BUFFER_SIZE. I found it requires at least 500 additional bytes but the problem will re-appear as soon as more FX are added.
@blazoncek and @willmmiles is it safe to increase the JSON_BUFFER_SIZE on the ESP8266 by 512 bytes? Is there a better solution?

edit:
when WLED_PS_DONT_REPLACE_FX is defined to bring the replaced FX back as well, it requires 1k of additional JSON buffer already... open to suggestions. possible solutions are

  • increase buffer by 512 bytes and disable PS when old FX are re-enabled
  • increase buffer by 1k and enable all FX to be loaded (for now)
  • do not increase buffer but disable PS on ESP8266 completely OR just disable 2D particle FX
  • add code to split the sending of FX-data JSON into more than one message (not sure this is viable)

edit2:
disabling the 2D PS would be the easy way out, I imagine most ESP8266 are used for 1D strips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant