📷 Adds support for esp32-wroom-camera

This commit is contained in:
Rune Harlyk
2024-06-17 22:19:32 +02:00
committed by Rune Harlyk
parent 0880f569b7
commit efb45218af
5 changed files with 1299 additions and 1273 deletions
+20
View File
@@ -312,6 +312,26 @@
#define HREF_GPIO_NUM 23 #define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22 #define PCLK_GPIO_NUM 22
#elif defined(CAMERA_MODEL_ESP32S3_EYE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 15
#define SIOD_GPIO_NUM 4
#define SIOC_GPIO_NUM 5
#define Y2_GPIO_NUM 11
#define Y3_GPIO_NUM 9
#define Y4_GPIO_NUM 8
#define Y5_GPIO_NUM 10
#define Y6_GPIO_NUM 12
#define Y7_GPIO_NUM 18
#define Y8_GPIO_NUM 17
#define Y9_GPIO_NUM 16
#define VSYNC_GPIO_NUM 6
#define HREF_GPIO_NUM 7
#define PCLK_GPIO_NUM 13
#else #else
#error "Camera model not selected" #error "Camera model not selected"
#endif #endif
+5 -2
View File
@@ -78,7 +78,9 @@ esp_err_t CameraService::InitializeCamera() {
if (psramFound()) { if (psramFound()) {
camera_config.frame_size = FRAMESIZE_SVGA; camera_config.frame_size = FRAMESIZE_SVGA;
camera_config.jpeg_quality = 10; camera_config.jpeg_quality = 10;
camera_config.fb_location = CAMERA_FB_IN_PSRAM;
camera_config.fb_count = 2; camera_config.fb_count = 2;
camera_config.grab_mode = CAMERA_GRAB_LATEST;
} else { } else {
camera_config.frame_size = FRAMESIZE_SVGA; camera_config.frame_size = FRAMESIZE_SVGA;
camera_config.jpeg_quality = 12; camera_config.jpeg_quality = 12;
@@ -87,7 +89,8 @@ esp_err_t CameraService::InitializeCamera() {
log_i("Initializing camera"); log_i("Initializing camera");
esp_err_t err = esp_camera_init(&camera_config); esp_err_t err = esp_camera_init(&camera_config);
if (err != ESP_OK) log_e("Camera probe failed with error 0x%x", err); if (err == ESP_OK) ESP_LOGI("CameraService", "Camera probe successful");
else ESP_LOGE("CameraService", "Camera probe failed with error 0x%x", err);
return err; return err;
} }
@@ -95,7 +98,7 @@ esp_err_t CameraService::InitializeCamera() {
esp_err_t CameraService::cameraStill(PsychicRequest *request) { esp_err_t CameraService::cameraStill(PsychicRequest *request) {
camera_fb_t *fb = safe_camera_fb_get(); camera_fb_t *fb = safe_camera_fb_get();
if (!fb) { if (!fb) {
Serial.println("Camera capture failed"); ESP_LOGE("CameraService", "Camera capture failed");
request->reply(500, "text/plain", "Camera capture failed"); request->reply(500, "text/plain", "Camera capture failed");
return ESP_FAIL; return ESP_FAIL;
} }
@@ -23,8 +23,12 @@
/* /*
* I2C software connection * I2C software connection
*/ */
#define SDA 14 #ifndef SDA_PIN
#define SCL 15 #define SDA_PIN 14
#endif
#ifndef SCL_PIN
#define SCL_PIN 15
#endif
/* /*
* Ultra sonic sensors * Ultra sonic sensors
@@ -45,8 +49,8 @@ public:
class DeviceConfiguration { class DeviceConfiguration {
public: public:
int sda = SDA; int sda = SDA_PIN;
int scl = SCL; int scl = SCL_PIN;
std::vector<PinConfig> pins; std::vector<PinConfig> pins;
static void read(DeviceConfiguration &settings, JsonObject &root) { static void read(DeviceConfiguration &settings, JsonObject &root) {
@@ -55,8 +59,8 @@ class DeviceConfiguration {
} }
static StateUpdateResult update(JsonObject &root, DeviceConfiguration &settings) { static StateUpdateResult update(JsonObject &root, DeviceConfiguration &settings) {
settings.sda = root["sda"] | SDA; settings.sda = root["sda"] | SDA_PIN;
settings.scl = root["scl"] | SCL; settings.scl = root["scl"] | SCL_PIN;
return StateUpdateResult::CHANGED; return StateUpdateResult::CHANGED;
}; };
}; };
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -30,8 +30,8 @@ build_flags=
${env.build_flags} ${env.build_flags}
-D FT_CAMERA=1 -D FT_CAMERA=1
-D CAMERA_MODEL_AI_THINKER=1 -D CAMERA_MODEL_AI_THINKER=1
-D LED_BUILTIN=4 -D SDA_PIN=14
-D KEY_BUILTIN=0 -D SCL_PIN=15
[env:esp32-wroom-camera] [env:esp32-wroom-camera]
board = esp32-s3-devkitc-1 board = esp32-s3-devkitc-1
@@ -42,16 +42,15 @@ upload_speed = 1000000
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-D FT_CAMERA=1 -D FT_CAMERA=1
-D CAMERA_MODEL_ESP32S3_WROVER=1 -D CAMERA_MODEL_ESP32S3_EYE=1
-D KEY_BUILTIN=0 -D SDA_PIN=47
-D SCL_PIN=21
[env:esp32dev] [env:esp32dev]
board = esp32dev board = esp32dev
board_build.partitions = min_spiffs.csv board_build.partitions = min_spiffs.csv
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-D LED_BUILTIN=2
-D KEY_BUILTIN=0
; ================================================================ ; ================================================================