Made some opimizations
This commit is contained in:
@ -48,7 +48,7 @@ public:
|
||||
- converted.hours()
|
||||
- converted.minutes()
|
||||
- converted.seconds();
|
||||
return fmt::format("Up: {:02d}:{:02d}:{:02d}&s&7.{:03d}",
|
||||
return fmt::format("Up: {:02d}:{:02d}:{:02d}&s&7.{:01d}",
|
||||
converted.hours().count(),
|
||||
converted.minutes().count(),
|
||||
converted.seconds().count(),
|
||||
@ -93,7 +93,7 @@ public:
|
||||
- converted.hours()
|
||||
- converted.minutes()
|
||||
- converted.seconds();
|
||||
return fmt::format("Drive: {:02d}:{:02d}:{:02d}&s&7.{:03d}",
|
||||
return fmt::format("Drive: {:02d}:{:02d}:{:02d}&s&7.{:02d}",
|
||||
converted.hours().count(),
|
||||
converted.minutes().count(),
|
||||
converted.seconds().count(),
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "displays/menus/extrabuttoncalibratemenu.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "globals.h"
|
||||
#include "taskmanager.h"
|
||||
|
||||
using namespace espgui;
|
||||
using namespace std::chrono_literals;
|
||||
@ -170,6 +171,9 @@ void SetupDisplay::buttonPressed(espgui::Button button)
|
||||
break;
|
||||
case espgui::Right: // enter cloud setup
|
||||
m_current_setupStep = SetupStep::SETUP_CLOUD;
|
||||
configs.write_config(configs.feature.cloud.isEnabled, true);
|
||||
configs.write_config(configs.feature.udpcloud.isEnabled, true);
|
||||
reload_tasks();
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void sched_pushStats(bool printTasks)
|
||||
ESP_LOGI(TAG, "end listing tasks");
|
||||
}
|
||||
|
||||
tl::expected<bool, std::string> checkInitializedByName(std::string name)
|
||||
tl::expected<bool, std::string> checkInitializedByName(const std::string& name)
|
||||
{
|
||||
for (auto &schedulerTask : schedulerTasks)
|
||||
{
|
||||
@ -126,7 +126,7 @@ tl::expected<bool, std::string> checkInitializedByName(std::string name)
|
||||
return tl::make_unexpected("Task not found: " + std::string{name});
|
||||
}
|
||||
|
||||
bool checkEnabledByName(std::string name) {
|
||||
bool checkEnabledByName(const std::string& name) {
|
||||
bool enabled = true;
|
||||
// iterate over all feature flags (runForEveryFeature())
|
||||
configs.callForEveryFeature([&](ConfiguredFeatureFlag &feature) {
|
||||
@ -135,3 +135,14 @@ bool checkEnabledByName(std::string name) {
|
||||
});
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void reload_tasks()
|
||||
{
|
||||
for (auto &task : schedulerTasks)
|
||||
{
|
||||
if (checkEnabledByName(task.name()) && !task.isInitialized())
|
||||
{
|
||||
task.setup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ extern const BobbySchedulerTask &drivingModeTask;
|
||||
|
||||
void sched_pushStats(bool printTasks);
|
||||
|
||||
tl::expected<bool, std::string> checkInitializedByName(std::string name);
|
||||
tl::expected<bool, std::string> checkInitializedByName(const std::string& name);
|
||||
|
||||
bool checkEnabledByName(std::string name);
|
||||
bool checkEnabledByName(const std::string& name);
|
||||
|
||||
void reload_tasks();
|
||||
|
Reference in New Issue
Block a user