From 52a96f154298b96923e9e5bb5b20937c0731378f Mon Sep 17 00:00:00 2001 From: biver Date: Fri, 3 Jun 2022 11:50:35 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B1=D0=B8=D1=80=D0=B0?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=20?= =?UTF-8?q?=D0=B1=D1=83=D1=84=D0=B5=D1=80=D0=B0=20=D0=B8=20=D0=BA=D0=B0?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=B0=20=D0=BA=D0=B0=D1=80=D1=82?= =?UTF-8?q?=D0=B8=D0=BD=D0=BA=D0=B8,=20=D0=B8=D0=BD=D0=B0=D1=87=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D0=B8=20=D0=BD=D0=B5=20=D1=85?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D0=B0=D1=82=D0=B5=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/exec/EspCam/EspCam.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/exec/EspCam/EspCam.cpp b/src/modules/exec/EspCam/EspCam.cpp index 6c9eeba9..39866484 100644 --- a/src/modules/exec/EspCam/EspCam.cpp +++ b/src/modules/exec/EspCam/EspCam.cpp @@ -25,6 +25,8 @@ #define HREF_GPIO_NUM 23 #define PCLK_GPIO_NUM 22 +#define PICBUF_SIZE 50000 + IoTItem* globalItem = nullptr; bool webTicker = false; @@ -78,16 +80,16 @@ class EspCam : public IoTItem { config.xclk_freq_hz = 20000000; config.pixel_format = PIXFORMAT_JPEG; - value.extBinInfo = (uint8_t*)malloc(sizeof(uint8_t) * 35000); + value.extBinInfo = (uint8_t*)malloc(sizeof(uint8_t) * PICBUF_SIZE); if(psramFound()){ config.frame_size = FRAMESIZE_SVGA; // FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA - config.jpeg_quality = 12; + config.jpeg_quality = 20; //0-63 lower number means higher quality config.fb_count = 1; Serial.printf("Camera psramFound\n"); } else { config.frame_size = FRAMESIZE_SVGA; - config.jpeg_quality = 12; + config.jpeg_quality = 20; config.fb_count = 1; } @@ -106,8 +108,11 @@ class EspCam : public IoTItem { // Take Picture with Camera fb = esp_camera_fb_get(); - if(!fb || fb->len >= 35000) { - Serial.println("Camera capture failed"); + if(!fb || fb->len >= PICBUF_SIZE) { + if (fb) { + Serial.printf("Camera capture failed size=%d\n", fb->len); + esp_camera_fb_return(fb); + } else Serial.printf("Camera capture failed\n"); return; }