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