mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-16 10:04:30 +01:00
add stuff
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user