Merge remote-tracking branch 'origin/main' into mutimodal

# Conflicts:
#	components/CameraManager/CameraManager/CameraManager.cpp
#	dependencies.lock
#	main/openiris_main.cpp
#	sdkconfig
This commit is contained in:
Lorow
2025-08-13 23:46:13 +02:00
18 changed files with 409 additions and 212 deletions

View File

@@ -18,8 +18,8 @@ void CameraManager::setupCameraPinout()
// 10000000 stable
// 16500000 optimal freq on ESP32-CAM (default)
// 20000000 max freq on ESP32-CAM
// 24000000 optimal freq on ESP32-S3
int xclk_freq_hz = DEFAULT_XCLK_FREQ_HZ;
// 24000000 optimal freq on ESP32-S3 // 23MHz same fps
int xclk_freq_hz = CONFIG_CAMERA_WIFI_XCLK_FREQ;
#if CONFIG_CAMERA_MODULE_ESP_EYE
/* IO13, IO14 is designed for JTAG by default,
@@ -48,8 +48,8 @@ void CameraManager::setupCameraPinout()
ESP_LOGI(CAMERA_MANAGER_TAG, "CAM_BOARD");
#endif
#if CONFIG_WIRED_MODE
xclk_freq_hz = USB_DEFAULT_XCLK_FREQ_HZ;
#if CONFIG_GENERAL_WIRED_MODE
xclk_freq_hz = CONFIG_CAMERA_USB_XCLK_FREQ;
#endif
config = {
@@ -71,8 +71,7 @@ void CameraManager::setupCameraPinout()
.pin_href = CONFIG_HREF_GPIO_NUM, // CAM_PIN_HREF,
.pin_pclk = CONFIG_PCLK_GPIO_NUM, // CAM_PIN_PCLK,
// XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental)
.xclk_freq_hz = xclk_freq_hz, // 20000000,
.xclk_freq_hz = xclk_freq_hz, // Set in config
.ledc_timer = LEDC_TIMER_0,
.ledc_channel = LEDC_CHANNEL_0,
@@ -80,10 +79,10 @@ void CameraManager::setupCameraPinout()
.pixel_format = PIXFORMAT_JPEG, // YUV422,GRAYSCALE,RGB565,JPEG
.frame_size = FRAMESIZE_240X240, // QQVGA-UXGA, For ESP32, do not use sizes above QVGA when not JPEG. The performance of the ESP32-S series has improved a lot, but JPEG mode always gives better frame rates.
.jpeg_quality = 10, // 0-63, for OV series camera sensors, lower number means higher quality
.fb_count = 2, // Use 2 for streaming to balance memory and performance
.fb_location = CAMERA_FB_IN_PSRAM, // Use PSRAM for frame buffers
.grab_mode = CAMERA_GRAB_LATEST, // Always grab the latest frame for streaming
.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_WHEN_EMPTY,
};
}
@@ -95,7 +94,7 @@ void CameraManager::setupBasicResolution()
ESP_LOGE(CAMERA_MANAGER_TAG, "PSRAM not initialized!");
ESP_LOGD(CAMERA_MANAGER_TAG, "Setting fb_location to CAMERA_FB_IN_DRAM with lower picture quality");
config.fb_location = CAMERA_FB_IN_DRAM;
config.jpeg_quality = 9;
config.jpeg_quality = 7;
config.fb_count = 2;
return;
}
@@ -197,7 +196,7 @@ bool CameraManager::setupCamera()
return false;
}
#if CONFIG_WIRED_MODE
#if CONFIG_GENERAL_WIRED_MODE
const auto temp_sensor = esp_camera_sensor_get();
// Thanks to lick_it, we discovered that OV5640 likes to overheat when

View File

@@ -14,11 +14,7 @@
#include <StateManager.hpp>
#include <ProjectConfig.hpp>
#ifndef DEFAULT_XCLK_FREQ_HZ
#define DEFAULT_XCLK_FREQ_HZ 16500000
#define USB_DEFAULT_XCLK_FREQ_HZ 20000000
#define OV5640_XCLK_FREQ_HZ DEFAULT_XCLK_FREQ_HZ
#endif
#define OV5640_XCLK_FREQ_HZ CONFIG_CAMERA_WIFI_XCLK_FREQ
class CameraManager
{

View File

@@ -78,32 +78,35 @@ void LEDManager::setup() {
gpio_set_direction(blink_led_pin, GPIO_MODE_OUTPUT);
this->toggleLED(LED_OFF);
#ifdef CONFIG_SUPPORTS_EXTERNAL_LED_CONTROL
ESP_LOGD(LED_MANAGER_TAG, "Setting up illuminator led.");
const int freq = 5000;
const auto resolution = LEDC_TIMER_8_BIT;
const int dutyCycle = 255;
#ifdef CONFIG_LED_EXTERNAL_CONTROL
ESP_LOGD(LED_MANAGER_TAG, "Setting up illuminator led.");
const int freq = CONFIG_LED_EXTERNAL_PWM_FREQ;
const auto resolution = LEDC_TIMER_8_BIT;
const int dutyCycle = (CONFIG_LED_EXTERNAL_PWM_DUTY_CYCLE * 255) / 100;
ledc_timer_config_t ledc_timer = {
.speed_mode = LEDC_LOW_SPEED_MODE,
.duty_resolution = resolution,
.timer_num = LEDC_TIMER_0,
.freq_hz = freq,
.clk_cfg = LEDC_AUTO_CLK};
ledc_timer_config_t ledc_timer = {
.speed_mode = LEDC_LOW_SPEED_MODE,
.duty_resolution = resolution,
.timer_num = LEDC_TIMER_0,
.freq_hz = freq,
.clk_cfg = LEDC_AUTO_CLK
};
ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
ledc_channel_config_t ledc_channel = {
.gpio_num = this->illumninator_led_pin,
.speed_mode = LEDC_LOW_SPEED_MODE,
.channel = LEDC_CHANNEL_0,
.intr_type = LEDC_INTR_DISABLE,
.timer_sel = LEDC_TIMER_0,
.duty = dutyCycle,
.hpoint = 0};
ledc_channel_config_t ledc_channel = {
.gpio_num = this->illumninator_led_pin,
.speed_mode = LEDC_LOW_SPEED_MODE,
.channel = LEDC_CHANNEL_0,
.intr_type = LEDC_INTR_DISABLE,
.timer_sel = LEDC_TIMER_0,
.duty = dutyCycle,
.hpoint = 0
};
ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
#endif
ESP_LOGD(LED_MANAGER_TAG, "Done.");
}

View File

@@ -6,7 +6,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#ifdef CONFIG_SUPPORTS_EXTERNAL_LED_CONTROL
#ifdef CONFIG_LED_EXTERNAL_CONTROL
#include "driver/ledc.h"
#endif

View File

@@ -84,7 +84,7 @@ struct MDNSConfig_t : BaseConfigModel
{
// by default, this will be openiris
// but we can override it at compile time
std::string default_hostname = CONFIG_MDNS_HOSTNAME;
std::string default_hostname = CONFIG_WIFI_MDNS_HOSTNAME;
if (default_hostname.empty())
{
@@ -224,8 +224,8 @@ struct AP_WiFiConfig_t : BaseConfigModel
void load()
{
this->ssid = this->pref->getString("apSSID", CONFIG_AP_WIFI_SSID);
this->password = this->pref->getString("apPassword", CONFIG_AP_WIFI_PASSWORD);
this->ssid = this->pref->getString("apSSID", CONFIG_WIFI_AP_SSID);
this->password = this->pref->getString("apPassword", CONFIG_WIFI_AP_PASSWORD);
};
void save() const {

View File

@@ -113,9 +113,9 @@ static void UVCStreamHelpers::camera_fb_return_cb(uvc_fb_t *fb, void *cb_ctx)
esp_err_t UVCStreamManager::setup()
{
#ifndef CONFIG_WIRED_MODE
#ifndef CONFIG_GENERAL_WIRED_MODE
ESP_LOGE(UVC_STREAM_TAG, "The board does not support UVC, please, setup WiFi connection.");
return;
return ESP_FAIL;
#endif
ESP_LOGI(UVC_STREAM_TAG, "Setting up UVC Stream");

View File

@@ -227,8 +227,8 @@ void WiFiManager::SetupAccessPoint()
wifi_config_t ap_wifi_config = {
.ap = {
.ssid = CONFIG_AP_WIFI_SSID,
.password = CONFIG_AP_WIFI_PASSWORD,
.ssid = CONFIG_WIFI_AP_SSID,
.password = CONFIG_WIFI_AP_PASSWORD,
.max_connection = 1,
},