From b3cb7d1bf79dafb7f75090434a675b4175583a39 Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Thu, 17 Aug 2023 01:57:14 +0200 Subject: [PATCH] Added seeed_xiao_esp32s3 --- include/lookup_camera_config.h | 44 ++++++++++++++++++++++++---- platformio.ini | 52 +++++++++++++++++++++++++++------- src/main.cpp | 6 ++++ 3 files changed, 86 insertions(+), 16 deletions(-) diff --git a/include/lookup_camera_config.h b/include/lookup_camera_config.h index 99337f7..65159b0 100644 --- a/include/lookup_camera_config.h +++ b/include/lookup_camera_config.h @@ -5,7 +5,7 @@ typedef struct { - const char name[11]; + const char name[17]; const camera_config_t config; } camera_config_entry_t; @@ -32,7 +32,8 @@ constexpr camera_config_t esp32cam_settings = { .pixel_format = PIXFORMAT_JPEG, .frame_size = FRAMESIZE_SVGA, .jpeg_quality = 12, - .fb_count = 2}; + .fb_count = 2, + .grab_mode = CAMERA_GRAB_WHEN_EMPTY}; constexpr camera_config_t esp32cam_aithinker_settings = { .pin_pwdn = 32, @@ -57,7 +58,8 @@ constexpr camera_config_t esp32cam_aithinker_settings = { .pixel_format = PIXFORMAT_JPEG, .frame_size = FRAMESIZE_SVGA, .jpeg_quality = 12, - .fb_count = 2}; + .fb_count = 2, + .grab_mode = CAMERA_GRAB_WHEN_EMPTY}; constexpr camera_config_t esp32cam_ttgo_t_settings = { .pin_pwdn = 26, @@ -82,7 +84,8 @@ constexpr camera_config_t esp32cam_ttgo_t_settings = { .pixel_format = PIXFORMAT_JPEG, .frame_size = FRAMESIZE_SVGA, .jpeg_quality = 12, - .fb_count = 2}; + .fb_count = 2, + .grab_mode = CAMERA_GRAB_WHEN_EMPTY}; constexpr camera_config_t esp32cam_m5stack_settings = { .pin_pwdn = -1, @@ -107,7 +110,8 @@ constexpr camera_config_t esp32cam_m5stack_settings = { .pixel_format = PIXFORMAT_JPEG, .frame_size = FRAMESIZE_SVGA, .jpeg_quality = 12, - .fb_count = 2}; + .fb_count = 2, + .grab_mode = CAMERA_GRAB_WHEN_EMPTY}; constexpr camera_config_t esp32cam_wrover_kit_settings = { .pin_pwdn = -1, @@ -132,10 +136,38 @@ constexpr camera_config_t esp32cam_wrover_kit_settings = { .pixel_format = PIXFORMAT_JPEG, .frame_size = FRAMESIZE_SVGA, .jpeg_quality = 12, - .fb_count = 2}; + .fb_count = 2, + .grab_mode = CAMERA_GRAB_WHEN_EMPTY}; + +constexpr camera_config_t esp32cam_xiaoesp32s3_settings = { + .pin_pwdn = -1, + .pin_reset = -1, + .pin_xclk = 10, + .pin_sscb_sda = 40, + .pin_sscb_scl = 39, + .pin_d7 = 48, + .pin_d6 = 11, + .pin_d5 = 12, + .pin_d4 = 14, + .pin_d3 = 16, + .pin_d2 = 18, + .pin_d1 = 17, + .pin_d0 = 15, + .pin_vsync = 38, + .pin_href = 47, + .pin_pclk = 13, + .xclk_freq_hz = 20000000, + .ledc_timer = LEDC_TIMER_0, + .ledc_channel = LEDC_CHANNEL_0, + .pixel_format = PIXFORMAT_JPEG, // for streaming + .frame_size = FRAMESIZE_UXGA, + .jpeg_quality = 12, + .fb_count = 1, + .grab_mode = CAMERA_GRAB_WHEN_EMPTY}; constexpr const camera_config_entry_t camera_configs[] = { {"ESP32CAM", esp32cam_settings}, + {"ESP32CAM_XIAO_S3", esp32cam_xiaoesp32s3_settings}, {"AI THINKER", esp32cam_aithinker_settings}, {"TTGO T-CAM", esp32cam_ttgo_t_settings}, {"M5 STACK", esp32cam_m5stack_settings}, diff --git a/platformio.ini b/platformio.ini index 013831c..664fe74 100644 --- a/platformio.ini +++ b/platformio.ini @@ -27,19 +27,51 @@ monitor_dtr = 0 monitor_filters = log2file, time, default, esp32_exception_decoder build_flags = - -O2 - -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE - -D LED_FLASH=4 - -D LED_BUILTIN=33 - -D BOARD_HAS_PSRAM - -mfix-esp32-psram-cache-issue - -D IOTWEBCONF_PASSWORD_LEN=64 + -O2 + -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE + -D LED_FLASH=4 + -D LED_BUILTIN=33 + -D BOARD_HAS_PSRAM + -D TEMPRATURE_SEND_READ + -mfix-esp32-psram-cache-issue + -D IOTWEBCONF_PASSWORD_LEN=64 board_build.embed_txtfiles = html/index.min.html html/restart.min.html lib_deps = - prampec/IotWebConf @ ^3.2.1 - geeksville/Micro-RTSP @ ^0.1.6 - rzeldent/micro-moustache@^1.0.1 \ No newline at end of file + prampec/IotWebConf @ ^3.2.1 + geeksville/Micro-RTSP @ ^0.1.6 + rzeldent/micro-moustache@^1.0.1 + +[env:seeed_xiao_esp32s3] +platform = espressif32 +board = esp32s3box +framework = arduino + +# Partition scheme for OTA +board_build.partitions = min_spiffs.csv + +monitor_speed = 115200 +monitor_rts = 0 +monitor_dtr = 0 +monitor_filters = log2file, time, default, esp32_exception_decoder + +build_flags = + -O2 + -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE + -D LED_FLASH=8 + -D LED_BUILTIN=21 + -D BOARD_HAS_PSRAM + -mfix-esp32-psram-cache-issue + -D IOTWEBCONF_PASSWORD_LEN=64 + +board_build.embed_txtfiles = + html/index.min.html + html/restart.min.html + +lib_deps = + prampec/IotWebConf @ ^3.2.1 + geeksville/Micro-RTSP @ ^0.1.6 + rzeldent/micro-moustache@^1.0.1 \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index a53699d..97e7db7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,9 @@ #include #include +#ifdef TEMPRATURE_SEND_READ extern "C" uint8_t temprature_sens_read(); +#endif // HTML files extern const char index_html_min_start[] asm("_binary_html_index_min_html_start"); @@ -119,7 +121,11 @@ void handle_root() {"PsRamSize", format_memory(ESP.getPsramSize(), 0)}, // Diagnostics {"Uptime", String(format_duration(millis() / 1000))}, +#ifdef TEMPRATURE_SEND_READ {"Temperature", String((temprature_sens_read() - 32) / 1.8)}, +#else + {"Temperature", "N/A"}, +#endif {"FreeHeap", format_memory(ESP.getFreeHeap())}, {"MaxAllocHeap", format_memory(ESP.getMaxAllocHeap())}, {"NumRTSPSessions", camera_server != nullptr ? String(camera_server->num_connected()) : "RTSP server disabled"},