Skip to content

Commit c320b0a

Browse files
committed
cleanup
1 parent 2db3123 commit c320b0a

File tree

1 file changed

+29
-35
lines changed

1 file changed

+29
-35
lines changed

wled00/FX.cpp

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7889,17 +7889,15 @@ uint16_t mode_particlespray(void)
78897889

78907890
if (SEGLEN == 1) return mode_static();
78917891

7892-
<<<<<<< Updated upstream
78937892
const uint16_t cols = strip.isMatrix ? SEGMENT.virtualWidth() : 1;
78947893
const uint16_t rows = strip.isMatrix ? SEGMENT.virtualHeight() : SEGMENT.virtualLength();
78957894

78967895
const uint16_t numParticles = 250;
7897-
=======
7898-
const uint16_t numParticles = 450;
7899-
>>>>>>> Stashed changes
79007896
const uint8_t numSprays = 1;
79017897
uint8_t percycle = numSprays; //maximum number of particles emitted per cycle
79027898

7899+
//todo: for ESP8266 only about 250 particles are possible, for ESP32 450 or even more
7900+
79037901
//test, use static particles
79047902

79057903
static PSparticle* particles;
@@ -8045,13 +8043,9 @@ uint16_t mode_particlefire(void)
80458043
const uint16_t PS_MAX_X (cols*PS_P_RADIUS-1);
80468044
//const uint16_t PS_MAX_Y (rows*PS_P_RADIUS-1);
80478045

8048-
<<<<<<< Updated upstream
8049-
const uint16_t numParticles = 550;
8050-
const uint8_t numFlames = (cols-2)<<1; //number of flames: depends on fire width. for a fire width of 16 pixels total, about 25-30 flames give good results
8051-
uint8_t percycle = numFlames/2; //maximum number of particles emitted per cycle
8052-
=======
80538046
//test for ESP8266 as it will not run with that many flames (not enough ram)
80548047
const uint16_t numFlames = cols; //number of flames: depends on fire width. for a fire width of 16 pixels, about 25-30 flames give good results, add a few for the base flames
8048+
//for ESP32: (cols-2)<<1 TODO: need to fix this by using ifdef
80558049
const uint16_t numParticles = numFlames*20;
80568050

80578051
// const uint16_t numFlames = (cols<<1); //number of flames: depends on fire width. for a fire width of 16 pixels, about 25-30 flames give good results, add a few for the base flames
@@ -8076,7 +8070,6 @@ uint16_t mode_particlefire(void)
80768070
//calculate the end of the spray data and assign it as the data pointer for the particles:
80778071
particles = reinterpret_cast<PSparticle*>(flames+numFlames); //cast the data array into a particle pointer
80788072

8079-
>>>>>>> Stashed changes
80808073
uint16_t i;
80818074
/*
80828075
#ifdef FIRELAMP
@@ -8230,46 +8223,47 @@ static const char _data_FX_MODE_PARTICLEFIRE[] PROGMEM = "Particle Fire@Speed,In
82308223

82318224

82328225
<<<<<<< Updated upstream
8233-
=======
8234-
/*
8235-
particles falling down, user can enable these three options: X-wraparound, side bounce, ground bounce
8236-
sliders control falling speed, intensity (number of particles spawned), WIND OR SPEED RANDOMNESS?, inter-particle collision hardness (0 means no particle collisions) and render saturation
8237-
this is quite versatile, can be made to look like rain or snow or confetti, flying sparks etc.
8238-
Uses palette for particle color
8239-
by DedeHai (Damian Schneider)
8240-
*/
8226+
== == == =
8227+
/*
8228+
particles falling down, user can enable these three options: X-wraparound, side bounce, ground bounce
8229+
sliders control falling speed, intensity (number of particles spawned), WIND OR SPEED RANDOMNESS?, inter-particle collision hardness (0 means no particle collisions) and render saturation
8230+
this is quite versatile, can be made to look like rain or snow or confetti, flying sparks etc.
8231+
Uses palette for particle color
8232+
by DedeHai (Damian Schneider)
8233+
*/
8234+
8235+
uint16_t mode_particlefall(void)
8236+
{
82418237

8242-
uint16_t mode_particlefall(void){
8243-
8244-
if (SEGLEN == 1) return mode_static();
8238+
if (SEGLEN == 1)
8239+
return mode_static();
82458240

82468241
const uint16_t cols = strip.isMatrix ? SEGMENT.virtualWidth() : 1;
82478242
const uint16_t rows = strip.isMatrix ? SEGMENT.virtualHeight() : SEGMENT.virtualLength();
82488243

82498244
const uint16_t numParticles = 500;
8250-
8251-
PSparticle* particles;
82528245

8253-
//allocate memory and divide it into proper pointers, max is 32k for all segments.
8254-
uint32_t dataSize = sizeof(PSparticle) * numParticles;
8255-
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed; //allocation failed
8246+
PSparticle *particles;
82568247

8257-
//calculate the end of the spray data and assign it as the data pointer for the particles:
8258-
particles = reinterpret_cast<PSparticle*>(SEGENV.data); //cast the data array into a particle pointer
8248+
// allocate memory and divide it into proper pointers, max is 32k for all segments.
8249+
uint32_t dataSize = sizeof(PSparticle) * numParticles;
8250+
if (!SEGENV.allocateData(dataSize))
8251+
return mode_static(); // allocation failed; //allocation failed
82598252

8253+
// calculate the end of the spray data and assign it as the data pointer for the particles:
8254+
particles = reinterpret_cast<PSparticle *>(SEGENV.data); // cast the data array into a particle pointer
82608255

8261-
uint16_t i =0;
8262-
uint16_t j =0;
8263-
8264-
if (SEGMENT.call == 0) //initialization
8256+
uint16_t i = 0;
8257+
uint16_t j = 0;
8258+
8259+
if (SEGMENT.call == 0) // initialization
82658260
{
8266-
for(i=0; i<numParticles; i++)
8261+
for (i = 0; i < numParticles; i++)
82678262
{
82688263
particles[i].ttl=0;
82698264
}
82708265
}
82718266

8272-
82738267
if(SEGMENT.call % (64-(SEGMENT.intensity>>2)) == 0 && SEGMENT.intensity>1) //every nth frame emit particles, stop emitting if zero
82748268
{
82758269
while(i<numParticles) //emit particles
@@ -8341,7 +8335,7 @@ uint16_t mode_particlefall(void){
83418335
//render the particles
83428336
ParticleSys_render(particles, numParticles,((SEGMENT.custom3)<<3)+7,SEGMENT.check1,false); //custom3 slider is saturation, from 7 to 255, 7 is close enough to white (for snow for example)
83438337

8344-
return FRAMETIME;
8338+
return FRAMETIME;
83458339
}
83468340
static const char _data_FX_MODE_PARTICLEFALL[] PROGMEM = "Falling Particles@Speed,Intensity,Randomness,Collision hardness,Saturation,Wrap X,Side bounce,Ground bounce;;!;012;pal=11,sx=100,ix=200,c1=31,c2=0,c3=31,o1=0,o2=0,o3=1";
83478341

0 commit comments

Comments
 (0)