-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEffectManager.h
More file actions
76 lines (68 loc) · 2.23 KB
/
Copy pathEffectManager.h
File metadata and controls
76 lines (68 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once
#define FASTLED_INTERRUPT_RETRY_COUNT 0
#define FASTLED_ESP8266_RAW_PIN_ORDER
#include <FastLED.h>
#include "Effect.h"
#include "Palette.h"
#include "Params.h"
class EffectManager {
public:
static Effect* effects[Params::NB_EFFECTS];
static Palette* palettes[Params::NB_PALETTES];
private:
constexpr static const uint16_t DISABLED_PIXELS[] = {};
CRGB leds[Params::NUM_PIXELS];
uint8_t brightness;
uint8_t palette;
uint8_t effect;
uint32_t lastFrame;
uint32_t frametime;
uint32_t primaryColor;
uint32_t secondaryColor;
uint32_t tertiaryColor;
uint8_t effectSpeed;
uint8_t effectIntensity;
public:
EffectManager(uint8_t fps, uint8_t brightness, uint32_t primaryColor, uint32_t secondaryColor, uint32_t tertiaryColor) {
this->palette = 0;
this->effect = 0;
this->lastFrame = millis();
this->frametime = 1000/fps;
this->brightness = brightness;
this->primaryColor = primaryColor;
this->secondaryColor = secondaryColor;
this->tertiaryColor = tertiaryColor;
this->effectSpeed = 128;
this->effectIntensity = 128;
setPrimaryColor(primaryColor);
setSecondaryColor(secondaryColor);
setTertiaryColor(tertiaryColor);
}
virtual ~EffectManager() {}
void init();
void frame();
uint8_t getPaletteId();
Palette* getPalette();
void selectPalette(uint8_t palette);
uint8_t getEffectId();
Effect* getEffect();
void selectEffect(uint8_t effect);
uint8_t getMasterBrightness();
void setMasterBrightness(uint8_t brightness);
uint32_t getPrimaryColor();
void setPrimaryColor(uint32_t color);
uint32_t getSecondaryColor();
void setSecondaryColor(uint32_t color);
uint32_t getTertiaryColor();
void setTertiaryColor(uint32_t color);
uint8_t getEffectSpeed();
void setEffectSpeed(uint8_t spd);
uint8_t getEffectIntensity();
void setEffectIntensity(uint8_t intensity);
uint8_t getNbPalettes();
uint8_t getNbEffects();
Palette* getPalette(String name);
Palette* getPalette(uint8_t id);
Effect* getEffect(String name);
Effect* getEffect(uint8_t id);
};