Skip to content

Commit

Permalink
Combine rainbows update tags remove projection.dim
Browse files Browse the repository at this point in the history
LedFixture: remove projection.dim

LedEffects, LedModEffects: Rainbow combining and renaming

LedProjections: update tags, remove dim
  • Loading branch information
ewoudwijma committed Jun 24, 2024
1 parent c890799 commit 05d6d95
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 60 deletions.
72 changes: 35 additions & 37 deletions src/App/LedEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,41 +99,9 @@ class SolidEffect: public Effect {
};

class RainbowEffect: public Effect {
public:
const char * name() {return "Rainbow";}
uint8_t dim() {return _1D;}
const char * tags() {return "";}

void loop(Leds &leds) {
// FastLED's built-in rainbow generator
leds.fill_rainbow(sys->now/50, 7);
}

void controls(Leds &leds, JsonObject parentVar) {} //so no palette control is created
};

class RainbowWithGlitterEffect: public RainbowEffect {
const char * name() {return "Rainbow with glitter";}
uint8_t dim() {return _1D;}
const char * tags() {return "";}

void loop(Leds &leds) {
// built-in FastLED rainbow, plus some random sparkly glitter
RainbowEffect::loop(leds);
addGlitter(leds, 80);
}
void addGlitter(Leds &leds, fract8 chanceOfGlitter)
{
if( random8() < chanceOfGlitter) {
leds[ random16(leds.nrOfLeds) ] += CRGB::White;
}
}
};

class RainbowWLED: public Effect {
const char * name() {return "Rainbow WLED";}
const char * name() {return "Rainbow";} //make one rainbow? remove the fastled rainbow?
uint8_t dim() {return _1D;}
const char * tags() {return "";}
const char * tags() {return "💡";} //💡 means wled origin

void loop(Leds &leds) {
// UI Variables
Expand All @@ -156,11 +124,41 @@ class RainbowWLED: public Effect {
}
};

class RainbowWithGlitterEffect: public Effect {
const char * name() {return "Rainbow with glitter";}
uint8_t dim() {return _1D;}
const char * tags() {return "";} //⚡ means FastLED origin

void loop(Leds &leds) {
uint8_t glitter = leds.sharedData.read<bool>();

// built-in FastLED rainbow, plus some random sparkly glitter
// FastLED's built-in rainbow generator
leds.fill_rainbow(sys->now/50, 7);

if (glitter)
addGlitter(leds, 80);
}

void addGlitter(Leds &leds, fract8 chanceOfGlitter)
{
if( random8() < chanceOfGlitter) {
leds[ random16(leds.nrOfLeds) ] += CRGB::White;
}
}

void controls(Leds &leds, JsonObject parentVar) {
//no palette control is created
ui->initCheckBox(parentVar, "glitter", leds.sharedData.write<bool>(false));
}

};

// Best of both worlds from Palette and Spot effects. By Aircoookie
class FlowWLED: public Effect {
const char * name() {return "Flow WLED";}
class FlowEffect: public Effect {
const char * name() {return "Flow";}
uint8_t dim() {return _1D;}
const char * tags() {return "";}
const char * tags() {return "💡";} //💡 means wled origin

void loop(Leds &leds) {
// UI Variables
Expand Down
2 changes: 1 addition & 1 deletion src/App/LedFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Projection {
public:
virtual const char * name() {return "noname";}
virtual const char * tags() {return "";}
virtual uint8_t dim() {return _1D;};
// virtual uint8_t dim() {return _1D;};

virtual void adjustSizeAndPixel(Coord3D &sizeAdjusted, Coord3D &pixelAdjusted, Coord3D &proCenter) {}

Expand Down
5 changes: 2 additions & 3 deletions src/App/LedModEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class LedModEffects:public SysModule {
// 1D FastLed
effects.push_back(new RainbowEffect);
effects.push_back(new RainbowWithGlitterEffect);
effects.push_back(new RainbowWLED);
effects.push_back(new FlowWLED);
effects.push_back(new FlowEffect);
effects.push_back(new SinelonEffect);
effects.push_back(new ConfettiEffect);
effects.push_back(new BPMEffect);
Expand Down Expand Up @@ -226,7 +225,7 @@ class LedModEffects:public SysModule {
for (Projection *projection:fixture.projections) {
char buf[32] = "";
strcat(buf, projection->name());
strcat(buf, projection->dim()==_1D?"":projection->dim()==_2D?"":" 🧊");
// strcat(buf, projection->dim()==_1D?" ┊":projection->dim()==_2D?" ▦":" 🧊");
strcat(buf, " ");
strcat(buf, projection->tags());
options.add(JsonString(buf, JsonString::Copied)); //copy!
Expand Down
39 changes: 20 additions & 19 deletions src/App/LedProjections.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

class NoneProjection: public Projection {
const char * name() {return "None";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

void controls(Leds &leds, JsonObject parentVar) {
}
Expand All @@ -23,15 +23,15 @@ class NoneProjection: public Projection {

class DefaultProjection: public Projection {
const char * name() {return "Default";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

}; //DefaultProjection

class MultiplyProjection: public Projection {
const char * name() {return "Multiply";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

public: //to use in Preset1Projection

Expand Down Expand Up @@ -83,8 +83,8 @@ class MultiplyProjection: public Projection {

class TiltPanRollProjection: public Projection {
const char * name() {return "TiltPanRoll";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

public: //to use in Preset1Projection

Expand Down Expand Up @@ -145,8 +145,8 @@ class TiltPanRollProjection: public Projection {

class DistanceFromPointProjection: public Projection {
const char * name() {return "Distance ⌛";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

public: //to use in Preset1Projection

Expand All @@ -171,8 +171,8 @@ class DistanceFromPointProjection: public Projection {

class Preset1Projection: public Projection {
const char * name() {return "Preset1";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

void adjustSizeAndPixel(Coord3D &sizeAdjusted, Coord3D &pixelAdjusted, Coord3D &proCenter) {
MultiplyProjection mp;
Expand Down Expand Up @@ -201,16 +201,16 @@ class Preset1Projection: public Projection {

class RandomProjection: public Projection {
const char * name() {return "Random";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

void controls(Leds &leds, JsonObject parentVar) {
}
}; //RandomProjection

class ReverseProjection: public Projection {
const char * name() {return "Reverse WIP";}
uint8_t dim() {return _1D;}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💡";}

void controls(Leds &leds, JsonObject parentVar) {
Expand All @@ -219,7 +219,7 @@ class ReverseProjection: public Projection {

class MirrorProjection: public Projection {
const char * name() {return "Mirror WIP";}
uint8_t dim() {return _1D;}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💡";}

void controls(Leds &leds, JsonObject parentVar) {
Expand All @@ -228,8 +228,8 @@ class MirrorProjection: public Projection {

class KaleidoscopeProjection: public Projection {
const char * name() {return "Kaleidoscope WIP";}
uint8_t dim() {return _1D;}
const char * tags() {return "💡";}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💫";}

void controls(Leds &leds, JsonObject parentVar) {
}
Expand Down Expand Up @@ -279,12 +279,13 @@ class PinwheelProjection: public Projection {
// UI swirlVal
// UI arms? arms currently 360, reduce for diff effect?
// UI add multiply / mirror / reverse / tilt pan roll
// ui->initCheckBox(parentVar, "pw test", true);
}
}; //PinwheelProjection

class TestProjection: public Projection {
const char * name() {return "Test";}
uint8_t dim() {return _1D;}
//uint8_t dim() {return _1D;} // every projection should work for all D
const char * tags() {return "💡";}

void controls(Leds &leds, JsonObject parentVar) {
Expand Down

0 comments on commit 05d6d95

Please sign in to comment.