Rewrite state manager, clean up states, fixup typos - todo test state display

This commit is contained in:
Lorow
2025-04-21 23:50:41 +02:00
parent f1cf3baf46
commit 4095f00bb0
14 changed files with 273 additions and 154 deletions

View File

@@ -31,6 +31,9 @@ static esp_err_t UVCStreamHelpers::camera_start_cb(uvc_format_t format, int widt
cameraHandler->setCameraResolution(frame_size);
cameraHandler->resetCamera(0);
SystemEvent event = {EventSource::STREAM, StreamState_e::Stream_ON};
xQueueSend(eventQueue, &event, 10);
return ESP_OK;
}
@@ -43,7 +46,8 @@ static void UVCStreamHelpers::camera_stop_cb(void *cb_ctx)
s_fb.cam_fb_p = nullptr;
}
ESP_LOGI(UVC_STREAM_TAG, "Camera Stop");
SystemEvent event = {EventSource::STREAM, StreamState_e::Stream_OFF};
xQueueSend(eventQueue, &event, 10);
}
static uvc_fb_t *UVCStreamHelpers::camera_fb_get_cb(void *cb_ctx)

View File

@@ -4,13 +4,19 @@
#include "esp_timer.h"
#include "esp_camera.h"
#include <CameraManager.hpp>
#include <StateManager.hpp>
#include "esp_log.h"
#include "usb_device_uvc.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
// we need access to the camera manager
// in order to update the frame settings
extern std::shared_ptr<CameraManager> cameraHandler;
// we also need a way to inform the rest of the system of what's happening
extern QueueHandle_t eventQueue;
namespace UVCStreamHelpers
{
// TODO move the camera handling code to the camera manager and have the uvc maanger initialize it in wired mode