Skip to content

Commit

Permalink
fixed #ifdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
DedeHai committed Jan 12, 2025
1 parent 0784780 commit 32919fe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
13 changes: 8 additions & 5 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
#include "FX.h"
#include "fcn_declare.h"

#if !defined(WLED_DISABLE_PARTICLESYSTEM2D) || !defined(WLED_DISABLE_PARTICLESYSTEM1D)
#if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D))
#include "FXparticleSystem.h"
#else
#undef DISABLE_1D_PS_REPLACEMENTS
#undef DISABLE_2D_PS_REPLACEMENTS
#endif

//////////////
Expand Down Expand Up @@ -2064,7 +2067,7 @@ uint16_t mode_palette() {
}
static const char _data_FX_MODE_PALETTE[] PROGMEM = "Palette@Shift,Size,Rotation,,,Animate Shift,Animate Rotation,Anamorphic;;!;12;ix=112,c1=0,o1=1,o2=0,o3=1";

#ifndef DISABLE_2D_PS_REPLACEMENTS
#if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D)) // 1D or 2D PS enabled
// WLED limitation: Analog Clock overlay will NOT work when Fire2012 is active
// Fire2012 by Mark Kriegsman, July 2012
// as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY
Expand Down Expand Up @@ -2151,7 +2154,7 @@ uint16_t mode_fire_2012() {
return FRAMETIME;
}
static const char _data_FX_MODE_FIRE_2012[] PROGMEM = "Fire 2012@Cooling,Spark rate,,2D Blur,Boost;;!;1;pal=35,sx=64,ix=160,m12=1,c2=128"; // bars
#endif //DISABLE_2D_PS_REPLACEMENTS
#endif // !defined(DISABLE_2D_PS_REPLACEMENTS) && !defined(DISABLE_1D_PS_REPLACEMENTS)

#ifndef DISABLE_1D_PS_REPLACEMENTS
// ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb
Expand Down Expand Up @@ -10343,7 +10346,7 @@ void WS2812FX::setupEffectData() {
addEffect(FX_MODE_OSCILLATE, &mode_oscillate, _data_FX_MODE_OSCILLATE);
addEffect(FX_MODE_JUGGLE, &mode_juggle, _data_FX_MODE_JUGGLE);
addEffect(FX_MODE_PALETTE, &mode_palette, _data_FX_MODE_PALETTE);
#ifndef DISABLE_2D_PS_REPLACEMENTS
#if !defined(DISABLE_2D_PS_REPLACEMENTS) && !defined(DISABLE_1D_PS_REPLACEMENTS)
addEffect(FX_MODE_FIRE_2012, &mode_fire_2012, _data_FX_MODE_FIRE_2012);
#endif
addEffect(FX_MODE_BPM, &mode_bpm, _data_FX_MODE_BPM);
Expand Down Expand Up @@ -10442,7 +10445,7 @@ void WS2812FX::setupEffectData() {
addEffect(FX_MODE_2DCRAZYBEES, &mode_2Dcrazybees, _data_FX_MODE_2DCRAZYBEES);
#ifndef DISABLE_2D_PS_REPLACEMENTS
addEffect(FX_MODE_2DGHOSTRIDER, &mode_2Dghostrider, _data_FX_MODE_2DGHOSTRIDER);
//addEffect(FX_MODE_2DBLOBS, &mode_2Dfloatingblobs, _data_FX_MODE_2DBLOBS);
addEffect(FX_MODE_2DBLOBS, &mode_2Dfloatingblobs, _data_FX_MODE_2DBLOBS);
#endif
addEffect(FX_MODE_2DSCROLLTEXT, &mode_2Dscrollingtext, _data_FX_MODE_2DSCROLLTEXT);
addEffect(FX_MODE_2DDRIFTROSE, &mode_2Ddriftrose, _data_FX_MODE_2DDRIFTROSE);
Expand Down
2 changes: 2 additions & 0 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,9 @@ void WS2812FX::service() {
}
_segment_index++;
}
#if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D))
servicePSmem(); // handle segment particle system memory
#endif
_isServicing = false;
_triggered = false;
#ifdef WLED_DEBUG
Expand Down
13 changes: 6 additions & 7 deletions wled00/FXparticleSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
-add underscore to private variables
*/

#if !defined(WLED_DISABLE_PARTICLESYSTEM2D) || !defined(WLED_DISABLE_PARTICLESYSTEM1D)
#if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D)) // not both disabled
#include "FXparticleSystem.h"
#endif

#ifndef WLED_DISABLE_PARTICLESYSTEM2D

// local shared functions (used both in 1D and 2D system)
static int32_t calcForce_dv(const int8_t force, uint8_t &counter);
Expand All @@ -37,7 +34,9 @@ uint16_t renderBufferSize = 0; // size in pixels, if allcoated by a 1D system it
bool renderSolo = false; // is set to true if this is the only particle system using the so it can use the buffer continuously (faster blurring)
int32_t globalBlur = 0; // motion blur to apply if multiple PS are using the buffer
int32_t globalSmear = 0; // smear-blur to apply if multiple PS are using the buffer
#endif

#ifndef WLED_DISABLE_PARTICLESYSTEM2D
ParticleSystem2D::ParticleSystem2D(uint32_t width, uint32_t height, uint32_t numberofparticles, uint32_t numberofsources, bool isadvanced, bool sizecontrol) {
PSPRINTLN("\n ParticleSystem2D constructor");
effectID = SEGMENT.mode; // new FX called init, save the effect ID
Expand Down Expand Up @@ -1916,7 +1915,7 @@ void blur1D(CRGB *colorbuffer, uint32_t size, uint32_t blur, uint32_t start)
}
#endif // WLED_DISABLE_PARTICLESYSTEM1D

#if !defined(WLED_DISABLE_PARTICLESYSTEM2D) || !defined(WLED_DISABLE_PARTICLESYSTEM1D)
#if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D)) // not both disabled

//////////////////////////////
// Shared Utility Functions //
Expand Down Expand Up @@ -2215,7 +2214,7 @@ partMem* getPartMem(void) { // TODO: maybe there is a better/faster way than usi
void updateRenderingBuffer(uint32_t requiredpixels, bool isFramebuffer, bool initialize) {
PSPRINTLN("updateRenderingBuffer");
uint16_t& targetBufferSize = isFramebuffer ? frameBufferSize : renderBufferSize; // corresponding buffer size

//if(isFramebuffer) return; // debug only: disable frame-buffer buffer

if(targetBufferSize < requiredpixels) { // check current buffer size
Expand Down Expand Up @@ -2316,4 +2315,4 @@ void transferBuffer(uint32_t width, uint32_t height, bool useAdditiveTransfer) {
#endif
}

#endif // !defined(WLED_DISABLE_PARTICLESYSTEM2D) || !defined(WLED_DISABLE_PARTICLESYSTEM1D)
#endif // !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D))
2 changes: 1 addition & 1 deletion wled00/FXparticleSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Licensed under the EUPL v. 1.2 or later
*/

#if !defined(WLED_DISABLE_PARTICLESYSTEM2D) || !defined(WLED_DISABLE_PARTICLESYSTEM1D)
#if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D)) // not both disabled

#include <stdint.h>
#include "wled.h"
Expand Down

0 comments on commit 32919fe

Please sign in to comment.