forked from jasoncoon/esp8266-fastled-webserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFields.h
119 lines (94 loc) · 3.19 KB
/
Fields.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
Copyright (C) 2016 Jason Coon
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
uint8_t power = 1;
uint8_t brightness = brightnessMap[brightnessIndex];
String getPower() {
return String(power);
}
String getBrightness() {
return String(brightness);
}
String getPattern() {
return String(currentPatternIndex);
}
String getPatterns() {
String json = "";
for (uint8_t i = 0; i < patternCount; i++) {
json += "\"" + patterns[i].name + "\"";
if (i < patternCount - 1)
json += ",";
}
return json;
}
String getPalette() {
return String(currentPaletteIndex);
}
String getPalettes() {
String json = "";
for (uint8_t i = 0; i < paletteCount; i++) {
json += "\"" + paletteNames[i] + "\"";
if (i < paletteCount - 1)
json += ",";
}
return json;
}
String getGlitter() {
return String(glitter);
}
String getStrobe() {
return String(strobe);
}
String getMicrophone() {
return String(microphone);
}
String getAutoplay() {
return String(autoplay);
}
String getAutoplayDuration() {
return String(autoplayDuration);
}
String getAutocolor() {
return String(autocolor);
}
String getAutocolorDuration() {
return String(autocolorDuration);
}
String getSolidColor() {
return String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b);
}
String getSpeed() {
return String(speed);
}
// UI Fields
FieldList fields = {
{ "power", "Power", BooleanFieldType, 0, 1, getPower },
{ "brightness", "Brightness", NumberFieldType, 1, 255, getBrightness },
{ "speed", "Speed", NumberFieldType, 1, 255, getSpeed },
{ "pattern", "Pattern", SectionFieldType },
{ "pattern", "Pattern", SelectFieldType, 0, patternCount, getPattern, getPatterns },
{ "autoplay", "Random", BooleanFieldType, 0, 1, getAutoplay },
{ "autoplayDuration", "Duration", NumberFieldType, 0, 255, getAutoplayDuration },
{ "palette", "Palette", SectionFieldType },
{ "palette", "Palette", SelectFieldType, 0, paletteCount, getPalette, getPalettes },
{ "autocolor", "Random", BooleanFieldType, 0, 1, getAutocolor },
{ "autocolorDuration", "Duration", NumberFieldType, 0, 255, getAutocolorDuration },
{ "glitter", "Glitter", SectionFieldType },
{ "glitter", "Glitter", BooleanFieldType, 0, 1, getGlitter },
{ "strobe", "Strobe", BooleanFieldType, 0, 1, getStrobe },
{ "microphone", "Microphone", BooleanFieldType, 0, 1, getMicrophone },
{ "solidColor", "Solid color", SectionFieldType },
{ "solidColor", "Solid color", ColorFieldType, 0, 255, getSolidColor },
};
uint8_t fieldCount = ARRAY_SIZE(fields);