add stuff

This commit is contained in:
2018-09-19 00:27:33 +02:00
parent 64e9a33971
commit 1319fb045c
4 changed files with 16 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
{
"pin": 4,
"length": 17,
"brightness": 32,
"length": 60,
"brightness": 64,
"updateInterval": 150,
"defaultColor": 100
}

View File

@@ -11107,7 +11107,10 @@ class Form extends __WEBPACK_IMPORTED_MODULE_1__core_Component__["a" /* default
obj[item.name] = item.value;
return obj;
}, {});
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.post(this.config.endpoint, { fileName: this.config.filename, config: JSON.stringify(data) });
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.post(this.config.endpoint, { fileName: this.config.filename, config: JSON.stringify(data) })
.done((data) => {
alert("data saved");
});
};

View File

@@ -87,11 +87,13 @@ class IlluCat : public MeshSprocket {
addPlugin(new PixelPlugin(pixelConfig, pixels));
// TODO plugin?
dnsServer->setErrorReplyCode(DNSReplyCode::NoError);
dnsServer->start(DNS_PORT, "*", WiFi.softAPIP());
Serial.println(WiFi.softAPIP());
defaultAnimation();
// TODO plugin
// setup web stuff
server->serveStatic("/pixelConfig.json", SPIFFS, "pixelConfig.json");
server->on("/pixel/pattern", HTTP_POST, bind(&IlluCat::patternWebRequestHandler, this, _1));
@@ -123,6 +125,7 @@ class IlluCat : public MeshSprocket {
}
void dispatch( uint32_t from, String &msg ) {
Serial.println(msg);
currentMessage.fromJsonString(msg);
if(currentMessage.valid){
currentMessage.from = from;

View File

@@ -27,6 +27,7 @@ class PixelPlugin : public Plugin {
pixels->setBrightness(pixelConfig.brightness);
}
void activate(Scheduler* userScheduler, Network* network){
subscribe("pixels/colorWheel", bind(&PixelPlugin::colorWheel, this, _1));
subscribe("pixels/color", bind(&PixelPlugin::setColor, this, _1));
subscribe("pixels/color2", bind(&PixelPlugin::setColor2, this, _1));
subscribe("pixels/pattern", bind(&PixelPlugin::setPattern, this, _1));
@@ -43,6 +44,11 @@ class PixelPlugin : public Plugin {
void setState(String msg){
state.fromJsonString(msg);
}
void colorWheel(String msg){
int color = atoi(msg.c_str());
pixels->ActivePattern = NONE;
pixels->ColorSet(pixels->Wheel(color));
}
void setTotalSteps(String msg){
pixels->TotalSteps = atoi(msg.c_str());
}