diff --git a/data/pixelConfig.json b/data/pixelConfig.json index 90c27a5..788cf46 100644 --- a/data/pixelConfig.json +++ b/data/pixelConfig.json @@ -1,7 +1,7 @@ { "pin": 4, - "length": 17, - "brightness": 32, + "length": 60, + "brightness": 64, "updateInterval": 150, "defaultColor": 100 } \ No newline at end of file diff --git a/data/www/script.js b/data/www/script.js index 5215086..2da6246 100644 --- a/data/www/script.js +++ b/data/www/script.js @@ -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"); + }); }; diff --git a/src/IlluCat.h b/src/IlluCat.h index 20b2724..f939994 100644 --- a/src/IlluCat.h +++ b/src/IlluCat.h @@ -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; diff --git a/src/PixelPlugin.h b/src/PixelPlugin.h index b7fab64..dfd7f70 100644 --- a/src/PixelPlugin.h +++ b/src/PixelPlugin.h @@ -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()); }