From 26770d877e0bb8eb93b4c84893b8ea14e70f896e Mon Sep 17 00:00:00 2001 From: SybexX Date: Sun, 16 Feb 2025 12:01:30 +0100 Subject: [PATCH] Update main.cpp If the camera could only be initialized on the second attempt, "Camera Framebuffer Check" and "Print camera infos" was skipped. --- code/main/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/main/main.cpp b/code/main/main.cpp index 2b470faa..e615b2c2 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -122,7 +122,7 @@ bool Init_NVS_SDCard() if (ret != ESP_OK) { ESP_LOGE(TAG, "Failed to create a new on-chip LDO power control driver"); - return ret; + return false; } host.pwr_ctrl_handle = pwr_ctrl_handle; #endif @@ -174,7 +174,7 @@ bool Init_NVS_SDCard() .format_if_mount_failed = false, .max_files = 12, // previously -> 2022-09-21: 5, 2023-01-02: 7 .allocation_unit_size = 0, // 0 = auto - .disk_status_check_enable = 0 + .disk_status_check_enable = 0, }; sdmmc_card_t* card; @@ -291,7 +291,7 @@ extern "C" void app_main(void) setSystemStatusFlag(SYSTEM_STATUS_HEAP_TOO_SMALL); StatusLED(PSRAM_INIT, 3, true); } - else { // OK + else { // PSRAM OK // Init camera // ******************************************** PowerResetCamera(); @@ -322,10 +322,12 @@ extern "C" void app_main(void) LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Camera init failed (" + std::string(camStatusHex) + ")! Check camera module and/or proper electrical connection"); setSystemStatusFlag(SYSTEM_STATUS_CAM_BAD); + Camera.LightOnOff(false); // make sure flashlight is off StatusLED(CAM_INIT, 1, true); } } - else { // ESP_OK -> Camera init OK --> continue to perform camera framebuffer check + + if (camStatus == ESP_OK) { // ESP_OK -> Camera init OK --> continue to perform camera framebuffer check // Camera framebuffer check // ******************************************** if (!Camera.testCamera()) {