mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-05-06 05:46:06 +02:00
Port restart tasks - TODO test and enable them
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
idf_component_register(SRCS "OpenIrisTasks/OpenIrisTasks.cpp"
|
||||||
|
INCLUDE_DIRS "OpenIrisTasks"
|
||||||
|
REQUIRES Helpers
|
||||||
|
)
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user