mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-19 06:23:44 +02:00
Add Proof of concept switching between UVC and Wi-Fi streaming based on the presence of Wi-Fi creds, rewrite restart task to esp_timer
TODO: Think about letting people set the mode explicitly so the board comes online faster
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
#include "OpenIrisTasks.hpp"
|
||||
|
||||
void OpenIrisTasks::ScheduleRestart(int milliseconds)
|
||||
{
|
||||
taskYIELD();
|
||||
const auto initialTime = Helpers::getTimeInMillis();
|
||||
while (Helpers::getTimeInMillis() - initialTime <= milliseconds)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
void restart_the_board(void *arg) {
|
||||
esp_restart();
|
||||
taskYIELD();
|
||||
}
|
||||
|
||||
void OpenIrisTasks::ScheduleRestart(const int milliseconds)
|
||||
{
|
||||
esp_timer_handle_t timerHandle;
|
||||
constexpr esp_timer_create_args_t args = {
|
||||
.callback = &restart_the_board,
|
||||
.arg = nullptr,
|
||||
.name = "restartBoard"};
|
||||
|
||||
if (const auto result = esp_timer_create(&args, &timerHandle); result == ESP_OK)
|
||||
{
|
||||
esp_timer_start_once(timerHandle, milliseconds);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user