mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-05-07 06:06:05 +02:00
Fix UVC not starting on Babble and Xiao boards due to a miss-configuration
This commit is contained in:
@@ -82,7 +82,7 @@ void CameraManager::setupCameraPinout()
|
||||
.jpeg_quality = 7, // 0-63, for OV series camera sensors, lower number means higher quality // Below 6 stability problems
|
||||
.fb_count = 2, // When jpeg mode is used, if fb_count more than one, the driver will work in continuous mode.
|
||||
.fb_location = CAMERA_FB_IN_DRAM,
|
||||
.grab_mode = CAMERA_GRAB_LATEST, //CAMERA_GRAB_WHEN_EMPTY
|
||||
.grab_mode = CAMERA_GRAB_LATEST, // CAMERA_GRAB_WHEN_EMPTY
|
||||
};
|
||||
}
|
||||
|
||||
@@ -202,7 +202,8 @@ bool CameraManager::setupCamera()
|
||||
// Thanks to lick_it, we discovered that OV5640 likes to overheat when
|
||||
// running at higher than usual xclk frequencies.
|
||||
// Hence, why we're limiting the faster ones for OV2640
|
||||
if (const auto camera_id = temp_sensor->id.PID; camera_id == OV5640_PID) {
|
||||
if (const auto camera_id = temp_sensor->id.PID; camera_id == OV5640_PID)
|
||||
{
|
||||
config.xclk_freq_hz = OV5640_XCLK_FREQ_HZ;
|
||||
esp_camera_deinit();
|
||||
esp_camera_init(&config);
|
||||
|
||||
@@ -36,10 +36,10 @@ struct DeviceMode_t : BaseConfigModel
|
||||
void load()
|
||||
{
|
||||
// Default mode can be controlled via sdkconfig:
|
||||
// - If CONFIG_GENERAL_DEFAULT_WIRED_MODE is enabled, default to UVC
|
||||
// - If CONFIG_START_IN_UVC_MODE is enabled, default to UVC
|
||||
// - Otherwise default to AUTO
|
||||
int default_mode =
|
||||
#if CONFIG_GENERAL_DEFAULT_WIRED_MODE
|
||||
#if CONFIG_START_IN_UVC_MODE
|
||||
static_cast<int>(StreamingMode::UVC);
|
||||
#else
|
||||
static_cast<int>(StreamingMode::AUTO);
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
static const char *UVC_STREAM_TAG = "[UVC DEVICE]";
|
||||
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
static char serial_number_str[13];
|
||||
|
||||
const char *get_uvc_device_name()
|
||||
@@ -91,7 +92,7 @@ static uvc_fb_t *UVCStreamHelpers::camera_fb_get_cb(void *cb_ctx)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
// Pace frames to exactly 60 fps (drop extras). Uses fixed-point accumulator
|
||||
// to achieve an exact average of 60.000 fps without drifting.
|
||||
static int64_t next_deadline_us = 0;
|
||||
@@ -114,7 +115,7 @@ static uvc_fb_t *UVCStreamHelpers::camera_fb_get_cb(void *cb_ctx)
|
||||
s_fb.cam_fb_p = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
|
||||
s_fb.uvc_fb.buf = s_fb.cam_fb_p->buf;
|
||||
s_fb.uvc_fb.len = s_fb.cam_fb_p->len;
|
||||
@@ -131,7 +132,7 @@ static uvc_fb_t *UVCStreamHelpers::camera_fb_get_cb(void *cb_ctx)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
// Schedule the next allowed frame time: base interval plus distributed remainder
|
||||
rem_acc += rem_us;
|
||||
int extra_us = 0;
|
||||
@@ -143,7 +144,7 @@ static uvc_fb_t *UVCStreamHelpers::camera_fb_get_cb(void *cb_ctx)
|
||||
// Accumulate from the previous deadline to avoid drift; if we are badly late, catch up from now
|
||||
const int64_t base_next = next_deadline_us + base_interval_us + extra_us;
|
||||
next_deadline_us = (base_next < now_us) ? now_us : base_next;
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return &s_fb.uvc_fb;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,15 @@ endmenu
|
||||
|
||||
menu "OpenIris: General Configuration"
|
||||
|
||||
config START_IN_UVC_MODE
|
||||
bool "Start in UVC Mode"
|
||||
default false
|
||||
help
|
||||
Enables UVC (wired) support in the firmware by default.
|
||||
To be used when a board is designed to be used primarily with wired headsets.
|
||||
When enabled, the default device streaming mode will be UVC unless overridden by a
|
||||
saved preference. When disabled, the default mode is AUTO.
|
||||
|
||||
config GENERAL_DEFAULT_WIRED_MODE
|
||||
bool "Wired mode"
|
||||
default false
|
||||
|
||||
@@ -570,7 +570,8 @@ CONFIG_ENV_GPIO_OUT_RANGE_MAX=48
|
||||
#
|
||||
# OpenIris: General Configuration
|
||||
#
|
||||
# CONFIG_GENERAL_DEFAULT_WIRED_MODE is not set
|
||||
# CONFIG_START_IN_UVC_MODE is not set
|
||||
CONFIG_GENERAL_DEFAULT_WIRED_MODE=y
|
||||
CONFIG_GENERAL_UVC_DELAY=30
|
||||
# end of OpenIris: General Configuration
|
||||
|
||||
|
||||
@@ -571,6 +571,7 @@ CONFIG_ENV_GPIO_OUT_RANGE_MAX=48
|
||||
# OpenIris: General Configuration
|
||||
#
|
||||
# CONFIG_GENERAL_DEFAULT_WIRED_MODE is not set
|
||||
# CONFIG_START_IN_UVC_MODE is not set
|
||||
# CONFIG_GENERAL_UVC_DELAY is not set
|
||||
# end of OpenIris: General Configuration
|
||||
|
||||
|
||||
@@ -60,3 +60,4 @@ CONFIG_LED_EXTERNAL_PWM_FREQ=20000
|
||||
CONFIG_LED_EXTERNAL_PWM_DUTY_CYCLE=50
|
||||
CONFIG_CAMERA_USB_XCLK_FREQ=23000000
|
||||
CONFIG_GENERAL_DEFAULT_WIRED_MODE=y
|
||||
CONFIG_START_IN_UVC_MODE=y
|
||||
@@ -60,3 +60,4 @@ CONFIG_LED_EXTERNAL_PWM_FREQ=20000
|
||||
CONFIG_LED_EXTERNAL_PWM_DUTY_CYCLE=100
|
||||
CONFIG_CAMERA_USB_XCLK_FREQ=23000000
|
||||
CONFIG_GENERAL_DEFAULT_WIRED_MODE=y
|
||||
CONFIG_START_IN_UVC_MODE=y
|
||||
@@ -51,4 +51,5 @@ CONFIG_LED_EXTERNAL_PWM_FREQ=5000
|
||||
CONFIG_LED_EXTERNAL_PWM_DUTY_CYCLE=100
|
||||
CONFIG_LED_EXTERNAL_GPIO=1
|
||||
CONFIG_CAMERA_USB_XCLK_FREQ=23000000
|
||||
# CONFIG_GENERAL_DEFAULT_WIRED_MODE is not set
|
||||
CONFIG_GENERAL_DEFAULT_WIRED_MODE=y
|
||||
# CONFIG_START_IN_UVC_MODE is not set
|
||||
@@ -56,4 +56,5 @@ CONFIG_SPIRAM_SPEED=80
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
# CONFIG_LED_EXTERNAL_CONTROL is not set
|
||||
CONFIG_CAMERA_USB_XCLK_FREQ=23000000
|
||||
# CONFIG_GENERAL_DEFAULT_WIRED_MODE is not set
|
||||
CONFIG_GENERAL_DEFAULT_WIRED_MODE=y
|
||||
# CONFIG_START_IN_UVC_MODE is not set
|
||||
Reference in New Issue
Block a user