Add /get_speed and /set_speed endpoints
Like proposed in https://github.com/toblum/McLighting/pull/49
This commit is contained in:
@@ -446,26 +446,21 @@ void setup() {
|
|||||||
DBG_OUTPUT_PORT.println(str_brightness);
|
DBG_OUTPUT_PORT.println(str_brightness);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/set_delay", []() {
|
server.on("/set_speed", []() {
|
||||||
if (server.arg("d").toInt() >= 0) {
|
if (server.arg("d").toInt() >= 0) {
|
||||||
ws2812fx_speed = server.arg("d").toInt();
|
ws2812fx_speed = server.arg("d").toInt();
|
||||||
}
|
ws2812fx_speed = constrain(ws2812fx_speed, 0, 255);
|
||||||
if (ws2812fx_speed > 255) {
|
|
||||||
ws2812fx_speed = 255;
|
|
||||||
}
|
|
||||||
if (ws2812fx_speed < 0) {
|
|
||||||
ws2812fx_speed = 0;
|
|
||||||
}
|
|
||||||
strip.setSpeed(ws2812fx_speed);
|
strip.setSpeed(ws2812fx_speed);
|
||||||
|
}
|
||||||
|
|
||||||
getStatusJSON();
|
getStatusJSON();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/get_delay", []() {
|
server.on("/get_speed", []() {
|
||||||
String str_delay = String(ws2812fx_speed);
|
String str_speed = String(ws2812fx_speed);
|
||||||
server.send(200, "text/plain", str_delay );
|
server.send(200, "text/plain", str_speed );
|
||||||
DBG_OUTPUT_PORT.print("/get_delay: ");
|
DBG_OUTPUT_PORT.print("/get_speed: ");
|
||||||
DBG_OUTPUT_PORT.println(str_delay);
|
DBG_OUTPUT_PORT.println(str_speed);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/get_switch", []() {
|
server.on("/get_switch", []() {
|
||||||
|
|||||||
Reference in New Issue
Block a user