Skip to content

Commit

Permalink
- Default value for initResult if initialzation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Jan 17, 2024
1 parent 351c6a2 commit 7f37bff
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | | <img src="assets/boards/esp32-wrover-cam.jpg" height="100" /> | ESP32 | 520KB SRAM 4MB PSRAM | OV2640 | |
| AI-Thinker ESP32-CAM | ai_thinker_esp32cam | <img src="assets/boards/ai-thinker-esp32-cam-ipex.jpg" height="100" /> <img src="assets/boards/ai-thinker-esp32-cam.jpg" height="100" /> | ESP32-S / 160Mhz | 520KB SRAM 4MB PSRAM | OV2640 | https://docs.ai-thinker.com/en/esp32-cam |
| Espressif ESP-EYE | | <img src="assets/boards/espressif-esp-eye.jpg" height="100" /> | ESP32 | 520KB SRAM 4MB PSRAM | OV2640 | |
| Espressif ESP-S3-EYE | | <img src="assets/boards/espressif-esps3-eye.jpg" height="100" /> | ESP32-S3 | 520KB SRAM 4MB PSRAM | OV2640 | https://www.espressif.com/en/products/devkits/esp-eye/overview |
| LilyGo camera module | | <img src="assets/boards/lilygo-camera-module.jpg" height="100" /> | ESP32 Wrover | 520KB SRAM 4MB PSRAM | OV2640 / OV5640
| LilyGo Simcam | | <img src="assets/boards/lilygo-simcam.jpg" height="100" /> | | | OV2640 | |
| LilyGo TTGO-T Camera | | <img src="assets/boards/lilygo-ttgo-t-camera.jpg" height="100" /> || | OV2640 | |
| M5 Stack Camera | | <img src="assets/boards/m5stack-esp32-camera.jpg" height="100" /> ||| OV2640 | |
| Seeed studio Xiao ESPS3 Sense | seeed_xiao_esp32s3_sense | <img src="assets/boards/seeed-studio-xiao-esp32s3-sense.jpg" height="100" /> | 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

Expand Down
13 changes: 11 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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())},
Expand Down Expand Up @@ -299,18 +303,15 @@ 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());
log_i("SDK version: %s", ESP.getSdkVersion());
log_i("Board: %s", board_name);
log_i("Starting " APP_TITLE "...");


if (default_camera_config.fb_location == CAMERA_FB_IN_PSRAM)
{
if (!psramInit())
Expand Down Expand Up @@ -397,5 +398,5 @@ void loop()
if (camera_server)
camera_server->doLoop();

yield();
sleep(0);
}

0 comments on commit 7f37bff

Please sign in to comment.