-
Notifications
You must be signed in to change notification settings - Fork 0
/
PatternDemoReel.h
101 lines (79 loc) · 2.35 KB
/
PatternDemoReel.h
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
// *****************************************
// Demo Reel Rainbow
// *****************************************
boolean gDemoReelCycle = true;
uint8_t gDemoReelHue = 0;
boolean gDemoReelGlitter = true;
uint8_t gDemoReelGlitterChance = 80;
uint8_t gDemoReelDelay = 8;
void addGlitter( fract8 chanceOfGlitter)
{
if( random8() < chanceOfGlitter) {
gLeds[ random16(NUM_LEDS) ] += CRGB::White;
}
}
void fDemoReel()
{
fill_rainbow( gLeds, NUM_LEDS, gDemoReelHue, 7);
if (gDemoReelGlitter) addGlitter(gDemoReelGlitterChance);
if (gDemoReelCycle) gDemoReelHue++;
FastLED.delay(gDemoReelDelay);
}
// *****************************************
// Cycle
// *****************************************
String setDemoReelCycle(String value) {
gDemoReelCycle = value.toInt();
storageWrite("demoReelCycle");
broadcastInt("demoReelCycle", gDemoReelCycle);
return String(gDemoReelCycle);
}
String getDemoReelCycle() {
return String(gDemoReelCycle);
}
// *****************************************
// Hue
// *****************************************
String setDemoReelHue(String value) {
gDemoReelHue = value.toInt();
return String(gDemoReelHue);
}
String getDemoReelHue() {
return String(gDemoReelHue);
}
// *****************************************
// Glitter
// *****************************************
String setDemoReelGlitter(String value) {
gDemoReelGlitter = value.toInt();
storageWrite("demoReelGlitter");
broadcastInt("demoReelGlitter", gDemoReelGlitter);
return String(gDemoReelGlitter);
}
String getDemoReelGlitter() {
return String(gDemoReelGlitter);
}
// *****************************************
// Glitter Chance
// *****************************************
String setDemoReelGlitterChance(String value) {
gDemoReelGlitterChance = value.toInt();
storageWrite("demoReelGlitterChance");
broadcastInt("demoReelGlitterChance", gDemoReelGlitterChance);
return String(gDemoReelGlitterChance);
}
String getDemoReelGlitterChance() {
return String(gDemoReelGlitterChance);
}
// *****************************************
// Delay
// *****************************************
String setDemoReelDelay(String value) {
gDemoReelDelay = value.toInt();
storageWrite("demoReelGlitterDelay");
broadcastInt("demoReelGlitterDelay", gDemoReelDelay);
return String(gDemoReelDelay);
}
String getDemoReelDelay() {
return String(gDemoReelDelay);
}