mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-22 16:03:45 +02:00
Refactor global state management for startup commands and USB handover (no Race-Condition); enhance SerialManager shutdown process and buffer handling in UVCStream.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
idf_component_register(SRCS "UVCStream/UVCStream.cpp"
|
||||
INCLUDE_DIRS "UVCStream"
|
||||
REQUIRES esp_timer esp32-camera StateManager usb_device_uvc CameraManager
|
||||
REQUIRES esp_timer esp32-camera StateManager usb_device_uvc CameraManager Helpers
|
||||
)
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "UVCStream.hpp"
|
||||
#include <cstdio> // for snprintf
|
||||
#include "driver/usb_serial_jtag.h" // for clean handover from COM to TinyUSB
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
// no deps on main globals here; handover is performed in main before calling setup when needed
|
||||
|
||||
static const char *UVC_STREAM_TAG = "[UVC DEVICE]";
|
||||
|
||||
@@ -33,7 +37,6 @@ extern "C" {
|
||||
|
||||
static esp_err_t UVCStreamHelpers::camera_start_cb(uvc_format_t format, int width, int height, int rate, void *cb_ctx)
|
||||
{
|
||||
auto *mgr = static_cast<UVCStreamManager *>(cb_ctx);
|
||||
ESP_LOGI(UVC_STREAM_TAG, "Camera Start");
|
||||
ESP_LOGI(UVC_STREAM_TAG, "Format: %d, width: %d, height: %d, rate: %d", format, width, height, rate);
|
||||
framesize_t frame_size = FRAMESIZE_QVGA;
|
||||
@@ -79,6 +82,7 @@ static void UVCStreamHelpers::camera_stop_cb(void *cb_ctx)
|
||||
static uvc_fb_t *UVCStreamHelpers::camera_fb_get_cb(void *cb_ctx)
|
||||
{
|
||||
auto *mgr = static_cast<UVCStreamManager *>(cb_ctx);
|
||||
(void)mgr;
|
||||
s_fb.cam_fb_p = esp_camera_fb_get();
|
||||
|
||||
if (!s_fb.cam_fb_p)
|
||||
|
||||
Reference in New Issue
Block a user