Port restart tasks - TODO test and enable them

This commit is contained in:
Lorow
2025-04-01 23:30:21 +02:00
parent cb41038181
commit 345e10175a
3 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
idf_component_register(SRCS "OpenIrisTasks/OpenIrisTasks.cpp"
INCLUDE_DIRS "OpenIrisTasks"
REQUIRES Helpers
)

View File

@@ -0,0 +1,14 @@
#include "OpenIrisTasks.hpp"
void OpenIrisTasks::ScheduleRestart(int milliseconds)
{
taskYIELD();
int initialTime = Helpers::getTimeInMillis();
while (Helpers::getTimeInMillis() - initialTime <= milliseconds)
{
continue;
}
esp_restart();
taskYIELD();
}

View File

@@ -0,0 +1,15 @@
#pragma once
#ifndef OPENIRISTASKS_HPP
#define OPENIRISTASKS_HPP
#include "Helpers.hpp"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
namespace OpenIrisTasks
{
void ScheduleRestart(int milliseconds);
};
#endif