Added effect "cycle" which cycles between a set of effects.

This commit is contained in:
2019-05-25 21:11:49 +02:00
parent 8a82518d6b
commit 50a54d209f
4 changed files with 584 additions and 17 deletions

View File

@ -5,6 +5,7 @@
#include "FastLED.h"
#include <NTPClient.h>
#include <PubSubClient.h>
#include "SimpleList.h"
#include "config.h"
CRGB leds[LED_COUNT];
@ -27,14 +28,30 @@ typedef struct {
uint8_t h;
} Window;
class Effect {
protected:
Window window = {0, 0, LED_WIDTH, LED_HEIGHT}; // Use a full screen window per default.
public:
virtual void loop() = 0;
boolean supports_window = false;
virtual boolean can_be_shown_with_clock() { return false; };
virtual boolean clock_as_mask() { return false; };
void setWindow(Window win) {
window = win;
};
};
#include "functions.h"
#include "text.h"
#include "sprites.h"
#include "animations.h"
#include "tools.h"
SimpleList<Effect*>* cycle_effects;
#include "effects.h"
#define NUM_EFFECTS 10
#define NUM_EFFECTS 11
//EffectEntry effects[NUM_EFFECTS];
Sinematrix3 sinematrix3;
BigClock big_clock;
@ -46,6 +63,7 @@ Animation anim_couple_rain(&animation_couple_rain, CRGB(0x000000), -8, -16);
SingleDynamic single_dynamic;
MultiDynamic multi_dynamic;
MatrixEffect matrix;
CycleEffect effect_cycle;
EffectEntry effects[NUM_EFFECTS] = {
{"sinematrix3", (Effect *)&sinematrix3},
@ -58,13 +76,23 @@ EffectEntry effects[NUM_EFFECTS] = {
{"single_dynamic", (Effect *)&single_dynamic},
{"multi_dynamic", (Effect *)&multi_dynamic},
{"matrix", (Effect *)&matrix},
{"cycle", (Effect *)&effect_cycle},
};
void setup_cycle_effects() {
LOGln("Core * Setting up cycle_effects");
cycle_effects = new SimpleList<Effect*>();
cycle_effects->add(&sinematrix3);
cycle_effects->add(&single_dynamic);
cycle_effects->add(&multi_dynamic);
cycle_effects->add(&matrix);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(74880);
Serial.println("Core * Starting");
setup_cycle_effects();
wifi_setup();
ota_setup();
fastled_setup();