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:
Lorow
2025-05-20 23:09:06 +02:00
parent 4f0ab541cb
commit b7bae7fb3e
4 changed files with 79 additions and 28 deletions

View File

@@ -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);
}
}