mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-15 01:42:22 +01:00
reorder fnc calls
This commit is contained in:
@@ -30,13 +30,12 @@ class IlluCat : public Sprocket {
|
||||
OtaConfig otaConfig;
|
||||
WebServerConfig webConfig;
|
||||
|
||||
SprocketMessage currentMessage;
|
||||
|
||||
IlluCat(SprocketConfig cfg, OtaConfig otaCfg, WebServerConfig webCfg) : Sprocket(cfg) {
|
||||
sprocketConfig = cfg;
|
||||
otaConfig = otaCfg;
|
||||
webConfig = webCfg;
|
||||
server = new AsyncWebServer(80);
|
||||
server->serveStatic(PIXEL_CONFIG_FILE, SPIFFS, "pixelConfig.json");
|
||||
}
|
||||
|
||||
void setup(){
|
||||
@@ -44,16 +43,6 @@ class IlluCat : public Sprocket {
|
||||
addPlugin(new WebServerPlugin(webConfig, server));
|
||||
addPlugin(new WebConfigPlugin(server));
|
||||
addPlugin(new WebApi(server, 1));
|
||||
server->serveStatic(PIXEL_CONFIG_FILE, SPIFFS, "pixelConfig.json");
|
||||
}
|
||||
|
||||
// TODO move to Sprocket
|
||||
virtual void dispatch( uint32_t from, String &msg ) {
|
||||
currentMessage.fromJsonString(msg);
|
||||
if(currentMessage.valid){
|
||||
currentMessage.from = from;
|
||||
publish(currentMessage.topic, currentMessage.payload);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -42,6 +42,10 @@ void PixelPlugin::defaultAnimation() {
|
||||
|
||||
void PixelPlugin::activate(Scheduler *userScheduler, Network *network)
|
||||
{
|
||||
animation.set(TASK_MILLISECOND * pixelConfig.updateInterval, TASK_FOREVER, bind(&PixelPlugin::animate, this));
|
||||
userScheduler->addTask(animation);
|
||||
animation.enable();
|
||||
|
||||
subscribe("pixels/colorWheel", bind(&PixelPlugin::colorWheel, this, _1));
|
||||
subscribe("pixels/color", bind(&PixelPlugin::setColor, this, _1));
|
||||
subscribe("pixels/color2", bind(&PixelPlugin::setColor2, this, _1));
|
||||
@@ -50,9 +54,6 @@ void PixelPlugin::activate(Scheduler *userScheduler, Network *network)
|
||||
subscribe("pixels/brightness", bind(&PixelPlugin::setBrightness, this, _1));
|
||||
subscribe("pixels/state", bind(&PixelPlugin::setState, this, _1));
|
||||
|
||||
animation.set(TASK_MILLISECOND * pixelConfig.updateInterval, TASK_FOREVER, bind(&PixelPlugin::animate, this));
|
||||
userScheduler->addTask(animation);
|
||||
animation.enable();
|
||||
PRINT_MSG(Serial, SPROCKET_TYPE, "NeoPixels activated");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user