From 7c49f886419c0232118c6abc4dcdc70309f94bf9 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sat, 10 Feb 2024 13:32:23 +0100 Subject: [PATCH] removed option for fastcolor add it made very little difference in performance, but for ESP8266 it may matter so it is set permanently there. graphically the difference is also very small (sometimes a particle gets brighter or less saturated) --- wled00/FX.cpp | 4 ++-- wled00/FXparticleSystem.cpp | 10 ++++++++-- wled00/FXparticleSystem.h | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 0be46bcc3d..b2d6e0d22d 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -8824,11 +8824,11 @@ uint16_t mode_particlebox(void) SEGMENT.fill(BLACK); // clear the matrix // render the particles - ParticleSys_render(particles, displayparticles, false, false, SEGMENT.check2); + ParticleSys_render(particles, displayparticles, false, false); return FRAMETIME; } -static const char _data_FX_MODE_PARTICLEBOX[] PROGMEM = "Particle Box@Speed,Particles,Tilt strength,Bouncyness,,Rocking Boat,Fastcolors;;!;012;pal=1,sx=100,ix=82,c1=190,c2=210,o1=0"; +static const char _data_FX_MODE_PARTICLEBOX[] PROGMEM = "Particle Box@Speed,Particles,Tilt strength,Bouncyness,,Rocking Boat,;;!;012;pal=1,sx=100,ix=82,c1=190,c2=210,o1=0"; /* perlin noise 'gravity' mapping as in particles on noise hills viewed from above diff --git a/wled00/FXparticleSystem.cpp b/wled00/FXparticleSystem.cpp index 5112fa908e..fed38d1fdd 100644 --- a/wled00/FXparticleSystem.cpp +++ b/wled00/FXparticleSystem.cpp @@ -334,9 +334,15 @@ void Particle_Gravity_update(PSparticle *part, bool wrapX, bool bounceX, bool bo // render particles to the LED buffer (uses palette to render the 8bit particle color value) // if wrap is set, particles half out of bounds are rendered to the other side of the matrix // saturation is color saturation, if not set to 255, hsv instead of palette is used (palette does not support saturation) -void ParticleSys_render(PSparticle *particles, uint32_t numParticles, bool wrapX, bool wrapY, bool fastcoloradd) +void ParticleSys_render(PSparticle *particles, uint32_t numParticles, bool wrapX, bool wrapY) { - +#ifdef ESP8266 + bool fastcoloradd = true; // on ESP8266, we need every bit of performance we can get +#else + bool fastcoloradd = false; // on ESP32, there is little benefit from using fast add +#endif + + const uint16_t cols = strip.isMatrix ? SEGMENT.virtualWidth() : 1; const uint16_t rows = strip.isMatrix ? SEGMENT.virtualHeight() : SEGMENT.virtualLength(); diff --git a/wled00/FXparticleSystem.h b/wled00/FXparticleSystem.h index 80be538a70..78acf52c51 100644 --- a/wled00/FXparticleSystem.h +++ b/wled00/FXparticleSystem.h @@ -77,7 +77,7 @@ void Particle_attractor(PSparticle *particle, PSparticle *attractor, uint8_t *co void Particle_Move_update(PSparticle *part); void Particle_Bounce_update(PSparticle *part, const uint8_t hardness); void Particle_Gravity_update(PSparticle *part, bool wrapX, bool bounceX, bool bounceY, const uint8_t hardness); -void ParticleSys_render(PSparticle *particles, uint32_t numParticles, bool wrapX, bool wrapY, bool fastcoloradd = false); +void ParticleSys_render(PSparticle *particles, uint32_t numParticles, bool wrapX, bool wrapY); void FireParticle_update(PSparticle *part, bool wrapX, bool WrapY); void ParticleSys_renderParticleFire(PSparticle *particles, uint32_t numParticles, bool wrapX); void PartMatrix_addHeat(uint8_t col, uint8_t row, uint16_t heat);