From 8ff3438979f0144d252a8bf92a8b3f2c4668f0f0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 10 Sep 2022 12:54:28 +0200 Subject: [PATCH 1/2] add more cams via `.h` file (#310) --- boards/esp32-cam.json | 2 +- boards/esp32s3cdc-cam.json | 39 ++ .../esp32-camera/driver/include/camera_pins.h | 337 ++++++++++++++++++ .../xdrv_81_esp32_webcam.ino | 24 +- 4 files changed, 379 insertions(+), 23 deletions(-) create mode 100644 boards/esp32s3cdc-cam.json create mode 100644 lib/libesp32/esp32-camera/driver/include/camera_pins.h diff --git a/boards/esp32-cam.json b/boards/esp32-cam.json index 9baa95c17..165b8ef58 100644 --- a/boards/esp32-cam.json +++ b/boards/esp32-cam.json @@ -4,7 +4,7 @@ "ldscript": "esp32_out.ld" }, "core": "esp32", - "extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DHAS_PSRAM_FIX -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_4M", + "extra_flags": "-DCAMERA_MODEL_AI_THINKER -DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DHAS_PSRAM_FIX -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_4M", "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "dio", diff --git a/boards/esp32s3cdc-cam.json b/boards/esp32s3cdc-cam.json new file mode 100644 index 000000000..6d72384da --- /dev/null +++ b/boards/esp32s3cdc-cam.json @@ -0,0 +1,39 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32s3_out.ld", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": "-DCAMERA_MODEL_TTGO_T_CAM_SIM -DBOARD_HAS_PSRAM -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0 -DUSE_USB_CDC_CONSOLE -DESP32_16M -DESP32S3", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32s3", + "variant": "esp32s3", + "partitions": "partitions/esp32_partition_app2944k_fs10M.csv" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "espidf", + "arduino" + ], + "name": "LilyGo T-SIMCAM ESP32-S3 16M Flash 8MB PSRAM, Tasmota 2944k Code/OTA, 10M FS", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "before_reset": "usb_reset", + "speed": 460800 + }, + "url": "https://github.com/Xinyuan-LilyGO/LilyGo-Camera-Series", + "vendor": "LilyGo" +} diff --git a/lib/libesp32/esp32-camera/driver/include/camera_pins.h b/lib/libesp32/esp32-camera/driver/include/camera_pins.h new file mode 100644 index 000000000..d636eb11d --- /dev/null +++ b/lib/libesp32/esp32-camera/driver/include/camera_pins.h @@ -0,0 +1,337 @@ + +#if defined(CAMERA_MODEL_WROVER_KIT) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 21 +#define SIOD_GPIO_NUM 26 +#define SIOC_GPIO_NUM 27 + +#define Y9_GPIO_NUM 35 +#define Y8_GPIO_NUM 34 +#define Y7_GPIO_NUM 39 +#define Y6_GPIO_NUM 36 +#define Y5_GPIO_NUM 19 +#define Y4_GPIO_NUM 18 +#define Y3_GPIO_NUM 5 +#define Y2_GPIO_NUM 4 +#define VSYNC_GPIO_NUM 25 +#define HREF_GPIO_NUM 23 +#define PCLK_GPIO_NUM 22 + +#elif defined(CAMERA_MODEL_ESP_EYE) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 4 +#define SIOD_GPIO_NUM 18 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 36 +#define Y8_GPIO_NUM 37 +#define Y7_GPIO_NUM 38 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 35 +#define Y4_GPIO_NUM 14 +#define Y3_GPIO_NUM 13 +#define Y2_GPIO_NUM 34 +#define VSYNC_GPIO_NUM 5 +#define HREF_GPIO_NUM 27 +#define PCLK_GPIO_NUM 25 + +#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 + +#elif defined(CAMERA_MODEL_M5STACK_PSRAM) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 15 +#define XCLK_GPIO_NUM 27 +#define SIOD_GPIO_NUM 25 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 19 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 5 +#define Y4_GPIO_NUM 34 +#define Y3_GPIO_NUM 35 +#define Y2_GPIO_NUM 32 +#define VSYNC_GPIO_NUM 22 +#define HREF_GPIO_NUM 26 +#define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_M5STACK_V2_PSRAM) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 15 +#define XCLK_GPIO_NUM 27 +#define SIOD_GPIO_NUM 22 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 19 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 5 +#define Y4_GPIO_NUM 34 +#define Y3_GPIO_NUM 35 +#define Y2_GPIO_NUM 32 +#define VSYNC_GPIO_NUM 25 +#define HREF_GPIO_NUM 26 +#define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_M5STACK_WIDE) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 15 +#define XCLK_GPIO_NUM 27 +#define SIOD_GPIO_NUM 22 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 19 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 5 +#define Y4_GPIO_NUM 34 +#define Y3_GPIO_NUM 35 +#define Y2_GPIO_NUM 32 +#define VSYNC_GPIO_NUM 25 +#define HREF_GPIO_NUM 26 +#define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_M5STACK_ESP32CAM) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 15 +#define XCLK_GPIO_NUM 27 +#define SIOD_GPIO_NUM 25 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 19 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 5 +#define Y4_GPIO_NUM 34 +#define Y3_GPIO_NUM 35 +#define Y2_GPIO_NUM 17 +#define VSYNC_GPIO_NUM 22 +#define HREF_GPIO_NUM 26 +#define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_M5STACK_UNITCAM) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 15 +#define XCLK_GPIO_NUM 27 +#define SIOD_GPIO_NUM 25 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 19 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 5 +#define Y4_GPIO_NUM 34 +#define Y3_GPIO_NUM 35 +#define Y2_GPIO_NUM 32 +#define VSYNC_GPIO_NUM 22 +#define HREF_GPIO_NUM 26 +#define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_AI_THINKER) +#define PWDN_GPIO_NUM 32 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 0 +#define SIOD_GPIO_NUM 26 +#define SIOC_GPIO_NUM 27 + +#define Y9_GPIO_NUM 35 +#define Y8_GPIO_NUM 34 +#define Y7_GPIO_NUM 39 +#define Y6_GPIO_NUM 36 +#define Y5_GPIO_NUM 21 +#define Y4_GPIO_NUM 19 +#define Y3_GPIO_NUM 18 +#define Y2_GPIO_NUM 5 +#define VSYNC_GPIO_NUM 25 +#define HREF_GPIO_NUM 23 +#define PCLK_GPIO_NUM 22 + +#elif defined(CAMERA_MODEL_TTGO_T_CAMERA_V05) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 32 +#define SIOD_GPIO_NUM 13 +#define SIOC_GPIO_NUM 12 + +#define Y9_GPIO_NUM 39 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 23 +#define Y6_GPIO_NUM 18 +#define Y5_GPIO_NUM 15 +#define Y4_GPIO_NUM 4 +#define Y3_GPIO_NUM 14 +#define Y2_GPIO_NUM 5 +#define VSYNC_GPIO_NUM 27 +#define HREF_GPIO_NUM 25 +#define PCLK_GPIO_NUM 19 + +#elif defined(CAMERA_MODEL_TTGO_T_CAMERA_V16) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 4 +#define SIOD_GPIO_NUM 18 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 36 +#define Y8_GPIO_NUM 15 +#define Y7_GPIO_NUM 12 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 35 +#define Y4_GPIO_NUM 14 +#define Y3_GPIO_NUM 13 +#define Y2_GPIO_NUM 34 +#define VSYNC_GPIO_NUM 5 +#define HREF_GPIO_NUM 27 +#define PCLK_GPIO_NUM 25 + +#elif defined(CAMERA_MODEL_TTGO_T_CAMERA_V162) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 4 +#define SIOD_GPIO_NUM 18 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 36 +#define Y8_GPIO_NUM 37 +#define Y7_GPIO_NUM 38 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 35 +#define Y4_GPIO_NUM 14 +#define Y3_GPIO_NUM 13 +#define Y2_GPIO_NUM 34 +#define VSYNC_GPIO_NUM 5 +#define HREF_GPIO_NUM 27 +#define PCLK_GPIO_NUM 25 + +#elif defined(CAMERA_MODEL_TTGO_T_CAMERA_V17) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 32 +#define SIOD_GPIO_NUM 13 +#define SIOC_GPIO_NUM 12 + +#define Y9_GPIO_NUM 39 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 23 +#define Y6_GPIO_NUM 18 +#define Y5_GPIO_NUM 15 +#define Y4_GPIO_NUM 4 +#define Y3_GPIO_NUM 14 +#define Y2_GPIO_NUM 5 +#define VSYNC_GPIO_NUM 27 +#define HREF_GPIO_NUM 25 +#define PCLK_GPIO_NUM 19 + +#elif defined(CAMERA_MODEL_TTGO_T_CAMERA_MINI) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 32 +#define SIOD_GPIO_NUM 13 +#define SIOC_GPIO_NUM 12 + +#define Y9_GPIO_NUM 39 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 38 +#define Y6_GPIO_NUM 37 +#define Y5_GPIO_NUM 15 +#define Y4_GPIO_NUM 4 +#define Y3_GPIO_NUM 14 +#define Y2_GPIO_NUM 5 +#define VSYNC_GPIO_NUM 27 +#define HREF_GPIO_NUM 25 +#define PCLK_GPIO_NUM 19 + +#elif defined(CAMERA_MODEL_TTGO_T_CAMERA_PLUS) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 4 +#define SIOD_GPIO_NUM 18 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 36 +#define Y8_GPIO_NUM 37 +#define Y7_GPIO_NUM 38 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 35 +#define Y4_GPIO_NUM 26 +#define Y3_GPIO_NUM 13 +#define Y2_GPIO_NUM 34 +#define VSYNC_GPIO_NUM 5 +#define HREF_GPIO_NUM 27 +#define PCLK_GPIO_NUM 25 + +#elif defined(CAMERA_MODEL_TTGO_T_JOURNAL) + +#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 Y9_GPIO_NUM 16 +#define Y8_GPIO_NUM 17 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 12 +#define Y5_GPIO_NUM 10 +#define Y4_GPIO_NUM 8 +#define Y3_GPIO_NUM 9 +#define Y2_GPIO_NUM 11 +#define VSYNC_GPIO_NUM 6 +#define HREF_GPIO_NUM 7 +#define PCLK_GPIO_NUM 13 + +#elif defined(CAMERA_MODEL_TTGO_T_CAM_SIM) + +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 18 +#define XCLK_GPIO_NUM 14 +#define SIOD_GPIO_NUM 4 +#define SIOC_GPIO_NUM 5 + +#define Y9_GPIO_NUM 15 +#define Y8_GPIO_NUM 16 +#define Y7_GPIO_NUM 17 +#define Y6_GPIO_NUM 12 +#define Y5_GPIO_NUM 10 +#define Y4_GPIO_NUM 8 +#define Y3_GPIO_NUM 9 +#define Y2_GPIO_NUM 11 +#define VSYNC_GPIO_NUM 6 +#define HREF_GPIO_NUM 7 +#define PCLK_GPIO_NUM 13 + +#define PWR_ON_PIN 1 +#define PCIE_PWR_PIN 48 +#define PCIE_RST_PIN 48 +#define PCIE_TX_PIN 45 +#define PCIE_RX_PIN 46 +#define PCIE_LED_PIN 21 +#else +#error "Camera model not selected" +#endif diff --git a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino index b49f781d8..162b99e40 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino @@ -92,7 +92,7 @@ * * Only boards with PSRAM should be used. * To speed up cam processing cpu frequency should be better set to 240Mhz - * + * * remarks for AI-THINKER * GPIO0 zero must be disconnected from any wire after programming because this pin drives the cam clock and does * not tolerate any capictive load @@ -109,33 +109,13 @@ #include "esp_camera.h" #include "sensor.h" #include "fb_gfx.h" +#include "camera_pins.h" bool HttpCheckPriviledgedAccess(bool); extern ESP8266WebServer *Webserver; #define BOUNDARY "e8b8c539-047d-4777-a985-fbba6edff11e" - - -// CAMERA_MODEL_AI_THINKER default template pins -#define PWDN_GPIO_NUM 32 -#define RESET_GPIO_NUM -1 -#define XCLK_GPIO_NUM 0 -#define SIOD_GPIO_NUM 26 -#define SIOC_GPIO_NUM 27 - -#define Y9_GPIO_NUM 35 -#define Y8_GPIO_NUM 34 -#define Y7_GPIO_NUM 39 -#define Y6_GPIO_NUM 36 -#define Y5_GPIO_NUM 21 -#define Y4_GPIO_NUM 19 -#define Y3_GPIO_NUM 18 -#define Y2_GPIO_NUM 5 -#define VSYNC_GPIO_NUM 25 -#define HREF_GPIO_NUM 23 -#define PCLK_GPIO_NUM 22 - #ifndef MAX_PICSTORE #define MAX_PICSTORE 4 #endif From 81bf1ef8b6536279eeb7a70c7060f099d4b76cc3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 10 Sep 2022 13:20:24 +0200 Subject: [PATCH 2/2] no config if no model set --- .../esp32-camera/driver/include/camera_pins.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/libesp32/esp32-camera/driver/include/camera_pins.h b/lib/libesp32/esp32-camera/driver/include/camera_pins.h index d636eb11d..6640b0905 100644 --- a/lib/libesp32/esp32-camera/driver/include/camera_pins.h +++ b/lib/libesp32/esp32-camera/driver/include/camera_pins.h @@ -333,5 +333,21 @@ #define PCIE_RX_PIN 46 #define PCIE_LED_PIN 21 #else -#error "Camera model not selected" +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM -1 +#define SIOD_GPIO_NUM -1 +#define SIOC_GPIO_NUM -1 + +#define Y9_GPIO_NUM -1 +#define Y8_GPIO_NUM -1 +#define Y7_GPIO_NUM -1 +#define Y6_GPIO_NUM -1 +#define Y5_GPIO_NUM -1 +#define Y4_GPIO_NUM -1 +#define Y3_GPIO_NUM -1 +#define Y2_GPIO_NUM -1 +#define VSYNC_GPIO_NUM -1 +#define HREF_GPIO_NUM -1 +#define PCLK_GPIO_NUM -1 #endif