Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PBrunot committed May 25, 2024
1 parent 0207038 commit 8611e28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ namespace fabomatic::Tasks

auto Scheduler::addTask(Task *task) -> void
{
tasks.push_back(task);
if (task != nullptr)
tasks.push_back(task);
}

auto Scheduler::removeTask(const Task *task) -> void
Expand All @@ -41,7 +42,7 @@ namespace fabomatic::Tasks
milliseconds avg_delay = 0ms;
auto nb_runs = 0;

for (const auto task : tasks)
for (const auto &task : tasks)
{
avg_delay += task->getAvgTardiness() * task->getRunCounter();
nb_runs += task->getRunCounter();
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace fabomatic
{
if (!initialized)
{
auto secs = std::chrono::duration_cast<std::chrono::seconds>(conf::tasks::WATCHDOG_TIMEOUT).count();
constexpr auto secs = std::chrono::duration_cast<std::chrono::seconds>(conf::tasks::WATCHDOG_TIMEOUT).count();
esp_task_wdt_init(secs, true); // enable panic so ESP32 restarts
ESP_LOGI(TAG, "taskEspWatchdog - initialized %lld seconds", secs);
esp_task_wdt_add(NULL); // add current thread to WDT watch
Expand Down Expand Up @@ -193,7 +193,7 @@ namespace fabomatic
}
if constexpr (conf::debug::ENABLE_LOGS)
{
ESP_LOGD(TAG, "taskIsAlive - free heap: %d", ESP.getFreeHeap());
ESP_LOGD(TAG, "taskIsAlive - free heap: %lu", ESP.getFreeHeap());
}
}

Expand Down

0 comments on commit 8611e28

Please sign in to comment.