jomjol 5 жил өмнө
parent
commit
9c8f64f602

+ 19 - 2
README.md

@@ -13,19 +13,36 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
 
 
 
 
 
 
+
+## Donate
+
+
+If you would like to support the developer with a cup of coffee you can do that via [Paypal](https://www.paypal.com/donate?hosted_button_id=8TRSVYNYKDSWL).
+
+<form action="https://www.paypal.com/donate" method="post" target="_top">
+<input type="hidden" name="hosted_button_id" value="8TRSVYNYKDSWL" />
+<input type="image" src="https://www.paypalobjects.com/en_US/DK/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
+<img alt="" border="0" src="https://www.paypal.com/en_DE/i/scr/pixel.gif" width="1" height="1" />
+</form>
+
+
 ## Change log
 ## Change log
 
 
 ------
 ------
 
 
 ### Known Issues
 ### Known Issues
 
 
-* Spontaneous reboots, most probably due to weak power supply during power intensive operations (taking / calculating pictures)
+* slow response of web server during picture analysis
 
 
 ------
 ------
 
 
 **General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
 **General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
 
 
-##### Rolling - (2020-12-29)
+##### Rolling - (2020-12-31)
+
+* Bug-Fixing: internal change of camera handling to avoid reboots
+
+2020-12-29
 
 
 * MQTT: LWT (Last Will Testament) implemented: "connection lost" is written to the error topic in case of connection lost (`TopicError`)
 * MQTT: LWT (Last Will Testament) implemented: "connection lost" is written to the error topic in case of connection lost (`TopicError`)
 
 

+ 9 - 0
code/components/jomjol_controlGPIO/CMakeLists.txt

@@ -0,0 +1,9 @@
+FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
+
+list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+
+idf_component_register(SRCS ${app_sources}
+                    INCLUDE_DIRS "."
+                    REQUIRES esp_http_server jomjol_logfile)
+
+

+ 119 - 0
code/components/jomjol_controlGPIO/server_GPIO.cpp

@@ -0,0 +1,119 @@
+#include <string>
+#include "string.h"
+
+#include <string.h>
+#include "freertos/FreeRTOS.h"
+#include "freertos/task.h"
+#include "esp_system.h"
+#include "esp_event.h"
+#include "esp_log.h"
+#include "driver/gpio.h"
+//#include "errno.h"
+
+#include <sys/stat.h>
+
+#include "server_GPIO.h"
+
+#include "ClassLogFile.h"
+
+#include "Helper.h"
+
+esp_err_t handler_switch_GPIO(httpd_req_t *req)
+{
+    if (debug_detail_heap) LogFile.WriteHeapInfo("handler_switch_GPIO - Start");    
+
+    LogFile.WriteToFile("handler_switch_GPIO");    
+    char _query[200];
+    char _valueGPIO[30];    
+    char _valueStatus[30];    
+    std::string gpio, status, zw;
+    int gpionum = 0;
+    gpio_num_t gpio_num;
+
+    if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK)
+    {
+        printf("Query: "); printf(_query); printf("\n");
+        
+        if (httpd_query_key_value(_query, "GPIO", _valueGPIO, 30) == ESP_OK)
+        {
+            printf("GPIO is found"); printf(_valueGPIO); printf("\n"); 
+            gpio = std::string(_valueGPIO);
+        }
+        if (httpd_query_key_value(_query, "Status", _valueStatus, 30) == ESP_OK)
+        {
+            printf("Status is found"); printf(_valueStatus); printf("\n"); 
+            status = std::string(_valueStatus);
+        }
+    };
+
+    status = toUpper(status);
+    if (!(status == "HIGH") && !(status == "LOW"))
+    {
+        zw = "Status not valid: " + status;;
+        httpd_resp_sendstr_chunk(req, zw.c_str());
+        httpd_resp_sendstr_chunk(req, NULL);          
+        return ESP_OK;    
+    }
+
+    gpionum = stoi(gpio);
+    
+    // frei: 16; 12-15; 2; 4
+
+    switch (gpionum) {
+        case 2:
+            gpio_num = GPIO_NUM_2;
+            break;
+        case 4:
+            gpio_num = GPIO_NUM_4;
+            break;
+        case 12:
+            gpio_num = GPIO_NUM_12;
+            break;
+        case 13:
+            gpio_num = GPIO_NUM_13;
+            break;
+        case 14:
+            gpio_num = GPIO_NUM_14;
+            break;
+        case 15:
+            gpio_num = GPIO_NUM_15;
+            break;
+        case 16:
+            gpio_num = (gpio_num_t) 16;
+            break;
+        default:
+            zw = "GPIO" + std::to_string(gpionum) + " not support - only 2, 4, 12-16 free";
+            httpd_resp_sendstr_chunk(req, zw.c_str());
+            httpd_resp_sendstr_chunk(req, NULL);          
+            return ESP_OK;    
+    }
+
+	// Init the GPIO
+    gpio_pad_select_gpio(gpio_num);
+    /* Set the GPIO as a push/pull output */
+    gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT);  
+
+    if (status == "HIGH")  
+        gpio_set_level(gpio_num, 1);
+    else
+        gpio_set_level(gpio_num, 0); 
+
+    zw = "GPIO" + std::to_string(gpionum) + " switched to " + status;
+    httpd_resp_sendstr_chunk(req, zw.c_str());
+    httpd_resp_sendstr_chunk(req, NULL);          
+    return ESP_OK;    
+};
+
+
+
+void register_server_GPIO_uri(httpd_handle_t server)
+{
+    ESP_LOGI(TAGPARTGPIO, "server_GPIO - Registering URI handlers");
+    
+    httpd_uri_t camuri = { };
+    camuri.method    = HTTP_GET;
+    camuri.uri       = "/GPIO";
+    camuri.handler   = handler_switch_GPIO;
+    camuri.user_ctx  = (void*) "switch GPIO";    
+    httpd_register_uri_handler(server, &camuri);
+}

+ 12 - 0
code/components/jomjol_controlGPIO/server_GPIO.h

@@ -0,0 +1,12 @@
+#include <esp_log.h>
+
+#include <esp_http_server.h>
+
+//#include "ClassControllCamera.h"
+
+static const char *TAGPARTGPIO = "server_GPIO";
+
+void register_server_GPIO_uri(httpd_handle_t server);
+
+
+extern bool debug_detail_heap;

+ 58 - 56
code/components/jomjol_controlcamera/ClassControllCamera.cpp

@@ -25,6 +25,8 @@
 
 
 #include "esp_camera.h"
 #include "esp_camera.h"
 
 
+// #define DEBUG_DETAIL_ON
+
 
 
 // ESP32Cam (AiThinker) PIN Map
 // ESP32Cam (AiThinker) PIN Map
 
 
@@ -68,7 +70,8 @@ static camera_config_t camera_config = {
     .pin_pclk = CAM_PIN_PCLK,
     .pin_pclk = CAM_PIN_PCLK,
 
 
     //XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental)
     //XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental)
-    .xclk_freq_hz = 20000000,
+//    .xclk_freq_hz = 20000000,             // Orginalwert
+    .xclk_freq_hz = 5000000,               // Test, um die Bildfehler los zu werden !!!!
     .ledc_timer = LEDC_TIMER_0,
     .ledc_timer = LEDC_TIMER_0,
     .ledc_channel = LEDC_CHANNEL_0,
     .ledc_channel = LEDC_CHANNEL_0,
 
 
@@ -178,14 +181,19 @@ void CCamera::SetQualitySize(int qual, framesize_t resol)
 }
 }
 
 
 
 
+
 esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
 esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
 {
 {
     string ftype;
     string ftype;
-    static const int BMP_HEADER_LEN = 54;           // von to_bmp.c !!!!!!!!!!!!!!! 
+
+    uint8_t *zwischenspeicher = NULL;
+
 
 
     LEDOnOff(true);
     LEDOnOff(true);
 
 
-//    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Start");
+#ifdef DEBUG_DETAIL_ON
+    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Start");
+#endif
 
 
     if (delay > 0) 
     if (delay > 0) 
     {
     {
@@ -194,7 +202,9 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
         vTaskDelay( xDelay );
         vTaskDelay( xDelay );
     }
     }
 
 
-//    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After LightOn");
+#ifdef DEBUG_DETAIL_ON
+    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After LightOn");
+#endif
 
 
     camera_fb_t * fb = esp_camera_fb_get();
     camera_fb_t * fb = esp_camera_fb_get();
     if (!fb) {
     if (!fb) {
@@ -203,59 +213,31 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
         return ESP_FAIL;
         return ESP_FAIL;
     }
     }
 
 
-//    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After fb_get");
+    int _size = fb->len;
+    zwischenspeicher = (uint8_t*) malloc(_size);
+    for (int i = 0; i < _size; ++i)
+        *(zwischenspeicher + i) = *(fb->buf + i);
+    esp_camera_fb_return(fb);        
 
 
-    LEDOnOff(false);    
+#ifdef DEBUG_DETAIL_ON
+    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After fb_get");
+#endif
 
 
+    LEDOnOff(false);    
 
 
     if (delay > 0) 
     if (delay > 0) 
-    {
         LightOnOff(false);
         LightOnOff(false);
-    }
-
  
  
-    TickType_t xDelay = 1000 / portTICK_PERIOD_MS;     
-    vTaskDelay( xDelay );  // wait for power to recover
+//    TickType_t xDelay = 1000 / portTICK_PERIOD_MS;     
+//    vTaskDelay( xDelay );  // wait for power to recover
     
     
     uint8_t * buf = NULL;
     uint8_t * buf = NULL;
-    size_t buf_len = 0; 
-
-    int _anz = 0;  
-    xDelay = 3000 / portTICK_PERIOD_MS;    
-
-    while (!frame2bmp(fb, &buf, &buf_len) && _anz < 5)
-    {
-        std::string _zw1 = "CCamera::CaptureToBasisImage failed #" + std::to_string(++_anz);
-        LogFile.WriteToFile(_zw1);
-
-        esp_camera_fb_return(fb);
-        _zw1 = "CCamera::CaptureToBasisImage failed #" + std::to_string(_anz) + " - after esp_camera_fb_return";
-        LogFile.WriteToFile(_zw1);
-        free(buf);
-
-        _zw1 = "CCamera::CaptureToBasisImage failed #" + std::to_string(_anz) + " - after free";
-        LogFile.WriteToFile(_zw1);
-
-        InitCam();
 
 
-        _zw1 = "CCamera::CaptureToBasisImage failed #" + std::to_string(_anz) + " - after InitCam";
-        LogFile.WriteToFile(_zw1);
+    CImageBasis _zwImage;
+    _zwImage.LoadFromMemory(zwischenspeicher, _size);
+    free(zwischenspeicher);
 
 
-        vTaskDelay( xDelay );  
-        fb = esp_camera_fb_get(); 
-
-        _zw1 = "CCamera::CaptureToBasisImage failed #" + std::to_string(_anz) + " - after esp_camera_fb_get";
-        LogFile.WriteToFile(_zw1);
-
-    }
-    
-
-    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;
+    if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After LoadFromMemory");
 
 
     stbi_uc* p_target;
     stbi_uc* p_target;
     stbi_uc* p_source;    
     stbi_uc* p_source;    
@@ -263,28 +245,31 @@ 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;
 
 
+#ifdef DEBUG_DETAIL_ON
     std::string _zw = "Targetimage: " + std::to_string((int) _Image->rgb_image) + " Size: " + std::to_string(_Image->width) + ", " + std::to_string(_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);
-
+    _zw = _zw + " _zwImage: " + std::to_string((int) _zwImage.rgb_image)  + " Size: " + std::to_string(_zwImage.width) + ", " + std::to_string(_zwImage.height);
     if (debug_detail_heap) LogFile.WriteToFile(_zw);
     if (debug_detail_heap) LogFile.WriteToFile(_zw);
+#endif
 
 
     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)
         {
         {
             p_target = _Image->rgb_image + (channels * (y * width + x));
             p_target = _Image->rgb_image + (channels * (y * width + x));
-            p_source = _buf_zeiger + (channels * (y * width + x));
-            p_target[0] = p_source[2];
+            p_source = _zwImage.rgb_image + (channels * (y * width + x));
+            p_target[0] = p_source[0];
             p_target[1] = p_source[1];
             p_target[1] = p_source[1];
-            p_target[2] = p_source[0];
+            p_target[2] = p_source[2];
         }
         }
 
 
+#ifdef DEBUG_DETAIL_ON
     if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After Copy To Target");
     if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After Copy To Target");
-
-//    _Image->CopyFromMemory(_buf_zeiger, _len_zw); 
+#endif
 
 
     free(buf);
     free(buf);
 
 
+#ifdef DEBUG_DETAIL_ON
     if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Done");
     if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Done");
+#endif
 
 
     return ESP_OK;    
     return ESP_OK;    
 }
 }
@@ -294,7 +279,7 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
 {
 {
     string ftype;
     string ftype;
 
 
-    LEDOnOff(true);
+     LEDOnOff(true);              // Abgeschaltet, um Strom zu sparen !!!!!!
 
 
     if (delay > 0) 
     if (delay > 0) 
     {
     {
@@ -310,13 +295,22 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
         return ESP_FAIL;
         return ESP_FAIL;
     }
     }
     LEDOnOff(false);    
     LEDOnOff(false);    
-    
+
+#ifdef DEBUG_DETAIL_ON    
     printf("w %d, h %d, size %d\n", fb->width, fb->height, fb->len);
     printf("w %d, h %d, size %d\n", fb->width, fb->height, fb->len);
+#endif
 
 
     nm = FormatFileName(nm);
     nm = FormatFileName(nm);
+
+#ifdef DEBUG_DETAIL_ON
     printf("Save Camera to : %s\n", nm.c_str());
     printf("Save Camera to : %s\n", nm.c_str());
+#endif
+
     ftype = toUpper(getFileType(nm));
     ftype = toUpper(getFileType(nm));
+
+#ifdef DEBUG_DETAIL_ON
     printf("Filetype: %s\n", ftype.c_str());
     printf("Filetype: %s\n", ftype.c_str());
+#endif
 
 
     uint8_t * buf = NULL;
     uint8_t * buf = NULL;
     size_t buf_len = 0;   
     size_t buf_len = 0;   
@@ -344,7 +338,9 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
     FILE * fp = OpenFileAndWait(nm.c_str(), "wb");
     FILE * fp = OpenFileAndWait(nm.c_str(), "wb");
     if (fp == NULL)  /* If an error occurs during the file creation */
     if (fp == NULL)  /* If an error occurs during the file creation */
     {
     {
+#ifdef DEBUG_DETAIL_ON   
         fprintf(stderr, "fopen() failed for '%s'\n", nm.c_str());
         fprintf(stderr, "fopen() failed for '%s'\n", nm.c_str());
+#endif
     }
     }
     else
     else
     {
     {
@@ -463,7 +459,9 @@ void CCamera::GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol
         printf("Query: "); printf(_query); printf("\n");
         printf("Query: "); printf(_query); printf("\n");
         if (httpd_query_key_value(_query, "size", _size, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "size", _size, 10) == ESP_OK)
         {
         {
+#ifdef DEBUG_DETAIL_ON   
             printf("Size: "); printf(_size); printf("\n");            
             printf("Size: "); printf(_size); printf("\n");            
+#endif
             if (strcmp(_size, "QVGA") == 0)
             if (strcmp(_size, "QVGA") == 0)
                 resol = FRAMESIZE_QVGA;       // 320x240
                 resol = FRAMESIZE_QVGA;       // 320x240
             if (strcmp(_size, "VGA") == 0)
             if (strcmp(_size, "VGA") == 0)
@@ -479,7 +477,9 @@ void CCamera::GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol
         }
         }
         if (httpd_query_key_value(_query, "quality", _qual, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "quality", _qual, 10) == ESP_OK)
         {
         {
+#ifdef DEBUG_DETAIL_ON   
             printf("Quality: "); printf(_qual); printf("\n");
             printf("Quality: "); printf(_qual); printf("\n");
+#endif
             qual = atoi(_qual);
             qual = atoi(_qual);
                 
                 
             if (qual > 63)
             if (qual > 63)
@@ -510,7 +510,9 @@ framesize_t CCamera::TextToFramesize(const char * _size)
 
 
 CCamera::CCamera()
 CCamera::CCamera()
 {
 {
+#ifdef DEBUG_DETAIL_ON    
     printf("CreateClassCamera\n");
     printf("CreateClassCamera\n");
+#endif
 }
 }
 
 
 esp_err_t CCamera::InitCam()
 esp_err_t CCamera::InitCam()

+ 45 - 8
code/components/jomjol_controlcamera/server_camera.cpp

@@ -11,6 +11,9 @@
 #define SCRATCH_BUFSIZE2  8192 
 #define SCRATCH_BUFSIZE2  8192 
 char scratch2[SCRATCH_BUFSIZE2];
 char scratch2[SCRATCH_BUFSIZE2];
 
 
+// #define DEBUG_DETAIL_ON   
+
+
 
 
 void PowerResetCamera(){
 void PowerResetCamera(){
         ESP_LOGD(TAGPARTCAMERA, "Resetting camera by power down line");
         ESP_LOGD(TAGPARTCAMERA, "Resetting camera by power down line");
@@ -29,50 +32,65 @@ void PowerResetCamera(){
 
 
 esp_err_t handler_lightOn(httpd_req_t *req)
 esp_err_t handler_lightOn(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOn - Start");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOn - Start");
-
     LogFile.WriteToFile("handler_lightOn");
     LogFile.WriteToFile("handler_lightOn");
     printf("handler_lightOn uri:\n"); printf(req->uri); printf("\n");
     printf("handler_lightOn uri:\n"); printf(req->uri); printf("\n");
+#endif
+
     Camera.LightOnOff(true);
     Camera.LightOnOff(true);
     const char* resp_str = (const char*) req->user_ctx;
     const char* resp_str = (const char*) req->user_ctx;
     httpd_resp_send(req, resp_str, strlen(resp_str));  
     httpd_resp_send(req, resp_str, strlen(resp_str));  
 
 
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOn - Done");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOn - Done");
+#endif
 
 
     return ESP_OK;
     return ESP_OK;
 };
 };
 
 
 esp_err_t handler_lightOff(httpd_req_t *req)
 esp_err_t handler_lightOff(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOff - Start");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOff - Start");
-
     LogFile.WriteToFile("handler_lightOff");
     LogFile.WriteToFile("handler_lightOff");
     printf("handler_lightOff uri:\n"); printf(req->uri); printf("\n");
     printf("handler_lightOff uri:\n"); printf(req->uri); printf("\n");
+#endif
     Camera.LightOnOff(false);
     Camera.LightOnOff(false);
     const char* resp_str = (const char*) req->user_ctx;
     const char* resp_str = (const char*) req->user_ctx;
     httpd_resp_send(req, resp_str, strlen(resp_str));       
     httpd_resp_send(req, resp_str, strlen(resp_str));       
 
 
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOff - Done");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_lightOff - Done");
+#endif
 
 
     return ESP_OK;
     return ESP_OK;
 };
 };
 
 
 esp_err_t handler_capture(httpd_req_t *req)
 esp_err_t handler_capture(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture - Start");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture - Start");
-
     LogFile.WriteToFile("handler_capture");
     LogFile.WriteToFile("handler_capture");
+#endif
+
     int quality;
     int quality;
     framesize_t res;
     framesize_t res;
 
 
     Camera.GetCameraParameter(req, quality, res);
     Camera.GetCameraParameter(req, quality, res);
+
+#ifdef DEBUG_DETAIL_ON   
     printf("Size: %d", res); printf(" Quality: %d\n", quality);
     printf("Size: %d", res); printf(" Quality: %d\n", quality);
+#endif
+
     Camera.SetQualitySize(quality, res);
     Camera.SetQualitySize(quality, res);
 
 
     esp_err_t ressult;
     esp_err_t ressult;
     ressult = Camera.CaptureToHTTP(req);
     ressult = Camera.CaptureToHTTP(req);
 
 
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture - Done");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture - Done");
+#endif
 
 
     return ressult;
     return ressult;
 };
 };
@@ -95,7 +113,9 @@ esp_err_t handler_capture_with_ligth(httpd_req_t *req)
         printf("Query: "); printf(_query); printf("\n");
         printf("Query: "); printf(_query); printf("\n");
         if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
         {
         {
-            printf("Delay: "); printf(_delay); printf("\n");            
+#ifdef DEBUG_DETAIL_ON   
+            printf("Delay: "); printf(_delay); printf("\n");    
+#endif        
             delay = atoi(_delay);
             delay = atoi(_delay);
 
 
             if (delay < 0)
             if (delay < 0)
@@ -104,9 +124,12 @@ esp_err_t handler_capture_with_ligth(httpd_req_t *req)
     };
     };
 
 
     Camera.GetCameraParameter(req, quality, res);
     Camera.GetCameraParameter(req, quality, res);
+
+#ifdef DEBUG_DETAIL_ON   
     printf("Size: %d", res); printf(" Quality: %d\n", quality);
     printf("Size: %d", res); printf(" Quality: %d\n", quality);
-    Camera.SetQualitySize(quality, res);
+#endif
 
 
+    Camera.SetQualitySize(quality, res);
     Camera.LightOnOff(true);
     Camera.LightOnOff(true);
     const TickType_t xDelay = delay / portTICK_PERIOD_MS;
     const TickType_t xDelay = delay / portTICK_PERIOD_MS;
     vTaskDelay( xDelay );
     vTaskDelay( xDelay );
@@ -116,8 +139,10 @@ esp_err_t handler_capture_with_ligth(httpd_req_t *req)
 
 
     Camera.LightOnOff(false);
     Camera.LightOnOff(false);
 
 
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture_with_ligth - Done");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture_with_ligth - Done");
-   
+#endif
+
     return ressult;
     return ressult;
 };
 };
 
 
@@ -125,9 +150,11 @@ esp_err_t handler_capture_with_ligth(httpd_req_t *req)
 
 
 esp_err_t handler_capture_save_to_file(httpd_req_t *req)
 esp_err_t handler_capture_save_to_file(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
-
     LogFile.WriteToFile("handler_capture_save_to_file");
     LogFile.WriteToFile("handler_capture_save_to_file");
+#endif
+
     char _query[100];
     char _query[100];
     char _delay[10];
     char _delay[10];
     int delay = 0;
     int delay = 0;
@@ -144,14 +171,18 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
         if (httpd_query_key_value(_query, "filename", filename, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "filename", filename, 100) == ESP_OK)
         {
         {
             fn.append(filename);
             fn.append(filename);
+#ifdef DEBUG_DETAIL_ON   
             printf("Filename: "); printf(fn.c_str()); printf("\n");            
             printf("Filename: "); printf(fn.c_str()); printf("\n");            
+#endif
         }
         }
         else
         else
             fn.append("noname.jpg");
             fn.append("noname.jpg");
 
 
         if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
         {
         {
+#ifdef DEBUG_DETAIL_ON   
             printf("Delay: "); printf(_delay); printf("\n");            
             printf("Delay: "); printf(_delay); printf("\n");            
+#endif
             delay = atoi(_delay);
             delay = atoi(_delay);
 
 
             if (delay < 0)
             if (delay < 0)
@@ -163,7 +194,9 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
         fn.append("noname.jpg");
         fn.append("noname.jpg");
 
 
     Camera.GetCameraParameter(req, quality, res);
     Camera.GetCameraParameter(req, quality, res);
+#ifdef DEBUG_DETAIL_ON   
     printf("Size: %d", res); printf(" Quality: %d\n", quality);
     printf("Size: %d", res); printf(" Quality: %d\n", quality);
+#endif
     Camera.SetQualitySize(quality, res);
     Camera.SetQualitySize(quality, res);
 
 
     esp_err_t ressult;
     esp_err_t ressult;
@@ -172,7 +205,9 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
     const char* resp_str = (const char*) fn.c_str();
     const char* resp_str = (const char*) fn.c_str();
     httpd_resp_send(req, resp_str, strlen(resp_str));  
     httpd_resp_send(req, resp_str, strlen(resp_str));  
   
   
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
+#endif
 
 
     return ressult;
     return ressult;
 };
 };
@@ -181,8 +216,10 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
 
 
 void register_server_camera_uri(httpd_handle_t server)
 void register_server_camera_uri(httpd_handle_t server)
 {
 {
+#ifdef DEBUG_DETAIL_ON   
     ESP_LOGI(TAGPARTCAMERA, "server_part_camera - Registering URI handlers");
     ESP_LOGI(TAGPARTCAMERA, "server_part_camera - Registering URI handlers");
-    
+#endif
+
     httpd_uri_t camuri = { };
     httpd_uri_t camuri = { };
     camuri.method    = HTTP_GET;
     camuri.method    = HTTP_GET;
 
 

+ 3 - 1
code/components/jomjol_fileserver_ota/server_file.cpp

@@ -68,6 +68,8 @@ static esp_err_t index_html_get_handler(httpd_req_t *req)
 /* Handler to respond with an icon file embedded in flash.
 /* Handler to respond with an icon file embedded in flash.
  * Browsers expect to GET website icon at URI /favicon.ico.
  * Browsers expect to GET website icon at URI /favicon.ico.
  * This can be overridden by uploading file with same name */
  * This can be overridden by uploading file with same name */
+
+/*
 static esp_err_t favicon_get_handler(httpd_req_t *req)
 static esp_err_t favicon_get_handler(httpd_req_t *req)
 {
 {
     extern const unsigned char favicon_ico_start[] asm("_binary_favicon_ico_start");
     extern const unsigned char favicon_ico_start[] asm("_binary_favicon_ico_start");
@@ -75,10 +77,10 @@ static esp_err_t favicon_get_handler(httpd_req_t *req)
     const size_t favicon_ico_size = (favicon_ico_end - favicon_ico_start);
     const size_t favicon_ico_size = (favicon_ico_end - favicon_ico_start);
     httpd_resp_set_type(req, "image/x-icon");
     httpd_resp_set_type(req, "image/x-icon");
     httpd_resp_send(req, (const char *)favicon_ico_start, favicon_ico_size);
     httpd_resp_send(req, (const char *)favicon_ico_start, favicon_ico_size);
-    /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_send_chunk(req, NULL, 0);       
     httpd_resp_send_chunk(req, NULL, 0);       
     return ESP_OK;
     return ESP_OK;
 }
 }
+*/
 
 
 /* Send HTTP response with a run-time generated html consisting of
 /* Send HTTP response with a run-time generated html consisting of
  * a list of all files and folders under the requested path.
  * a list of all files and folders under the requested path.

+ 4 - 1
code/components/jomjol_flowcontroll/ClassFlowAnalog.cpp

@@ -283,8 +283,11 @@ std::vector<HTMLInfo*> ClassFlowAnalog::GetHTMLInfo()
     for (int i = 0; i < ROI.size(); ++i)
     for (int i = 0; i < ROI.size(); ++i)
     {
     {
         HTMLInfo *zw = new HTMLInfo;
         HTMLInfo *zw = new HTMLInfo;
-        zw->filename = ROI[i]->name + ".jpg";
+        zw->filename = ROI[i]->name + ".bmp";
+        zw->filename_org = ROI[i]->name + ".jpg";
         zw->val = ROI[i]->result;
         zw->val = ROI[i]->result;
+        zw->image = ROI[i]->image;
+        zw->image_org = ROI[i]->image_org;
         result.push_back(zw);
         result.push_back(zw);
     }
     }
 
 

+ 7 - 4
code/components/jomjol_image_proc/CImageBasis.cpp

@@ -247,6 +247,10 @@ void CImageBasis::drawCircle(int x1, int y1, int rad, int r, int g, int b, int t
 CImageBasis::CImageBasis()
 CImageBasis::CImageBasis()
 {
 {
     externalImage = false;
     externalImage = false;
+    rgb_image = NULL;
+    width = 0;
+    height = 0;
+    channels = 0;    
 }
 }
 
 
 void CImageBasis::CreateEmptyImage(int _width, int _height, int _channels)
 void CImageBasis::CreateEmptyImage(int _width, int _height, int _channels)
@@ -275,12 +279,11 @@ void CImageBasis::CreateEmptyImage(int _width, int _height, int _channels)
 
 
 void CImageBasis::LoadFromMemory(stbi_uc *_buffer, int len)
 void CImageBasis::LoadFromMemory(stbi_uc *_buffer, int len)
 {
 {
-//    if (rgb_image)
-//        free(rgb_image);
+    if (rgb_image)
+        stbi_image_free(rgb_image);
     rgb_image = stbi_load_from_memory(_buffer, len, &width, &height, &channels, 3);
     rgb_image = stbi_load_from_memory(_buffer, len, &width, &height, &channels, 3);
     bpp = channels;
     bpp = channels;
-//        STBIDEF stbi_uc *stbi_load_from_memory   (stbi_uc           const *buffer, int len   , int *x, int *y, int *channels_in_file, int desired_channels);
-
+    printf("Image loaded from memory: %d, %d, %d\n", width, height, channels);
 }
 }
 
 
 CImageBasis::CImageBasis(CImageBasis *_copyfrom, int _anzrepeat) 
 CImageBasis::CImageBasis(CImageBasis *_copyfrom, int _anzrepeat) 

+ 11 - 11
code/components/jomjol_tfliteclass/CTfLiteClass.cpp

@@ -1,13 +1,10 @@
 #include "CTfLiteClass.h"
 #include "CTfLiteClass.h"
-
-// #include "bitmap_image.hpp"
-
 #include "ClassLogFile.h"
 #include "ClassLogFile.h"
 #include "Helper.h"
 #include "Helper.h"
 
 
 #include <sys/stat.h>
 #include <sys/stat.h>
 
 
-bool debugdetailtflite = false;
+//#define DEBUG_DETAIL_ON
 
 
 float CTfLiteClass::GetOutputValue(int nr)
 float CTfLiteClass::GetOutputValue(int nr)
 {
 {
@@ -22,12 +19,10 @@ float CTfLiteClass::GetOutputValue(int nr)
 
 
 int CTfLiteClass::GetClassFromImageBasis(CImageBasis *rs)
 int CTfLiteClass::GetClassFromImageBasis(CImageBasis *rs)
 {
 {
-//  printf("Before Load image %s\n", _fn.c_str());
     if (!LoadInputImageBasis(rs))
     if (!LoadInputImageBasis(rs))
       return -1000;
       return -1000;
 
 
     Invoke();
     Invoke();
-    printf("After Invoke \n");
 
 
     return GetOutClassification();
     return GetOutClassification();
 }
 }
@@ -53,7 +48,6 @@ int CTfLiteClass::GetOutClassification()
         zw_class = i;
         zw_class = i;
     }
     }
   }
   }
-//  printf("Result Ziffer: %d\n", zw_class);       
   return zw_class;
   return zw_class;
 }
 }
 
 
@@ -105,7 +99,6 @@ void CTfLiteClass::GetOutPut()
 void CTfLiteClass::Invoke()
 void CTfLiteClass::Invoke()
 {
 {
     interpreter->Invoke();
     interpreter->Invoke();
-//    printf("Invoke Done.\n");
 }
 }
 
 
 
 
@@ -135,8 +128,10 @@ bool CTfLiteClass::LoadInputImageBasis(CImageBasis *rs)
                 *(input_data_ptr) = (float) blue;
                 *(input_data_ptr) = (float) blue;
                 input_data_ptr++;
                 input_data_ptr++;
             }
             }
-    
-    if (debugdetailtflite) LogFile.WriteToFile("Nach dem Laden in input");
+
+#ifdef DEBUG_DETAIL_ON          
+    LogFile.WriteToFile("Nach dem Laden in input");
+#endif
 
 
     return true;
     return true;
 }
 }
@@ -159,7 +154,9 @@ void CTfLiteClass::MakeAllocate()
 void CTfLiteClass::GetInputTensorSize(){
 void CTfLiteClass::GetInputTensorSize(){
     float *zw = this->input;
     float *zw = this->input;
     int test = sizeof(zw);
     int test = sizeof(zw);
+#ifdef DEBUG_DETAIL_ON    
     printf("Input Tensor Dimension: %d\n", test);       
     printf("Input Tensor Dimension: %d\n", test);       
+#endif
 }
 }
 
 
 long CTfLiteClass::GetFileSize(std::string filename)
 long CTfLiteClass::GetFileSize(std::string filename)
@@ -178,7 +175,9 @@ unsigned char* CTfLiteClass::ReadFileToCharArray(std::string _fn)
 
 
     if (size == -1)
     if (size == -1)
     {
     {
+#ifdef DEBUG_DETAIL_ON      
 		printf("\nFile existiert nicht.\n");
 		printf("\nFile existiert nicht.\n");
+#endif
         return NULL;
         return NULL;
     }
     }
 
 
@@ -187,7 +186,9 @@ unsigned char* CTfLiteClass::ReadFileToCharArray(std::string _fn)
     TickType_t xDelay;
     TickType_t xDelay;
     while (!result && (anz < 6))    // maximal 5x versuchen (= 5s)
     while (!result && (anz < 6))    // maximal 5x versuchen (= 5s)
     {
     {
+#ifdef DEBUG_DETAIL_ON      
 		    printf("Speicher ist voll - Versuche es erneut: %d.\n", anz);
 		    printf("Speicher ist voll - Versuche es erneut: %d.\n", anz);
+#endif
         xDelay = 1000 / portTICK_PERIOD_MS;
         xDelay = 1000 / portTICK_PERIOD_MS;
         result = (unsigned char*) malloc(size);
         result = (unsigned char*) malloc(size);
         anz++;
         anz++;
@@ -195,7 +196,6 @@ unsigned char* CTfLiteClass::ReadFileToCharArray(std::string _fn)
 
 
   
   
 	  if(result != NULL) {
 	  if(result != NULL) {
-//		printf("\nSpeicher ist reserviert\n");
         FILE* f = OpenFileAndWait(_fn.c_str(), "rb");     // vorher  nur "r"
         FILE* f = OpenFileAndWait(_fn.c_str(), "rb");     // vorher  nur "r"
         fread(result, 1, size, f);
         fread(result, 1, size, f);
         fclose(f);        
         fclose(f);        

+ 72 - 14
code/components/jomjol_tfliteclass/server_tflite.cpp

@@ -18,6 +18,9 @@
 
 
 #include "ClassLogFile.h"
 #include "ClassLogFile.h"
 
 
+//#define DEBUG_DETAIL_ON       
+
+
 ClassFlowControll tfliteflow;
 ClassFlowControll tfliteflow;
 
 
 TaskHandle_t xHandleblink_task_doFlow = NULL;
 TaskHandle_t xHandleblink_task_doFlow = NULL;
@@ -58,28 +61,40 @@ bool isSetupModusActive() {
 
 
 void KillTFliteTasks()
 void KillTFliteTasks()
 {
 {
-    printf("Handle: xHandleblink_task_doFlow: %ld\n", (long) xHandleblink_task_doFlow);    
+#ifdef DEBUG_DETAIL_ON          
+    printf("Handle: xHandleblink_task_doFlow: %ld\n", (long) xHandleblink_task_doFlow);  
+#endif  
     if (xHandleblink_task_doFlow)
     if (xHandleblink_task_doFlow)
     {
     {
         vTaskDelete(xHandleblink_task_doFlow);
         vTaskDelete(xHandleblink_task_doFlow);
+#ifdef DEBUG_DETAIL_ON      
         printf("Killed: xHandleblink_task_doFlow\n");
         printf("Killed: xHandleblink_task_doFlow\n");
+#endif
     }
     }
 
 
+#ifdef DEBUG_DETAIL_ON      
     printf("Handle: xHandletask_autodoFlow: %ld\n", (long) xHandletask_autodoFlow);  
     printf("Handle: xHandletask_autodoFlow: %ld\n", (long) xHandletask_autodoFlow);  
+#endif
     if (xHandletask_autodoFlow)
     if (xHandletask_autodoFlow)
     {
     {
         vTaskDelete(xHandletask_autodoFlow);
         vTaskDelete(xHandletask_autodoFlow);
+#ifdef DEBUG_DETAIL_ON      
         printf("Killed: xHandletask_autodoFlow\n");
         printf("Killed: xHandletask_autodoFlow\n");
+#endif
     }
     }
 
 
 }
 }
 
 
 void doInit(void)
 void doInit(void)
 {
 {
-    string config = "/sdcard/config/config.ini";   
+    string config = "/sdcard/config/config.ini";
+#ifdef DEBUG_DETAIL_ON             
     printf("Start tfliteflow.InitFlow(config);\n");
     printf("Start tfliteflow.InitFlow(config);\n");
+#endif
     tfliteflow.InitFlow(config);
     tfliteflow.InitFlow(config);
+#ifdef DEBUG_DETAIL_ON      
     printf("Finished tfliteflow.InitFlow(config);\n");
     printf("Finished tfliteflow.InitFlow(config);\n");
+#endif
 }
 }
 
 
 
 
@@ -92,13 +107,17 @@ bool doflow(void)
     tfliteflow.doFlow(zw_time);
     tfliteflow.doFlow(zw_time);
     flowisrunning = false;
     flowisrunning = false;
 
 
+#ifdef DEBUG_DETAIL_ON      
     printf("doflow - end %s\n", zw_time.c_str());
     printf("doflow - end %s\n", zw_time.c_str());
+#endif    
     return true;
     return true;
 }
 }
 
 
 void blink_task_doFlow(void *pvParameter)
 void blink_task_doFlow(void *pvParameter)
 {
 {
+#ifdef DEBUG_DETAIL_ON          
     printf("blink_task_doFlow\n");
     printf("blink_task_doFlow\n");
+#endif
     if (!flowisrunning)
     if (!flowisrunning)
     {
     {
         flowisrunning = true;
         flowisrunning = true;
@@ -114,8 +133,10 @@ esp_err_t handler_init(httpd_req_t *req)
 {
 {
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_init - Start");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_init - Start");       
 
 
+#ifdef DEBUG_DETAIL_ON      
     LogFile.WriteToFile("handler_init"); 
     LogFile.WriteToFile("handler_init"); 
     printf("handler_doinit uri:\n"); printf(req->uri); printf("\n");
     printf("handler_doinit uri:\n"); printf(req->uri); printf("\n");
+#endif
 
 
     char* resp_str = "Init started<br>";
     char* resp_str = "Init started<br>";
     httpd_resp_send(req, resp_str, strlen(resp_str));     
     httpd_resp_send(req, resp_str, strlen(resp_str));     
@@ -127,16 +148,20 @@ esp_err_t handler_init(httpd_req_t *req)
     /* Respond with an empty chunk to signal HTTP response completion */
     /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_send_chunk(req, NULL, 0);    
     httpd_resp_send_chunk(req, NULL, 0);    
 
 
+#ifdef DEBUG_DETAIL_ON      
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_init - Done");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_init - Done");       
+#endif
 
 
     return ESP_OK;
     return ESP_OK;
 };
 };
 
 
 esp_err_t handler_doflow(httpd_req_t *req)
 esp_err_t handler_doflow(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON          
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_doflow - Start");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_doflow - Start");       
-
     LogFile.WriteToFile("handler_doflow");   
     LogFile.WriteToFile("handler_doflow");   
+#endif
+
     char* resp_str;
     char* resp_str;
 
 
     printf("handler_doFlow uri: "); printf(req->uri); printf("\n");
     printf("handler_doFlow uri: "); printf(req->uri); printf("\n");
@@ -155,7 +180,10 @@ esp_err_t handler_doflow(httpd_req_t *req)
     httpd_resp_send(req, resp_str, strlen(resp_str));  
     httpd_resp_send(req, resp_str, strlen(resp_str));  
     /* Respond with an empty chunk to signal HTTP response completion */
     /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_send_chunk(req, NULL, 0);       
     httpd_resp_send_chunk(req, NULL, 0);       
+
+#ifdef DEBUG_DETAIL_ON   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_doflow - Done");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_doflow - Done");       
+#endif
 
 
     return ESP_OK;
     return ESP_OK;
 };
 };
@@ -165,9 +193,11 @@ esp_err_t handler_doflow(httpd_req_t *req)
 
 
 esp_err_t handler_wasserzaehler(httpd_req_t *req)
 esp_err_t handler_wasserzaehler(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_wasserzaehler - Start");    
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_wasserzaehler - Start");    
-
     LogFile.WriteToFile("handler_wasserzaehler");    
     LogFile.WriteToFile("handler_wasserzaehler");    
+#endif
+
     bool _rawValue = false;
     bool _rawValue = false;
     bool _noerror = false;
     bool _noerror = false;
     string zw;
     string zw;
@@ -182,12 +212,16 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
 //        printf("Query: "); printf(_query); printf("\n");
 //        printf("Query: "); printf(_query); printf("\n");
         if (httpd_query_key_value(_query, "rawvalue", _size, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "rawvalue", _size, 10) == ESP_OK)
         {
         {
+#ifdef DEBUG_DETAIL_ON       
             printf("rawvalue is found"); printf(_size); printf("\n"); 
             printf("rawvalue is found"); printf(_size); printf("\n"); 
+#endif
             _rawValue = true;
             _rawValue = true;
         }
         }
         if (httpd_query_key_value(_query, "noerror", _size, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "noerror", _size, 10) == ESP_OK)
         {
         {
+#ifdef DEBUG_DETAIL_ON       
             printf("noerror is found"); printf(_size); printf("\n"); 
             printf("noerror is found"); printf(_size); printf("\n"); 
+#endif
             _noerror = true;
             _noerror = true;
         }        
         }        
     }  
     }  
@@ -248,16 +282,19 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
     /* Respond with an empty chunk to signal HTTP response completion */
     /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_sendstr_chunk(req, NULL);   
     httpd_resp_sendstr_chunk(req, NULL);   
 
 
+#ifdef DEBUG_DETAIL_ON       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_wasserzaehler - Done");   
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_wasserzaehler - Done");   
-
+#endif
     return ESP_OK;
     return ESP_OK;
 };
 };
 
 
 
 
 esp_err_t handler_editflow(httpd_req_t *req)
 esp_err_t handler_editflow(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_editflow - Start");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_editflow - Start");       
     LogFile.WriteToFile("handler_editflow");    
     LogFile.WriteToFile("handler_editflow");    
+#endif
 
 
     printf("handler_editflow uri: "); printf(req->uri); printf("\n");
     printf("handler_editflow uri: "); printf(req->uri); printf("\n");
 
 
@@ -269,7 +306,9 @@ esp_err_t handler_editflow(httpd_req_t *req)
     {
     {
         if (httpd_query_key_value(_query, "task", _valuechar, 30) == ESP_OK)
         if (httpd_query_key_value(_query, "task", _valuechar, 30) == ESP_OK)
         {
         {
+#ifdef DEBUG_DETAIL_ON       
             printf("task is found: %s\n", _valuechar); 
             printf("task is found: %s\n", _valuechar); 
+#endif
             _task = string(_valuechar);
             _task = string(_valuechar);
         }
         }
     }  
     }  
@@ -280,11 +319,13 @@ esp_err_t handler_editflow(httpd_req_t *req)
 
 
         httpd_query_key_value(_query, "in", _valuechar, 30);
         httpd_query_key_value(_query, "in", _valuechar, 30);
         in = string(_valuechar);
         in = string(_valuechar);
-        printf("in: "); printf(in.c_str()); printf("\n"); 
-
         httpd_query_key_value(_query, "out", _valuechar, 30);         
         httpd_query_key_value(_query, "out", _valuechar, 30);         
         out = string(_valuechar);  
         out = string(_valuechar);  
+
+#ifdef DEBUG_DETAIL_ON       
+        printf("in: "); printf(in.c_str()); printf("\n"); 
         printf("out: "); printf(out.c_str()); printf("\n"); 
         printf("out: "); printf(out.c_str()); printf("\n"); 
+#endif
 
 
         in = "/sdcard" + in;
         in = "/sdcard" + in;
         out = "/sdcard" + out;
         out = "/sdcard" + out;
@@ -303,31 +344,34 @@ esp_err_t handler_editflow(httpd_req_t *req)
 
 
         httpd_query_key_value(_query, "in", _valuechar, 30);
         httpd_query_key_value(_query, "in", _valuechar, 30);
         in = string(_valuechar);
         in = string(_valuechar);
-        printf("in: "); printf(in.c_str()); printf("\n"); 
 
 
         httpd_query_key_value(_query, "out", _valuechar, 30);         
         httpd_query_key_value(_query, "out", _valuechar, 30);         
         out = string(_valuechar);  
         out = string(_valuechar);  
-        printf("out: "); printf(out.c_str()); printf("\n"); 
 
 
         httpd_query_key_value(_query, "x", _valuechar, 30);
         httpd_query_key_value(_query, "x", _valuechar, 30);
         zw = string(_valuechar);  
         zw = string(_valuechar);  
         x = stoi(zw);              
         x = stoi(zw);              
-        printf("x: "); printf(zw.c_str()); printf("\n"); 
 
 
         httpd_query_key_value(_query, "y", _valuechar, 30);
         httpd_query_key_value(_query, "y", _valuechar, 30);
         zw = string(_valuechar);  
         zw = string(_valuechar);  
         y = stoi(zw);              
         y = stoi(zw);              
-        printf("y: "); printf(zw.c_str()); printf("\n"); 
 
 
         httpd_query_key_value(_query, "dx", _valuechar, 30);
         httpd_query_key_value(_query, "dx", _valuechar, 30);
         zw = string(_valuechar);  
         zw = string(_valuechar);  
         dx = stoi(zw);  
         dx = stoi(zw);  
-        printf("dx: "); printf(zw.c_str()); printf("\n"); 
 
 
         httpd_query_key_value(_query, "dy", _valuechar, 30);
         httpd_query_key_value(_query, "dy", _valuechar, 30);
         zw = string(_valuechar);  
         zw = string(_valuechar);  
         dy = stoi(zw);          
         dy = stoi(zw);          
+
+#ifdef DEBUG_DETAIL_ON       
+        printf("in: "); printf(in.c_str()); printf("\n"); 
+        printf("out: "); printf(out.c_str()); printf("\n"); 
+        printf("x: "); printf(zw.c_str()); printf("\n"); 
+        printf("y: "); printf(zw.c_str()); printf("\n"); 
+        printf("dx: "); printf(zw.c_str()); printf("\n"); 
         printf("dy: "); printf(zw.c_str()); printf("\n"); 
         printf("dy: "); printf(zw.c_str()); printf("\n"); 
+#endif
 
 
         if (httpd_query_key_value(_query, "enhance", _valuechar, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "enhance", _valuechar, 10) == ESP_OK)
         {
         {
@@ -413,7 +457,10 @@ esp_err_t handler_editflow(httpd_req_t *req)
 
 
     /* Respond with an empty chunk to signal HTTP response completion */
     /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_sendstr_chunk(req, NULL);   
     httpd_resp_sendstr_chunk(req, NULL);   
+
+#ifdef DEBUG_DETAIL_ON       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_editflow - Done");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_editflow - Done");       
+#endif
 
 
     return ESP_OK;
     return ESP_OK;
 };
 };
@@ -421,9 +468,11 @@ esp_err_t handler_editflow(httpd_req_t *req)
 
 
 esp_err_t handler_prevalue(httpd_req_t *req)
 esp_err_t handler_prevalue(httpd_req_t *req)
 {
 {
+#ifdef DEBUG_DETAIL_ON       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_prevalue - Start");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_prevalue - Start");       
-
     LogFile.WriteToFile("handler_prevalue"); 
     LogFile.WriteToFile("handler_prevalue"); 
+#endif
+
     const char* resp_str;
     const char* resp_str;
     string zw;
     string zw;
 
 
@@ -437,7 +486,9 @@ esp_err_t handler_prevalue(httpd_req_t *req)
 //        printf("Query: "); printf(_query); printf("\n");
 //        printf("Query: "); printf(_query); printf("\n");
         if (httpd_query_key_value(_query, "value", _size, 10) == ESP_OK)
         if (httpd_query_key_value(_query, "value", _size, 10) == ESP_OK)
         {
         {
+#ifdef DEBUG_DETAIL_ON       
             printf("Value: "); printf(_size); printf("\n"); 
             printf("Value: "); printf(_size); printf("\n"); 
+#endif
         }
         }
     }           
     }           
 
 
@@ -452,7 +503,9 @@ esp_err_t handler_prevalue(httpd_req_t *req)
     /* Respond with an empty chunk to signal HTTP response completion */
     /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_send_chunk(req, NULL, 0);      
     httpd_resp_send_chunk(req, NULL, 0);      
 
 
+#ifdef DEBUG_DETAIL_ON       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_prevalue - Start");       
     if (debug_detail_heap) LogFile.WriteHeapInfo("handler_prevalue - Start");       
+#endif
 
 
     return ESP_OK;
     return ESP_OK;
 };
 };
@@ -481,14 +534,20 @@ void task_autodoFlow(void *pvParameter)
 
 
         if (flowisrunning)
         if (flowisrunning)
         {
         {
+#ifdef DEBUG_DETAIL_ON       
             printf("Autoflow: doFLow laeuft bereits!\n");
             printf("Autoflow: doFLow laeuft bereits!\n");
+#endif
         }
         }
         else
         else
         {
         {
+#ifdef DEBUG_DETAIL_ON       
             printf("Autoflow: doFLow wird gestartet\n");
             printf("Autoflow: doFLow wird gestartet\n");
+#endif
             flowisrunning = true;
             flowisrunning = true;
             doflow();
             doflow();
+#ifdef DEBUG_DETAIL_ON       
             printf("Remove older log files\n");
             printf("Remove older log files\n");
+#endif
             LogFile.RemoveOld();
             LogFile.RemoveOld();
         }
         }
         
         
@@ -548,5 +607,4 @@ void register_server_tflite_uri(httpd_handle_t server)
     camuri.handler   = handler_wasserzaehler;
     camuri.handler   = handler_wasserzaehler;
     camuri.user_ctx  = (void*) "Wasserzaehler"; 
     camuri.user_ctx  = (void*) "Wasserzaehler"; 
     httpd_register_uri_handler(server, &camuri);  
     httpd_register_uri_handler(server, &camuri);  
-
 }
 }

+ 2 - 0
code/main/main.cpp

@@ -25,6 +25,7 @@
 #include "ClassControllCamera.h"
 #include "ClassControllCamera.h"
 #include "server_main.h"
 #include "server_main.h"
 #include "server_camera.h"
 #include "server_camera.h"
+#include "server_GPIO.h"
 
 
 static const char *TAGMAIN = "connect_wlan_main";
 static const char *TAGMAIN = "connect_wlan_main";
 
 
@@ -143,6 +144,7 @@ extern "C" void app_main(void)
     register_server_tflite_uri(server);
     register_server_tflite_uri(server);
     register_server_file_uri(server, "/sdcard");
     register_server_file_uri(server, "/sdcard");
     register_server_ota_sdcard_uri(server);
     register_server_ota_sdcard_uri(server);
+    register_server_GPIO_uri(server);
     register_server_main_uri(server, "/sdcard");
     register_server_main_uri(server, "/sdcard");
 
 
     TFliteDoAutoStart();
     TFliteDoAutoStart();

+ 2 - 2
code/main/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="becb886";
+const char* GIT_REV="ae11698";
 const char* GIT_TAG="";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2020-12-30 10:10";
+const char* BUILD_TIME="2020-12-31 11:13";

+ 1 - 0
code/platformio.ini

@@ -39,6 +39,7 @@ lib_deps =
   jomjol_time_sntp 
   jomjol_time_sntp 
   jomjol_logfile 
   jomjol_logfile 
   jomjol_mqtt
   jomjol_mqtt
+  jomjol_controlGPIO
 
 
 monitor_speed = 115200
 monitor_speed = 115200
 
 

+ 89 - 1
code/sdkconfig

@@ -173,7 +173,95 @@ CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
 CONFIG_BT_RESERVE_DRAM=0
 CONFIG_BT_RESERVE_DRAM=0
 # end of Bluetooth
 # end of Bluetooth
 
 
-# CONFIG_BLE_MESH is not set
+CONFIG_BLE_MESH=y
+CONFIG_BLE_MESH_HCI_5_0=y
+# CONFIG_BLE_MESH_ALLOC_FROM_PSRAM_FIRST is not set
+# CONFIG_BLE_MESH_FAST_PROV is not set
+# CONFIG_BLE_MESH_NODE is not set
+# CONFIG_BLE_MESH_PROVISIONER is not set
+CONFIG_BLE_MESH_PROV=y
+CONFIG_BLE_MESH_PB_ADV=y
+# CONFIG_BLE_MESH_PB_GATT is not set
+CONFIG_BLE_MESH_PROXY=y
+# CONFIG_BLE_MESH_GATT_PROXY_CLIENT is not set
+CONFIG_BLE_MESH_NET_BUF_POOL_USAGE=y
+# CONFIG_BLE_MESH_SETTINGS is not set
+CONFIG_BLE_MESH_SUBNET_COUNT=3
+CONFIG_BLE_MESH_APP_KEY_COUNT=3
+CONFIG_BLE_MESH_MODEL_KEY_COUNT=3
+CONFIG_BLE_MESH_MODEL_GROUP_COUNT=3
+CONFIG_BLE_MESH_LABEL_COUNT=3
+CONFIG_BLE_MESH_CRPL=10
+CONFIG_BLE_MESH_MSG_CACHE_SIZE=10
+CONFIG_BLE_MESH_ADV_BUF_COUNT=60
+# CONFIG_BLE_MESH_SUPPORT_BLE_ADV is not set
+CONFIG_BLE_MESH_IVU_DIVIDER=4
+CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=1
+CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=1
+CONFIG_BLE_MESH_RX_SDU_MAX=384
+CONFIG_BLE_MESH_TX_SEG_MAX=32
+# CONFIG_BLE_MESH_FRIEND is not set
+# CONFIG_BLE_MESH_NO_LOG is not set
+
+#
+# BLE Mesh STACK DEBUG LOG LEVEL
+#
+# CONFIG_BLE_MESH_TRACE_LEVEL_NONE is not set
+# CONFIG_BLE_MESH_TRACE_LEVEL_ERROR is not set
+CONFIG_BLE_MESH_TRACE_LEVEL_WARNING=y
+# CONFIG_BLE_MESH_TRACE_LEVEL_INFO is not set
+# CONFIG_BLE_MESH_TRACE_LEVEL_DEBUG is not set
+# CONFIG_BLE_MESH_TRACE_LEVEL_VERBOSE is not set
+CONFIG_BLE_MESH_STACK_TRACE_LEVEL=2
+# end of BLE Mesh STACK DEBUG LOG LEVEL
+
+#
+# BLE Mesh NET BUF DEBUG LOG LEVEL
+#
+# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_NONE is not set
+# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_ERROR is not set
+CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_WARNING=y
+# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_INFO is not set
+# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_DEBUG is not set
+# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_VERBOSE is not set
+CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL=2
+# end of BLE Mesh NET BUF DEBUG LOG LEVEL
+
+CONFIG_BLE_MESH_CLIENT_MSG_TIMEOUT=4000
+
+#
+# Support for BLE Mesh Client Models
+#
+# CONFIG_BLE_MESH_CFG_CLI is not set
+# CONFIG_BLE_MESH_HEALTH_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_ONOFF_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_LEVEL_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_POWER_ONOFF_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_POWER_LEVEL_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_BATTERY_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_LOCATION_CLI is not set
+# CONFIG_BLE_MESH_GENERIC_PROPERTY_CLI is not set
+# CONFIG_BLE_MESH_SENSOR_CLI is not set
+# CONFIG_BLE_MESH_TIME_CLI is not set
+# CONFIG_BLE_MESH_SCENE_CLI is not set
+# CONFIG_BLE_MESH_SCHEDULER_CLI is not set
+# CONFIG_BLE_MESH_LIGHT_LIGHTNESS_CLI is not set
+# CONFIG_BLE_MESH_LIGHT_CTL_CLI is not set
+# CONFIG_BLE_MESH_LIGHT_HSL_CLI is not set
+# CONFIG_BLE_MESH_LIGHT_XYL_CLI is not set
+# CONFIG_BLE_MESH_LIGHT_LC_CLI is not set
+# end of Support for BLE Mesh Client Models
+
+# CONFIG_BLE_MESH_IV_UPDATE_TEST is not set
+
+#
+# BLE Mesh specific test option
+#
+# CONFIG_BLE_MESH_SELF_TEST is not set
+# CONFIG_BLE_MESH_SHELL is not set
+# CONFIG_BLE_MESH_DEBUG is not set
+# end of BLE Mesh specific test option
 
 
 #
 #
 # CoAP Configuration
 # CoAP Configuration

+ 2 - 2
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="becb886";
+const char* GIT_REV="ae11698";
 const char* GIT_TAG="";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2020-12-30 10:10";
+const char* BUILD_TIME="2020-12-31 11:13";

BIN
firmware/bootloader.bin


BIN
firmware/firmware.bin