Răsfoiți Sursa

Modify ClassControllCamera_MakeImage

jomjol 5 ani în urmă
părinte
comite
6e521f07c4

+ 33 - 2
code/components/jomjol_controlcamera/ClassControllCamera.cpp

@@ -1,4 +1,5 @@
 #include "ClassControllCamera.h"
 #include "ClassControllCamera.h"
+#include "ClassLogFile.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include "driver/gpio.h"
 #include "driver/gpio.h"
@@ -184,6 +185,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
 
 
     LEDOnOff(true);
     LEDOnOff(true);
 
 
+//    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Start");
+
     if (delay > 0) 
     if (delay > 0) 
     {
     {
         LightOnOff(true);
         LightOnOff(true);
@@ -191,18 +194,37 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
         vTaskDelay( xDelay );
         vTaskDelay( xDelay );
     }
     }
 
 
+//    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After LightOn");
+
     camera_fb_t * fb = esp_camera_fb_get();
     camera_fb_t * fb = esp_camera_fb_get();
     if (!fb) {
     if (!fb) {
         ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
         ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
         LEDOnOff(false);
         LEDOnOff(false);
         return ESP_FAIL;
         return ESP_FAIL;
     }
     }
+
+//    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After fb_get");
+
     LEDOnOff(false);    
     LEDOnOff(false);    
     
     
     uint8_t * buf = NULL;
     uint8_t * buf = NULL;
-    size_t buf_len = 0;   
+    size_t buf_len = 0; 
+
+    int _anz = 0;  
+    TickType_t xDelay = 3000 / portTICK_PERIOD_MS;    
 
 
-    frame2bmp(fb, &buf, &buf_len);
+    while (!frame2bmp(fb, &buf, &buf_len) && _anz < 5)
+    {
+        esp_camera_fb_return(fb);
+        std::string _zw1 = "CCamera::CaptureToBasisImage failed #" + std::to_string(++_anz);
+        LogFile.WriteToFile(_zw1);
+        vTaskDelay( xDelay );  
+        fb = esp_camera_fb_get();        
+    }
+
+    esp_camera_fb_return(fb);
+
+    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After frame2bmp");
 
 
     int _len_zw = buf_len - BMP_HEADER_LEN;
     int _len_zw = buf_len - BMP_HEADER_LEN;
     uint8_t  *_buf_zeiger = buf + BMP_HEADER_LEN;
     uint8_t  *_buf_zeiger = buf + BMP_HEADER_LEN;
@@ -213,6 +235,11 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
     int width = image_width;
     int width = image_width;
     int height = image_height;
     int height = image_height;
 
 
+    std::string _zw = "Targetimage: " + std::to_string((int) _Image->rgb_image) + " Size: " + std::to_string(_Image->width) + ", " + std::to_string(_Image->height);
+    _zw = _zw + " Buf: " + std::to_string((int) buf);
+
+    if (debug_detail_heap) LogFile.WriteToFile(_zw);
+
     for (int x = 0; x < width; ++x)
     for (int x = 0; x < width; ++x)
         for (int y = 0; y < height; ++y)
         for (int y = 0; y < height; ++y)
         {
         {
@@ -223,6 +250,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
             p_target[2] = p_source[0];
             p_target[2] = p_source[0];
         }
         }
 
 
+    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After Copy To Target");
+
 //    _Image->CopyFromMemory(_buf_zeiger, _len_zw); 
 //    _Image->CopyFromMemory(_buf_zeiger, _len_zw); 
 
 
     free(buf);
     free(buf);
@@ -232,6 +261,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
         LightOnOff(false);
         LightOnOff(false);
     }
     }
 
 
+    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Done");
+
     return ESP_OK;    
     return ESP_OK;    
 }
 }
 
 

+ 2 - 1
code/components/jomjol_controlcamera/ClassControllCamera.h

@@ -16,7 +16,7 @@
 #define CAMERA_MODEL_AI_THINKER
 #define CAMERA_MODEL_AI_THINKER
 
 
 
 
-static const char *TAGCAMERACLASS = "server_part_camera";
+static const char *TAGCAMERACLASS = "server_part_camera"; 
 
 
 
 
 class CCamera {
 class CCamera {
@@ -45,5 +45,6 @@ class CCamera {
 
 
 extern CCamera Camera;
 extern CCamera Camera;
 
 
+extern bool debug_detail_heap;
 
 
 #endif
 #endif

+ 6 - 2
code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp

@@ -1,5 +1,6 @@
 #include "ClassFlowMakeImage.h"
 #include "ClassFlowMakeImage.h"
 #include "Helper.h"
 #include "Helper.h"
+#include "ClassLogFile.h"
 
 
 #include "CImageBasis.h"
 #include "CImageBasis.h"
 #include "ClassControllCamera.h"
 #include "ClassControllCamera.h"
@@ -99,13 +100,16 @@ bool ClassFlowMakeImage::doFlow(string zwtime)
 
 
     int flashdauer = (int) waitbeforepicture * 1000;
     int flashdauer = (int) waitbeforepicture * 1000;
  
  
+    if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - Before takePictureWithFlash");
+
     takePictureWithFlash(flashdauer);
     takePictureWithFlash(flashdauer);
 
 
-//    time(&TimeImageTaken);
-//    localtime(&TimeImageTaken);
+    if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - After takePictureWithFlash");
 
 
     LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
     LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
+
     RemoveOldLogs();
     RemoveOldLogs();
+    if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - After RemoveOldLogs");
 
 
     return true;
     return true;
 }
 }

+ 3 - 0
code/components/jomjol_flowcontroll/ClassFlowMakeImage.h

@@ -48,3 +48,6 @@ public:
     ~ClassFlowMakeImage(void);
     ~ClassFlowMakeImage(void);
 };
 };
 
 
+
+extern bool debug_detail_heap;
+

+ 2 - 2
code/main/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="db0ca1c";
+const char* GIT_REV="c05313a";
 const char* GIT_TAG="";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling-reduce-sd-use";
 const char* GIT_BRANCH="rolling-reduce-sd-use";
-const char* BUILD_TIME="2020-12-26 19:56";
+const char* BUILD_TIME="2020-12-27 17:35";

+ 2 - 2
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="db0ca1c";
+const char* GIT_REV="c05313a";
 const char* GIT_TAG="";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling-reduce-sd-use";
 const char* GIT_BRANCH="rolling-reduce-sd-use";
-const char* BUILD_TIME="2020-12-26 19:56";
+const char* BUILD_TIME="2020-12-27 11:05";

BIN
firmware/bootloader.bin


BIN
firmware/firmware.bin