-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLEDWallGarland.hpp
102 lines (86 loc) · 2.75 KB
/
LEDWallGarland.hpp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// LEDWallGarland.hpp
#ifndef _LEDWallGarland_HPP_
#define _LEDWallGarland_HPP_
#include <LEDMatrix.h>
#include <UniversalLEDMatrixEffects.h>
#include <DynamicLEDMatrixEffects.h>
template<template <CRGB*, uint8_t, uint8_t> class MATRIX, CRGB* ledLine, uint8_t width, uint8_t height>
class LEDWallGarland : public LEDMatrix
{
private:
enum NOISE_NAME { OCEAN = 0, RAINBOW, CLOUD, FOREST, PARTY, LAVA };
LedEffectName const noiseEffects[6] =
{
"O_N",
"R_N",
"C_N",
"F_N",
"P_N",
"L_N"
};
static const uint8_t NUM_EFFECTS = 6;
LedEffectName availableEffects[NUM_EFFECTS] =
{
noiseEffects[OCEAN],
noiseEffects[RAINBOW],
noiseEffects[CLOUD],
noiseEffects[FOREST],
noiseEffects[PARTY],
noiseEffects[LAVA]
};
public:
LEDWallGarland()
{
};
~LEDWallGarland()
{
};
uint8_t howManyEffects() const override
{
return NUM_EFFECTS;
};
LedEffectName const* getAllEffectsNames() const override
{
return availableEffects;
};
bool setEffectByName(LedEffectName effectName) override
{
if (strcmp(noiseEffects[LAVA], effectName) == 0)
{
delete activeEffect; activeEffect = new NoiseMatrixLedEffect<MATRIX, ledLine, width, height>(random(8, 30), LavaColors_p, random(5, 50));
if (activeEffect != NULL) activeEffect->setId(noiseEffects[LAVA]);
}
else if (strcmp(noiseEffects[OCEAN], effectName) == 0)
{
delete activeEffect; activeEffect = new NoiseMatrixLedEffect<MATRIX, ledLine, width, height>(random(8, 30), OceanColors_p, random(10, 40));
if (activeEffect != NULL) activeEffect->setId(noiseEffects[OCEAN]);
}
else if (strcmp(noiseEffects[RAINBOW], effectName) == 0)
{
delete activeEffect; activeEffect = new NoiseMatrixLedEffect<MATRIX, ledLine, width, height>(random(8, 50), RainbowColors_p, random(5, 50));
if (activeEffect != NULL) activeEffect->setId(noiseEffects[RAINBOW]);
}
else if (strcmp(noiseEffects[CLOUD], effectName) == 0)
{
delete activeEffect; activeEffect = new NoiseMatrixLedEffect<MATRIX, ledLine, width, height>(random(8, 30), CloudColors_p, random(15, 40));
if (activeEffect != NULL) activeEffect->setId(noiseEffects[CLOUD]);
}
else if (strcmp(noiseEffects[FOREST], effectName) == 0)
{
delete activeEffect; activeEffect = new NoiseMatrixLedEffect<MATRIX, ledLine, width, height>(random(8, 30), ForestColors_p, random(5, 50));
if (activeEffect != NULL) activeEffect->setId(noiseEffects[FOREST]);
}
else if (strcmp(noiseEffects[PARTY], effectName) == 0)
{
delete activeEffect; activeEffect = new NoiseMatrixLedEffect<MATRIX, ledLine, width, height>(random(8, 50), PartyColors_p, random(5, 50));
if (activeEffect != NULL) activeEffect->setId(noiseEffects[PARTY]);
}
else
{
return false;
}
if (activeEffect != nullptr) activeEffect->start();
return true;
};
};
#endif