From 7f37bff13d142f97f8c5593467a6beeafcae7f98 Mon Sep 17 00:00:00 2001 From: Rene Date: Wed, 17 Jan 2024 23:51:03 +0100 Subject: [PATCH] - Default value for initResult if initialzation fails --- README.md | 24 ++++++++++++------------ platformio.ini | 13 +++++++++++-- src/main.cpp | 11 ++++++----- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4551e4d..aa2bc96 100644 --- a/README.md +++ b/README.md @@ -85,24 +85,24 @@ There are a lot of boards available that are all called ESP32-CAM. However, there are differences in CPU (type/speed/cores), how the camera is connected, presence of PSRAM or not... To select the right board use the table below and use the configuration that is listed below for your board: -| Board | Configuration | Image | CPU | RAM | Camera | Site | -|--- |--- |--- |--- |--- |--- |--- | -| Espressif ESP32-Wropver CAM | | | ESP32 | 520KB SRAM 4MB PSRAM | OV2640 | | -| AI-Thinker ESP32-CAM | ai_thinker_esp32cam | | ESP32-S / 160Mhz | 520KB SRAM 4MB PSRAM | OV2640 | https://docs.ai-thinker.com/en/esp32-cam | -| Espressif ESP-EYE | | | ESP32 | 520KB SRAM 4MB PSRAM | OV2640 | | -| Espressif ESP-S3-EYE | | | ESP32-S3 | 520KB SRAM 4MB PSRAM | OV2640 | https://www.espressif.com/en/products/devkits/esp-eye/overview | -| LilyGo camera module | | | ESP32 Wrover | 520KB SRAM 4MB PSRAM | OV2640 / OV5640 -| LilyGo Simcam | | | | | OV2640 | | -| LilyGo TTGO-T Camera | | || | OV2640 | | -| M5 Stack Camera | | ||| OV2640 | | -| Seeed studio Xiao ESPS3 Sense | seeed_xiao_esp32s3_sense | | ESP32-S3 | 520KB SRAM 4MB PSRAM | OV2640 | | +| Board | Configuration | Image | CPU | RAM | Camera | Site | +|--- |--- |--- |--- |--- |--- |--- | +| Espressif ESP32-Wropver CAM | | ![img](assets/boards/esp32-wrover-cam.jpg) | ESP32 | 520KB SRAM 4MB PSRAM | OV2640 | | +| AI-Thinker ESP32-CAM | ai_thinker_esp32cam | ![img](assets/boards/ai-thinker-esp32-cam-ipex.jpg) ![img](assets/boards/ai-thinker-esp32-cam.jpg) | ESP32-S | 520KB SRAM 4MB PSRAM | OV2640 | https://docs.ai-thinker.com/en/esp32-cam | +| Espressif ESP-EYE | | ![img](assets/boards/espressif-esp-eye.jpg") | ESP32 | 520KB SRAM 4MB PSRAM | OV2640 | | +| Espressif ESP-S3-EYE | | ![img](assets/boards/espressif-esps3-eye.jpg") | ESP32-S3 | 520KB SRAM 4MB PSRAM | OV2640 | https://www.espressif.com/en/products/devkits/esp-eye/overview | +| LilyGo camera module | | ![img](assets/boards/lilygo-camera-module.jpg") | ESP32 Wrover | 520KB SRAM 4MB PSRAM | OV2640 / OV5640 | | +| LilyGo Simcam | | ![img](assets/boards/lilygo-simcam.jpg") | | | OV2640 | | +| LilyGo TTGO-T Camera | | ![img](assets/boards/lilygo-ttgo-t-camera.jpg") | | | OV2640 | | +| M5 Stack Camera | | ![img](assets/boards/m5stack-esp32-camera.jpg") | | | OV2640 | | +| Seeed studio Xiao ESPS3 Sense | seeed_xiao_esp32s3_sense | ![img](assets/boards/seeed-studio-xiao-esp32s3-sense.jpg") | ESP32-S3 | 520KB SRAM 4MB PSRAM | OV2640 | | ## Installing and running PlatformIO PlatformIO is available for all major operating systems: Windows, Linux and MacOS. It is also provided as a plugin to [Visual Studio Code](https://visualstudio.microsoft.com). More information can be found at: [https://docs.platformio.org/en/latest/installation.html](https://docs.platformio.org/en/latest/installation.html) below the basics. -Install [**Visual Studio Code**](https://code.visualstudio.com) and install the PlatformIO plugin. +Install [Visual Studio Code](https://code.visualstudio.com) and install the PlatformIO plugin. ## Putting the ESP32-CAM in download mode diff --git a/platformio.ini b/platformio.ini index 0a025e2..cf8e965 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,6 +9,15 @@ ; https://docs.platformio.org/page/projectconf.html ############################################################################### +[platformio] +#default_envs = esp32cam +#default_envs = ai_thinker_esp32cam +#default_envs = esp_eye +#default_envs = ttgo-t-beam +#default_envs = m5stack_esp32cam +#default_envs = esp32_wrover_cam +default_envs = seeed_xiao_esp32s3 + [env] platform = espressif32 framework = arduino @@ -27,8 +36,8 @@ monitor_filters = log2file, time, default, esp32_exception_decoder build_flags = -O2 - -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE - -DIOTWEBCONF_PASSWORD_LEN=64 + -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE + -D IOTWEBCONF_PASSWORD_LEN=64 board_build.embed_txtfiles = html/index.min.html diff --git a/src/main.cpp b/src/main.cpp index b0d17b7..f82cdec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -89,6 +89,10 @@ void handle_root() auto ipv4 = WiFi.getMode() == WIFI_MODE_AP ? WiFi.softAPIP() : WiFi.localIP(); auto ipv6 = WiFi.getMode() == WIFI_MODE_AP ? WiFi.softAPIPv6() : WiFi.localIPv6(); + auto initResult = esp_err_to_name(camera_init_result); + if (initResult == nullptr) + initResult = "Unknown reason"; + moustache_variable_t substitutions[] = { // Version / CPU {"AppTitle", APP_TITLE}, @@ -125,7 +129,7 @@ void handle_root() {"JpegQuality", String(param_jpg_quality.value())}, {"CameraInitialized", String(camera_init_result == ESP_OK)}, {"CameraInitResult", String(camera_init_result)}, - {"CameraInitResultText", esp_err_to_name(camera_init_result)}, + {"CameraInitResultText", initResult}, // Settings {"Brightness", String(param_brightness.value())}, {"Contrast", String(param_contrast.value())}, @@ -299,10 +303,8 @@ void setup() pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, false); -#ifdef CORE_DEBUG_LEVEL Serial.begin(115200); Serial.setDebugOutput(true); -#endif log_i("CPU Freq: %d Mhz, %d core(s)", getCpuFrequencyMhz(), ESP.getChipCores()); log_i("Free heap: %d bytes", ESP.getFreeHeap()); @@ -310,7 +312,6 @@ void setup() log_i("Board: %s", board_name); log_i("Starting " APP_TITLE "..."); - if (default_camera_config.fb_location == CAMERA_FB_IN_PSRAM) { if (!psramInit()) @@ -397,5 +398,5 @@ void loop() if (camera_server) camera_server->doLoop(); - yield(); + sleep(0); } \ No newline at end of file