Changed some files

This commit is contained in:
CommanderRedYT
2022-02-18 01:21:54 +01:00
parent 2adccba813
commit 168baeac83
21 changed files with 163 additions and 89 deletions

View File

@ -3,7 +3,6 @@
#include "sdkconfig.h"
// system includes
#include <iterator>
#include <chrono>
// esp-idf includes
@ -137,3 +136,24 @@ void sched_pushStats(bool printTasks)
if (printTasks)
ESP_LOGI(TAG, "end listing tasks");
}
tl::expected<bool, std::string> checkInitializedByName(std::string name)
{
for (auto &schedulerTask : schedulerTasks)
{
if (schedulerTask.name() == name)
return schedulerTask.isInitialized();
}
return tl::make_unexpected("Task not found: " + std::string{name});
}
bool checkEnabledByName(std::string name) {
bool enabled = false;
// iterate over all feature flags (runForEveryFeature())
configs.callForEveryFeature([&](ConfiguredFeatureFlag &feature) {
ESP_LOGE(TAG, "checkEnabledByName: %s == %s", feature.getTaskName().c_str(), name.c_str());
if (feature.getTaskName() == name && !enabled)
enabled = feature.isEnabled.value;
});
return enabled;
}