diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.cpp b/code/components/jomjol_controlcamera/ClassControllCamera.cpp index a2f4925d..6acc5aef 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.cpp +++ b/code/components/jomjol_controlcamera/ClassControllCamera.cpp @@ -1,4 +1,5 @@ #include "ClassControllCamera.h" +#include "ClassLogFile.h" #include #include "driver/gpio.h" @@ -184,6 +185,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay) LEDOnOff(true); +// if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Start"); + if (delay > 0) { LightOnOff(true); @@ -191,18 +194,37 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay) vTaskDelay( xDelay ); } +// if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After LightOn"); + camera_fb_t * fb = esp_camera_fb_get(); if (!fb) { ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed"); LEDOnOff(false); return ESP_FAIL; } + +// if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After fb_get"); + LEDOnOff(false); uint8_t * buf = NULL; - size_t buf_len = 0; + size_t buf_len = 0; - frame2bmp(fb, &buf, &buf_len); + int _anz = 0; + TickType_t xDelay = 3000 / portTICK_PERIOD_MS; + + 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; 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 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 y = 0; y < height; ++y) { @@ -223,6 +250,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay) p_target[2] = p_source[0]; } + if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After Copy To Target"); + // _Image->CopyFromMemory(_buf_zeiger, _len_zw); free(buf); @@ -232,6 +261,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay) LightOnOff(false); } + if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Done"); + return ESP_OK; } diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.h b/code/components/jomjol_controlcamera/ClassControllCamera.h index 8c903ffd..702bc286 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.h +++ b/code/components/jomjol_controlcamera/ClassControllCamera.h @@ -16,7 +16,7 @@ #define CAMERA_MODEL_AI_THINKER -static const char *TAGCAMERACLASS = "server_part_camera"; +static const char *TAGCAMERACLASS = "server_part_camera"; class CCamera { @@ -45,5 +45,6 @@ class CCamera { extern CCamera Camera; +extern bool debug_detail_heap; #endif \ No newline at end of file diff --git a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp index e4b1078f..e8a938a4 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp @@ -1,5 +1,6 @@ #include "ClassFlowMakeImage.h" #include "Helper.h" +#include "ClassLogFile.h" #include "CImageBasis.h" #include "ClassControllCamera.h" @@ -99,13 +100,16 @@ bool ClassFlowMakeImage::doFlow(string zwtime) int flashdauer = (int) waitbeforepicture * 1000; + if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - Before takePictureWithFlash"); + takePictureWithFlash(flashdauer); -// time(&TimeImageTaken); -// localtime(&TimeImageTaken); + if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - After takePictureWithFlash"); LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage); + RemoveOldLogs(); + if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - After RemoveOldLogs"); return true; } diff --git a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h index 2edc544b..19fdcb45 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h +++ b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h @@ -48,3 +48,6 @@ public: ~ClassFlowMakeImage(void); }; + +extern bool debug_detail_heap; + diff --git a/code/main/version.cpp b/code/main/version.cpp index 79776c5c..550e15db 100644 --- a/code/main/version.cpp +++ b/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_BRANCH="rolling-reduce-sd-use"; -const char* BUILD_TIME="2020-12-26 19:56"; \ No newline at end of file +const char* BUILD_TIME="2020-12-27 17:35"; \ No newline at end of file diff --git a/code/version.cpp b/code/version.cpp index 79776c5c..adf61efb 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="db0ca1c"; +const char* GIT_REV="c05313a"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling-reduce-sd-use"; -const char* BUILD_TIME="2020-12-26 19:56"; \ No newline at end of file +const char* BUILD_TIME="2020-12-27 11:05"; \ No newline at end of file diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index 3c44d037..eeddb528 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index 43f9c861..438df29e 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ