43 lines
886 B
C++
43 lines
886 B
C++
#include <Arduino.h>
|
|
#include <functional>
|
|
#include "Globals.h"
|
|
#include "NodeContext.h"
|
|
#include "NetworkManager.h"
|
|
#include "ClusterManager.h"
|
|
#include "ApiServer.h"
|
|
#include "TaskManager.h"
|
|
|
|
using namespace std;
|
|
|
|
NodeContext ctx;
|
|
NetworkManager network(ctx);
|
|
TaskManager taskManager(ctx);
|
|
ClusterManager cluster(ctx, taskManager);
|
|
ApiServer apiServer(ctx, taskManager, ctx.config.api_server_port);
|
|
|
|
void setup() {
|
|
// Setup WiFi first
|
|
network.setupWiFi();
|
|
|
|
// Add example labels for this node
|
|
auto it = ctx.memberList->find(ctx.hostname);
|
|
if (it != ctx.memberList->end()) {
|
|
it->second.labels["app"] = "base";
|
|
it->second.labels["role"] = "demo";
|
|
}
|
|
|
|
// Initialize and start all tasks
|
|
taskManager.initialize();
|
|
|
|
// Start the API server
|
|
apiServer.begin();
|
|
|
|
// Print initial task status
|
|
taskManager.printTaskStatus();
|
|
}
|
|
|
|
void loop() {
|
|
taskManager.execute();
|
|
yield();
|
|
}
|