Fixed query functions
This commit is contained in:
@ -45,7 +45,12 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_flag.isBeta() ? TFT_ORANGE : TFT_GREY;
|
||||
if (m_flag.isEnabled.value)
|
||||
{
|
||||
return TFT_RED;
|
||||
}
|
||||
else
|
||||
return m_flag.isBeta() ? TFT_ORANGE : TFT_GREY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,9 +85,10 @@ public:
|
||||
FeatureFlagsMenu::FeatureFlagsMenu()
|
||||
{
|
||||
configs.callForEveryFeature([&](ConfiguredFeatureFlag &feature){
|
||||
|
||||
if (const auto err = checkInitializedByName(feature.getTaskName()); !err) {
|
||||
constructMenuItem<FeatureFlagMenuItem>(feature, *err);
|
||||
const std::string name = feature.getTaskName();
|
||||
if (const auto err = checkInitializedByName(name); err)
|
||||
{
|
||||
constructMenuItem<FeatureFlagMenuItem>(feature, *err);
|
||||
}
|
||||
else
|
||||
constructMenuItem<FeatureFlagMenuItem>(feature, true);
|
||||
|
@ -141,6 +141,7 @@ tl::expected<bool, std::string> checkInitializedByName(std::string name)
|
||||
{
|
||||
for (auto &schedulerTask : schedulerTasks)
|
||||
{
|
||||
// ESP_LOGE(TAG, "%s == %s", schedulerTask.name(), name.c_str());
|
||||
if (schedulerTask.name() == name)
|
||||
return schedulerTask.isInitialized();
|
||||
}
|
||||
@ -148,11 +149,10 @@ tl::expected<bool, std::string> checkInitializedByName(std::string name)
|
||||
}
|
||||
|
||||
bool checkEnabledByName(std::string name) {
|
||||
bool enabled = false;
|
||||
bool enabled = true;
|
||||
// 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)
|
||||
if (feature.getTaskName() == name)
|
||||
enabled = feature.isEnabled.value;
|
||||
});
|
||||
return enabled;
|
||||
|
Reference in New Issue
Block a user