forked from forkineye/ESPixelStick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage_config_pixel.h
65 lines (61 loc) · 3.44 KB
/
page_config_pixel.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
#ifndef PAGE_CONFIG_PIXEL_H
#define PAGE_CONFIG_PIXEL_H
const char PAGE_CONFIG_PIXEL[] PROGMEM = R"=====(
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="/style.css" type="text/css"/>
<script src="/microajax.js"></script>
<a href="/" class="btn btn--s"><</a> <strong>Pixel Configuration</strong>
<hr>
<form action="" method="get">
<table border="0" cellspacing="0" cellpadding="3">
<tr><td align="right">Universe :</td><td><input type="text" id="universe" name="universe" value=""></td></tr>
<tr><td align="right">Start Channel :</td><td><input type="text" id="channel_start" name="channel_start" value=""></td></tr>
<tr><td align="right">Pixel Count :</td><td><input type="text" id="pixel_count" name="pixel_count" value=""></td></tr>
<tr><td align="right">Pixel Type :</td><td><select id="pixel_type" name="pixel_type"></select></td></tr>
<tr><td align="right">Color Order :</td><td><select id="pixel_color" name="pixel_color"></select></td></tr>
<tr><td align="right">PPU :</td><td><input type="text" id="ppu" name="ppu" value=""></td></tr>
<tr><td align="right">Gamma Map :</td><td><input type="checkbox" id="gamma" name="gamma"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" style="width:150px" class="btn btn--m btn--blue" value="Save"></td></tr>
</table>
</form>
<script>
setValues("/config/pixelvals");
</script>
)=====";
void send_config_pixel_html() {
if (web.args()) { // Save Settings
config.gamma = 0;
for (uint8_t i = 0; i < web.args(); i++) {
if (web.argName(i) == "universe") config.universe = web.arg(i).toInt();
if (web.argName(i) == "channel_start") config.channel_start = web.arg(i).toInt();
if (web.argName(i) == "pixel_count") config.pixel_count = web.arg(i).toInt();
if (web.argName(i) == "pixel_type") config.pixel_type = (pixel_t)web.arg(i).toInt();
if (web.argName(i) == "pixel_color") config.pixel_color = (color_t)web.arg(i).toInt();
if (web.argName(i) == "ppu") config.ppu = web.arg(i).toInt();
//if (web.argName(i) == "gamma") config.gamma = web.arg(i).toFloat();
if (web.argName(i) == "gamma") config.gamma = 1.0;
}
updatePixelConfig();
saveConfig();
}
web.send(200, "text/html", PAGE_CONFIG_PIXEL);
}
void send_config_pixel_vals_html() {
String values = "";
values += "universe|input|" + (String)config.universe + "\n";
values += "channel_start|input|" + (String)config.channel_start + "\n";
values += "pixel_count|input|" + (String)config.pixel_count + "\n";
values += "pixel_type|opt|" + String("WS2811 800kHz|") + (String)PIXEL_WS2811 + "\n";
values += "pixel_type|opt|" + String("GE Color Effects|") + (String)PIXEL_GECE + "\n";
values += "pixel_type|input|" + (String)config.pixel_type + "\n";
values += "pixel_color|opt|" + String("RGB|") + (String)COLOR_RGB + "\n";
values += "pixel_color|opt|" + String("GRB|") + (String)COLOR_GRB + "\n";
values += "pixel_color|opt|" + String("BRG|") + (String)COLOR_BRG + "\n";
values += "pixel_color|opt|" + String("RBG|") + (String)COLOR_RBG + "\n";
values += "pixel_color|input|" + (String)config.pixel_color + "\n";
values += "ppu|input|" + String(config.ppu) + "\n";
//values += "gamma|input|" + String(config.gamma) + "\n";
values += "gamma|chk|" + String(config.gamma ? "checked" : "") + "\n";
web.send(200, "text/plain", values);
}
#endif