Skip to content

Commit

Permalink
removed option for fastcolor add
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
DedeHai committed Feb 10, 2024
1 parent da94d31 commit 7c49f88
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions wled00/FXparticleSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion wled00/FXparticleSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7c49f88

Please sign in to comment.