feat: improve task handling, refactoring
This commit is contained in:
@@ -7,10 +7,6 @@
|
||||
#include "NodeContext.h"
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
// Forward declarations to avoid multiple definition errors
|
||||
class Task;
|
||||
class Scheduler;
|
||||
|
||||
// Define our own callback type to avoid conflict with TaskScheduler
|
||||
using TaskFunction = std::function<void()>;
|
||||
|
||||
@@ -60,13 +56,8 @@ public:
|
||||
|
||||
private:
|
||||
NodeContext& ctx;
|
||||
std::vector<Task*> tasks;
|
||||
std::vector<TaskDefinition> taskDefinitions;
|
||||
std::vector<unsigned long> lastExecutionTimes;
|
||||
|
||||
Task* findTask(const std::string& name) const;
|
||||
void createTask(const TaskDefinition& taskDef);
|
||||
|
||||
// Static callback registry for all TaskManager instances
|
||||
static std::map<std::string, std::function<void()>> callbackRegistry;
|
||||
static void executeCallback(const std::string& taskName);
|
||||
int findTaskIndex(const std::string& name) const;
|
||||
};
|
||||
Reference in New Issue
Block a user