#include #include #include "Globals.h" #include "NodeContext.h" #include "NetworkManager.h" #include "ClusterManager.h" #include "ApiServer.h" #include "TaskManager.h" // Services #include "NodeService.h" #include "NetworkService.h" #include "ClusterService.h" #include "TaskService.h" #include "NeoPatternService.h" #ifndef LED_STRIP_PIN #define LED_STRIP_PIN 2 #endif #ifndef LED_STRIP_LENGTH #define LED_STRIP_LENGTH 8 #endif #ifndef LED_STRIP_TYPE #define LED_STRIP_TYPE (NEO_GRB + NEO_KHZ800) #endif NodeContext ctx({ {"app", "neopattern"}, {"device", "light"}, {"pixels", String(LED_STRIP_LENGTH)}, {"pin", String(LED_STRIP_PIN)} }); NetworkManager network(ctx); TaskManager taskManager(ctx); ClusterManager cluster(ctx, taskManager); ApiServer apiServer(ctx, taskManager, ctx.config.api_server_port); // Create services NodeService nodeService(ctx); NetworkService networkService(network); ClusterService clusterService(ctx); TaskService taskService(taskManager); NeoPatternService neoPatternService(taskManager, LED_STRIP_LENGTH, LED_STRIP_PIN, LED_STRIP_TYPE); void setup() { Serial.begin(115200); // Setup WiFi first network.setupWiFi(); // Initialize and start all tasks taskManager.initialize(); // Register services and start API server apiServer.addService(nodeService); apiServer.addService(networkService); apiServer.addService(clusterService); apiServer.addService(taskService); apiServer.addService(neoPatternService); apiServer.begin(); // Print initial task status taskManager.printTaskStatus(); } void loop() { taskManager.execute(); yield(); }