Added new HTTP API commands (resolves #597)

This commit is contained in:
cschwinne 2020-01-19 01:07:38 +01:00
parent 569efd3e45
commit 125e21900a
3 changed files with 20 additions and 6 deletions

View File

@ -90,7 +90,7 @@
#endif
//version code in format yymmddb (b = daily build)
#define VERSION 2001151
#define VERSION 2001191
char versionString[] = "0.9.0-b2";

View File

@ -53,7 +53,9 @@ char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr)
}
oappend("</wv><ws>");
oappendi(colSec[3]);
oappend("</ws><cy>");
oappend("</ws><ps>");
oappendi((currentPreset < 1) ? 0:currentPreset);
oappend("</ps><cy>");
oappendi(presetCyclingEnabled);
oappend("</cy><ds>");
if (realtimeActive)

View File

@ -377,11 +377,14 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
if (t < strip.getMaxSegments()) main = t;
}
WS2812FX::Segment& mainseg = strip.getSegment(main);
pos = req.indexOf("SV="); //segment selected
if (pos > 0) strip.getSegment(main).setOption(0, (req.charAt(pos+3) != '0'));
if (pos > 0) mainseg.setOption(0, (req.charAt(pos+3) != '0'));
uint16_t startI = strip.getSegment(main).start;
uint16_t stopI = strip.getSegment(main).stop;
uint16_t startI = mainseg.start;
uint16_t stopI = mainseg.stop;
uint8_t grpI = mainseg.grouping;
uint16_t spcI = mainseg.spacing;
pos = req.indexOf("&S="); //segment start
if (pos > 0) {
startI = getNumVal(&req, pos);
@ -390,7 +393,16 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
if (pos > 0) {
stopI = getNumVal(&req, pos);
}
strip.setSegment(main, startI, stopI);
pos = req.indexOf("GP="); //segment grouping
if (pos > 0) {
grpI = getNumVal(&req, pos);
if (grpI == 0) grpI = 1;
}
pos = req.indexOf("SP="); //segment spacing
if (pos > 0) {
spcI = getNumVal(&req, pos);
}
strip.setSegment(main, startI, stopI, grpI, spcI);
main = strip.getMainSegmentId();