mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
feat: Fix ov5640 support implementation after beta cleanup
This commit is contained in:
parent
1733a1ed38
commit
4894c22058
@ -16,7 +16,7 @@ void CameraHandler::setupCameraPinout() {
|
|||||||
// 16500000 optimal freq on ESP32-CAM (default)
|
// 16500000 optimal freq on ESP32-CAM (default)
|
||||||
// 20000000 max freq on ESP32-CAM
|
// 20000000 max freq on ESP32-CAM
|
||||||
// 24000000 optimal freq on ESP32-S3
|
// 24000000 optimal freq on ESP32-S3
|
||||||
int xclk_freq_hz = 16500000;
|
int xclk_freq_hz = DEFAULT_XCLK_FREQ_HZ;
|
||||||
|
|
||||||
#if CONFIG_CAMERA_MODULE_ESP_EYE
|
#if CONFIG_CAMERA_MODULE_ESP_EYE
|
||||||
/* IO13, IO14 is designed for JTAG by default,
|
/* IO13, IO14 is designed for JTAG by default,
|
||||||
@ -35,20 +35,8 @@ void CameraHandler::setupCameraPinout() {
|
|||||||
pinMode(14, INPUT_PULLUP);
|
pinMode(14, INPUT_PULLUP);
|
||||||
log_i("CAM_BOARD");
|
log_i("CAM_BOARD");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ETVR_EYE_TRACKER_USB_API
|
#if ETVR_EYE_TRACKER_USB_API
|
||||||
auto camera_id = camera_sensor->id.PID;
|
xclk_freq_hz = USB_DEFAULT_XCLK_FREQ_HZ;
|
||||||
|
|
||||||
switch (camera_id)
|
|
||||||
{
|
|
||||||
// Thanks to lick_it, we discovered that OV5640 likes to overheat when
|
|
||||||
// running at higher than usual xclk frequencies.
|
|
||||||
// Hence why we're limit the faster ones for OV2640
|
|
||||||
case OV2640_PID:
|
|
||||||
xclk_freq_hz = 24000000;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
config.ledc_channel = LEDC_CHANNEL_0;
|
config.ledc_channel = LEDC_CHANNEL_0;
|
||||||
@ -94,7 +82,7 @@ void CameraHandler::setupBasicResolution() {
|
|||||||
|
|
||||||
void CameraHandler::setupCameraSensor() {
|
void CameraHandler::setupCameraSensor() {
|
||||||
log_d("[Camera]: Setting up camera sensor");
|
log_d("[Camera]: Setting up camera sensor");
|
||||||
|
|
||||||
camera_sensor = esp_camera_sensor_get();
|
camera_sensor = esp_camera_sensor_get();
|
||||||
// fixes corrupted jpegs, https://github.com/espressif/esp32-camera/issues/203
|
// fixes corrupted jpegs, https://github.com/espressif/esp32-camera/issues/203
|
||||||
// documentation https://www.uctronics.com/download/cam_module/OV2640DS.pdf
|
// documentation https://www.uctronics.com/download/cam_module/OV2640DS.pdf
|
||||||
@ -175,6 +163,23 @@ bool CameraHandler::setupCamera() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ETVR_EYE_TRACKER_USB_API
|
||||||
|
auto temp_sensor = esp_camera_sensor_get();
|
||||||
|
auto camera_id = temp_sensor->id.PID;
|
||||||
|
switch (camera_id) {
|
||||||
|
// Thanks to lick_it, we discovered that OV5640 likes to overheat when
|
||||||
|
// running at higher than usual xclk frequencies.
|
||||||
|
// Hence why we're limit the faster ones for OV2640
|
||||||
|
case OV5640_PID:
|
||||||
|
config.xclk_freq_hz = OV5640_XCLK_FREQ_HZ;
|
||||||
|
esp_camera_deinit();
|
||||||
|
esp_camera_init(&config);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
this->setupCameraSensor();
|
this->setupCameraSensor();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <esp_camera.h>
|
#include <esp_camera.h>
|
||||||
|
#include "data/StateManager/StateManager.hpp"
|
||||||
|
#include "data/config/project_config.hpp"
|
||||||
#include "data/utilities/Observer.hpp"
|
#include "data/utilities/Observer.hpp"
|
||||||
#include "data/utilities/network_utilities.hpp"
|
#include "data/utilities/network_utilities.hpp"
|
||||||
#include "data/config/project_config.hpp"
|
|
||||||
#include "data/StateManager/StateManager.hpp"
|
#define DEFAULT_XCLK_FREQ_HZ 16500000
|
||||||
|
#define USB_DEFAULT_XCLK_FREQ_HZ 24000000
|
||||||
|
#define OV5640_XCLK_FREQ_HZ DEFAULT_XCLK_FREQ_HZ
|
||||||
|
|
||||||
class CameraHandler : public IObserver<ConfigState_e> {
|
class CameraHandler : public IObserver<ConfigState_e> {
|
||||||
private:
|
private:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user