mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-30 10:13:04 +05:00
refactor: simplify task configuration and registration
This commit is contained in:
1 parent
d19f6aaa52
commit
4004927ecd
9 files changed
+38
-55
No files matched your search
+7
-10
@@ -299,21 +299,18 @@ static Task regulatorTask("Regulator", [](void*) {
|
||||
});
|
||||
|
||||
void initRegulator() {
|
||||
regulatorTask.setInterval(10000);
|
||||
|
||||
// Pause so the first resume(value) initializes the integral for the selected mode.
|
||||
pidRegulator.pause();
|
||||
|
||||
// Keep the PID task eligible until it has processed its own shutdown.
|
||||
pidTask.setEnabledWhen([] {
|
||||
return settings.pid.enabled || pidRegulator.isEnabled();
|
||||
});
|
||||
pidTask.setInterval(10000);
|
||||
pidTask.resume(pidTask.interval());
|
||||
pidTask.setInterval(10000)
|
||||
.setEnabledWhen([] {
|
||||
return settings.pid.enabled || pidRegulator.isEnabled();
|
||||
})
|
||||
.resume(pidTask.interval());
|
||||
|
||||
// Apply mode changes and turbo auto-disable before a PID calculation due on the same pass.
|
||||
appTaskManager.addTask(regulatorTask);
|
||||
appTaskManager.addTask(regulatorTask.setInterval(10000));
|
||||
appTaskManager.addTask(pidTask);
|
||||
appTaskManager.addTask(equithermTask);
|
||||
equithermTask.pause();
|
||||
appTaskManager.addTask(equithermTask.pause());
|
||||
}
|
||||
Reference in new issue
Block a user