mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
.
This commit is contained in:
@@ -249,7 +249,7 @@ void CCamera::SetQualitySize(int qual, framesize_t resol)
|
|||||||
|
|
||||||
void CCamera::EnableAutoExposure(int flashdauer)
|
void CCamera::EnableAutoExposure(int flashdauer)
|
||||||
{
|
{
|
||||||
printf("EnableAutoExposure");
|
ESP_LOGD(TAGCAMERACLASS, "EnableAutoExposure");
|
||||||
LEDOnOff(true);
|
LEDOnOff(true);
|
||||||
if (flashdauer > 0)
|
if (flashdauer > 0)
|
||||||
LightOnOff(true);
|
LightOnOff(true);
|
||||||
@@ -423,19 +423,19 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
|
|||||||
LEDOnOff(false);
|
LEDOnOff(false);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("w %d, h %d, size %d\n", fb->width, fb->height, fb->len);
|
ESP_LOGD(TAGCAMERACLASS, "w %d, h %d, size %d", fb->width, fb->height, fb->len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nm = FormatFileName(nm);
|
nm = FormatFileName(nm);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Save Camera to : %s\n", nm.c_str());
|
ESP_LOGD(TAGCAMERACLASS, "Save Camera to : %s", nm.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ftype = toUpper(getFileType(nm));
|
ftype = toUpper(getFileType(nm));
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Filetype: %s\n", ftype.c_str());
|
ESP_LOGD(TAGCAMERACLASS, "Filetype: %s", ftype.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t * buf = NULL;
|
uint8_t * buf = NULL;
|
||||||
@@ -551,20 +551,20 @@ void CCamera::LightOnOff(bool status)
|
|||||||
{
|
{
|
||||||
GpioHandler* gpioHandler = gpio_handler_get();
|
GpioHandler* gpioHandler = gpio_handler_get();
|
||||||
if ((gpioHandler != NULL) && (gpioHandler->isEnabled())) {
|
if ((gpioHandler != NULL) && (gpioHandler->isEnabled())) {
|
||||||
printf("Use gpioHandler flashLigh\n");
|
ESP_LOGD(TAGCAMERACLASS, "Use gpioHandler flashLigh");
|
||||||
gpioHandler->flashLightEnable(status);
|
gpioHandler->flashLightEnable(status);
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_PWM_LEDFLASH
|
#ifdef USE_PWM_LEDFLASH
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
printf("Internal Flash-LED turn on with PWM %d\n", led_intensity);
|
ESP_LOGD(TAGCAMERACLASS, "Internal Flash-LED turn on with PWM %d", led_intensity);
|
||||||
ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, led_intensity));
|
ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, led_intensity));
|
||||||
// Update duty to apply the new value
|
// Update duty to apply the new value
|
||||||
ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Internal Flash-LED turn off PWM\n");
|
ESP_LOGD(TAGCAMERACLASS, "Internal Flash-LED turn off PWM");
|
||||||
ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
||||||
ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
||||||
}
|
}
|
||||||
@@ -608,11 +608,11 @@ void CCamera::GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol
|
|||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
printf("Query: "); printf(_query); printf("\n");
|
ESP_LOGD(TAGCAMERACLASS, "Query: %s", _query);
|
||||||
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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Size: "); printf(_size); printf("\n");
|
ESP_LOGD(TAGCAMERACLASS, "Size: %s", _size);
|
||||||
#endif
|
#endif
|
||||||
if (strcmp(_size, "QVGA") == 0)
|
if (strcmp(_size, "QVGA") == 0)
|
||||||
resol = FRAMESIZE_QVGA; // 320x240
|
resol = FRAMESIZE_QVGA; // 320x240
|
||||||
@@ -630,7 +630,7 @@ 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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Quality: "); printf(_qual); printf("\n");
|
ESP_LOGD(TAGCAMERACLASS, "Quality: %s", _qual);
|
||||||
#endif
|
#endif
|
||||||
qual = atoi(_qual);
|
qual = atoi(_qual);
|
||||||
|
|
||||||
@@ -663,7 +663,7 @@ framesize_t CCamera::TextToFramesize(const char * _size)
|
|||||||
CCamera::CCamera()
|
CCamera::CCamera()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("CreateClassCamera\n");
|
ESP_LOGD(TAGCAMERACLASS, "CreateClassCamera");
|
||||||
#endif
|
#endif
|
||||||
brightness = -5;
|
brightness = -5;
|
||||||
contrast = -5;
|
contrast = -5;
|
||||||
@@ -675,7 +675,7 @@ CCamera::CCamera()
|
|||||||
|
|
||||||
esp_err_t CCamera::InitCam()
|
esp_err_t CCamera::InitCam()
|
||||||
{
|
{
|
||||||
printf("Init Camera\n");
|
ESP_LOGD(TAGCAMERACLASS, "Init Camera");
|
||||||
ActualQuality = camera_config.jpeg_quality;
|
ActualQuality = camera_config.jpeg_quality;
|
||||||
ActualResolution = camera_config.frame_size;
|
ActualResolution = camera_config.frame_size;
|
||||||
//initialize the camera
|
//initialize the camera
|
||||||
@@ -694,6 +694,6 @@ void CCamera::SetLEDIntensity(float _intrel)
|
|||||||
_intrel = max(_intrel, (float) 0);
|
_intrel = max(_intrel, (float) 0);
|
||||||
_intrel = _intrel / 100;
|
_intrel = _intrel / 100;
|
||||||
led_intensity = (int) (_intrel * 8191);
|
led_intensity = (int) (_intrel * 8191);
|
||||||
printf("Set led_intensity to %d of 8191\n", led_intensity);
|
ESP_LOGD(TAGCAMERACLASS, "Set led_intensity to %d of 8191", led_intensity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
#include "ClassControllCamera.h"
|
#include "ClassControllCamera.h"
|
||||||
|
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
static const char *TAG = "server_cam";
|
||||||
|
|
||||||
#define SCRATCH_BUFSIZE2 8192
|
#define SCRATCH_BUFSIZE2 8192
|
||||||
char scratch2[SCRATCH_BUFSIZE2];
|
char scratch2[SCRATCH_BUFSIZE2];
|
||||||
@@ -37,7 +40,7 @@ esp_err_t handler_lightOn(httpd_req_t *req)
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOn - Start");
|
LogFile.WriteHeapInfo("handler_lightOn - Start");
|
||||||
printf("handler_lightOn uri:\n"); printf(req->uri); printf("\n");
|
ESP_LOGD(TAG, "handler_lightOn uri: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Camera.LightOnOff(true);
|
Camera.LightOnOff(true);
|
||||||
@@ -55,7 +58,7 @@ esp_err_t handler_lightOff(httpd_req_t *req)
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOff - Start");
|
LogFile.WriteHeapInfo("handler_lightOff - Start");
|
||||||
printf("handler_lightOff uri:\n"); printf(req->uri); printf("\n");
|
ESP_LOGD(TAG, "handler_lightOff uri: %s", req->uri);
|
||||||
#endif
|
#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;
|
||||||
@@ -80,7 +83,7 @@ esp_err_t handler_capture(httpd_req_t *req)
|
|||||||
Camera.GetCameraParameter(req, quality, res);
|
Camera.GetCameraParameter(req, quality, res);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Size: %d", res); printf(" Quality: %d\n", quality);
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Camera.SetQualitySize(quality, res);
|
Camera.SetQualitySize(quality, res);
|
||||||
@@ -110,11 +113,11 @@ esp_err_t handler_capture_with_ligth(httpd_req_t *req)
|
|||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
printf("Query: "); printf(_query); printf("\n");
|
ESP_LOGD(TAG, "Query: %s", _query);
|
||||||
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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Delay: "); printf(_delay); printf("\n");
|
ESP_LOGD(TAG, "Delay: %s", _delay);
|
||||||
#endif
|
#endif
|
||||||
delay = atoi(_delay);
|
delay = atoi(_delay);
|
||||||
|
|
||||||
@@ -126,7 +129,7 @@ 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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Size: %d", res); printf(" Quality: %d\n", quality);
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Camera.SetQualitySize(quality, res);
|
Camera.SetQualitySize(quality, res);
|
||||||
@@ -166,12 +169,12 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
|||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
printf("Query: "); printf(_query); printf("\n");
|
ESP_LOGD(TAG, "Query: %s", _query);
|
||||||
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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Filename: "); printf(fn.c_str()); printf("\n");
|
ESP_LOGD(TAG, "Filename: %s", fn.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -180,7 +183,7 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
|||||||
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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Delay: "); printf(_delay); printf("\n");
|
ESP_LOGD(TAG, "Delay: %s", _delay);
|
||||||
#endif
|
#endif
|
||||||
delay = atoi(_delay);
|
delay = atoi(_delay);
|
||||||
|
|
||||||
@@ -194,7 +197,7 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
|||||||
|
|
||||||
Camera.GetCameraParameter(req, quality, res);
|
Camera.GetCameraParameter(req, quality, res);
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Size: %d", res); printf(" Quality: %d\n", quality);
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
||||||
#endif
|
#endif
|
||||||
Camera.SetQualitySize(quality, res);
|
Camera.SetQualitySize(quality, res);
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ bool isSetupModusActive() {
|
|||||||
void KillTFliteTasks()
|
void KillTFliteTasks()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Handle: xHandleblink_task_doFlow: %ld\n", (long) xHandleblink_task_doFlow);
|
ESP_LOGD(TAGTFLITE, "Handle: xHandleblink_task_doFlow: %ld", (long) xHandleblink_task_doFlow);
|
||||||
#endif
|
#endif
|
||||||
if (xHandleblink_task_doFlow != NULL)
|
if (xHandleblink_task_doFlow != NULL)
|
||||||
{
|
{
|
||||||
@@ -75,12 +75,12 @@ void KillTFliteTasks()
|
|||||||
xHandleblink_task_doFlow = NULL;
|
xHandleblink_task_doFlow = NULL;
|
||||||
vTaskDelete(xHandleblink_task_doFlowTmp);
|
vTaskDelete(xHandleblink_task_doFlowTmp);
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Killed: xHandleblink_task_doFlow\n");
|
ESP_LOGD(TAGTFLITE, "Killed: xHandleblink_task_doFlow");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Handle: xHandletask_autodoFlow: %ld\n", (long) xHandletask_autodoFlow);
|
ESP_LOGD(TAGTFLITE, "Handle: xHandletask_autodoFlow: %ld", (long) xHandletask_autodoFlow);
|
||||||
#endif
|
#endif
|
||||||
if (xHandletask_autodoFlow != NULL)
|
if (xHandletask_autodoFlow != NULL)
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ void KillTFliteTasks()
|
|||||||
xHandletask_autodoFlow = NULL;
|
xHandletask_autodoFlow = NULL;
|
||||||
vTaskDelete(xHandletask_autodoFlowTmp);
|
vTaskDelete(xHandletask_autodoFlowTmp);
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Killed: xHandletask_autodoFlow\n");
|
ESP_LOGD(TAGTFLITE, "Killed: xHandletask_autodoFlow");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,11 +97,11 @@ void KillTFliteTasks()
|
|||||||
void doInit(void)
|
void doInit(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Start tfliteflow.InitFlow(config);\n");
|
ESP_LOGD(TAGTFLITE, "Start tfliteflow.InitFlow(config);");
|
||||||
#endif
|
#endif
|
||||||
tfliteflow.InitFlow(CONFIG_FILE);
|
tfliteflow.InitFlow(CONFIG_FILE);
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Finished tfliteflow.InitFlow(config);\n");
|
ESP_LOGD(TAGTFLITE, "Finished tfliteflow.InitFlow(config);");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,13 +110,13 @@ bool doflow(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
std::string zw_time = gettimestring(LOGFILE_TIME_FORMAT);
|
std::string zw_time = gettimestring(LOGFILE_TIME_FORMAT);
|
||||||
printf("doflow - start %s\n", zw_time.c_str());
|
ESP_LOGD(TAGTFLITE, "doflow - start %s", zw_time.c_str());
|
||||||
flowisrunning = true;
|
flowisrunning = true;
|
||||||
tfliteflow.doFlow(zw_time);
|
tfliteflow.doFlow(zw_time);
|
||||||
flowisrunning = false;
|
flowisrunning = false;
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("doflow - end %s\n", zw_time.c_str());
|
ESP_LOGD(TAGTFLITE, "doflow - end %s", zw_time.c_str());
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ bool doflow(void)
|
|||||||
void blink_task_doFlow(void *pvParameter)
|
void blink_task_doFlow(void *pvParameter)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("blink_task_doFlow\n");
|
ESP_LOGD(TAGTFLITE, "blink_task_doFlow");
|
||||||
#endif
|
#endif
|
||||||
if (!flowisrunning)
|
if (!flowisrunning)
|
||||||
{
|
{
|
||||||
@@ -141,7 +141,7 @@ esp_err_t handler_init(httpd_req_t *req)
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_init - Start");
|
LogFile.WriteHeapInfo("handler_init - Start");
|
||||||
printf("handler_doinit uri:\n"); printf(req->uri); printf("\n");
|
ESP_LOGD(TAGTFLITE, "handler_doinit uri: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* resp_str = "Init started<br>";
|
const char* resp_str = "Init started<br>";
|
||||||
@@ -167,7 +167,7 @@ esp_err_t handler_doflow(httpd_req_t *req)
|
|||||||
LogFile.WriteHeapInfo("handler_doflow - Start");
|
LogFile.WriteHeapInfo("handler_doflow - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("handler_doFlow uri: "); printf(req->uri); printf("\n");
|
ESP_LOGD(TAGTFLITE, "handler_doFlow uri: %s", req->uri);
|
||||||
|
|
||||||
if (flowisrunning)
|
if (flowisrunning)
|
||||||
{
|
{
|
||||||
@@ -199,7 +199,7 @@ esp_err_t handler_json(httpd_req_t *req)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
printf("handler_JSON uri:\n"); printf(req->uri); printf("\n");
|
ESP_LOGD(TAGTFLITE, "handler_JSON uri: %s", req->uri);
|
||||||
|
|
||||||
char _query[100];
|
char _query[100];
|
||||||
// char _size[10];
|
// char _size[10];
|
||||||
@@ -236,18 +236,18 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
|||||||
std::string _type = "value";
|
std::string _type = "value";
|
||||||
string zw;
|
string zw;
|
||||||
|
|
||||||
printf("handler_wasserzaehler uri:\n"); printf(req->uri); printf("\n");
|
ESP_LOGD(TAGTFLITE, "handler_wasserzaehler uri: %s", req->uri);
|
||||||
|
|
||||||
char _query[100];
|
char _query[100];
|
||||||
char _size[10];
|
char _size[10];
|
||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
// printf("Query: "); printf(_query); printf("\n");
|
// ESP_LOGD(TAGTFLITE, "Query: %s", _query);
|
||||||
if (httpd_query_key_value(_query, "all", _size, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "all", _size, 10) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("all is found"); printf(_size); printf("\n");
|
ESP_LOGD(TAGTFLITE, "all is found%s", _size);
|
||||||
#endif
|
#endif
|
||||||
_all = true;
|
_all = true;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
|||||||
if (httpd_query_key_value(_query, "type", _size, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "type", _size, 10) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("all is found"); printf(_size); printf("\n");
|
ESP_LOGD(TAGTFLITE, "all is found: %s", _size);
|
||||||
#endif
|
#endif
|
||||||
_type = std::string(_size);
|
_type = std::string(_size);
|
||||||
}
|
}
|
||||||
@@ -263,14 +263,14 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
|||||||
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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("rawvalue is found"); printf(_size); printf("\n");
|
ESP_LOGD(TAGTFLITE, "rawvalue is found: %s", _size);
|
||||||
#endif
|
#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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("noerror is found"); printf(_size); printf("\n");
|
ESP_LOGD(TAGTFLITE, "noerror is found: %s", _size);
|
||||||
#endif
|
#endif
|
||||||
_noerror = true;
|
_noerror = true;
|
||||||
}
|
}
|
||||||
@@ -281,7 +281,7 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
|||||||
if (_all)
|
if (_all)
|
||||||
{
|
{
|
||||||
httpd_resp_set_type(req, "text/plain");
|
httpd_resp_set_type(req, "text/plain");
|
||||||
printf("TYPE: %s\n", _type.c_str());
|
ESP_LOGD(TAGTFLITE, "TYPE: %s", _type.c_str());
|
||||||
int _intype = READOUT_TYPE_VALUE;
|
int _intype = READOUT_TYPE_VALUE;
|
||||||
if (_type == "prevalue")
|
if (_type == "prevalue")
|
||||||
_intype = READOUT_TYPE_PREVALUE;
|
_intype = READOUT_TYPE_PREVALUE;
|
||||||
@@ -292,7 +292,7 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
|||||||
|
|
||||||
|
|
||||||
zw = tfliteflow.getReadoutAll(_intype);
|
zw = tfliteflow.getReadoutAll(_intype);
|
||||||
printf("ZW: %s\n", zw.c_str());
|
ESP_LOGD(TAGTFLITE, "ZW: %s", zw.c_str());
|
||||||
if (zw.length() > 0)
|
if (zw.length() > 0)
|
||||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||||
httpd_resp_sendstr_chunk(req, NULL);
|
httpd_resp_sendstr_chunk(req, NULL);
|
||||||
@@ -304,7 +304,7 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
|||||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||||
|
|
||||||
string query = std::string(_query);
|
string query = std::string(_query);
|
||||||
// printf("Query: %s\n", query.c_str());
|
// ESP_LOGD(TAGTFLITE, "Query: %s, query.c_str());
|
||||||
if (query.find("full") != std::string::npos)
|
if (query.find("full") != std::string::npos)
|
||||||
{
|
{
|
||||||
string txt, zw;
|
string txt, zw;
|
||||||
@@ -380,7 +380,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|||||||
LogFile.WriteHeapInfo("handler_editflow - Start");
|
LogFile.WriteHeapInfo("handler_editflow - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("handler_editflow uri: "); printf(req->uri); printf("\n");
|
ESP_LOGD(TAGTFLITE, "handler_editflow uri: %s", req->uri);
|
||||||
|
|
||||||
char _query[200];
|
char _query[200];
|
||||||
char _valuechar[30];
|
char _valuechar[30];
|
||||||
@@ -391,7 +391,7 @@ 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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("task is found: %s\n", _valuechar);
|
ESP_LOGD(TAGTFLITE, "task is found: %s", _valuechar);
|
||||||
#endif
|
#endif
|
||||||
_task = string(_valuechar);
|
_task = string(_valuechar);
|
||||||
}
|
}
|
||||||
@@ -399,7 +399,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|||||||
|
|
||||||
if (_task.compare("tflite") == 0)
|
if (_task.compare("tflite") == 0)
|
||||||
{
|
{
|
||||||
printf("Get tflite list\n");
|
ESP_LOGD(TAGTFLITE, "Get tflite list");
|
||||||
return get_tflite_file_handler(req);
|
return get_tflite_file_handler(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,8 +414,8 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|||||||
out = string(_valuechar);
|
out = string(_valuechar);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("in: "); printf(in.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "in: %s", in.c_str());
|
||||||
printf("out: "); printf(out.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "out: %s", out.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
in = "/sdcard" + in;
|
in = "/sdcard" + in;
|
||||||
@@ -456,12 +456,12 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|||||||
dy = stoi(zw);
|
dy = stoi(zw);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("in: "); printf(in.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "in: %s", in.c_str());
|
||||||
printf("out: "); printf(out.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "out: %s", out.c_str());
|
||||||
printf("x: "); printf(zw.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "x: %s", zw.c_str());
|
||||||
printf("y: "); printf(zw.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "y: %s", zw.c_str());
|
||||||
printf("dx: "); printf(zw.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "dx: %s", zw.c_str());
|
||||||
printf("dy: "); printf(zw.c_str()); printf("\n");
|
ESP_LOGD(TAGTFLITE, "dy: %s", zw.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "enhance", _valuechar, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "enhance", _valuechar, 10) == ESP_OK)
|
||||||
@@ -529,11 +529,11 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// printf("Parameter host: "); printf(_host.c_str()); printf("\n");
|
// ESP_LOGD(TAGTFLITE, "Parameter host: %s", _host.c_str());
|
||||||
// string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
|
// string zwzw = "Do " + _task + " start\n"; ESP_LOGD(TAGTFLITE, zwzw.c_str());
|
||||||
Camera.SetBrightnessContrastSaturation(bri, con, sat);
|
Camera.SetBrightnessContrastSaturation(bri, con, sat);
|
||||||
Camera.SetLEDIntensity(intens);
|
Camera.SetLEDIntensity(intens);
|
||||||
printf("test_take - vor MakeImage");
|
ESP_LOGD(TAGTFLITE, "test_take - vor MakeImage");
|
||||||
std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host);
|
std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host);
|
||||||
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
||||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||||
@@ -546,9 +546,9 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|||||||
if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
|
if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
|
||||||
_host = std::string(_valuechar);
|
_host = std::string(_valuechar);
|
||||||
}
|
}
|
||||||
// printf("Parameter host: "); printf(_host.c_str()); printf("\n");
|
// ESP_LOGD(TAGTFLITE, "Parameter host: %s", _host.c_str());
|
||||||
|
|
||||||
// string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
|
// string zwzw = "Do " + _task + " start\n"; ESP_LOGD(TAGTFLITE, zwzw.c_str());
|
||||||
std::string zw = tfliteflow.doSingleStep("[Alignment]", _host);
|
std::string zw = tfliteflow.doSingleStep("[Alignment]", _host);
|
||||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||||
}
|
}
|
||||||
@@ -573,7 +573,7 @@ esp_err_t handler_statusflow(httpd_req_t *req)
|
|||||||
const char* resp_str;
|
const char* resp_str;
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
|
ESP_LOGD(TAGTFLITE, "handler_prevalue: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
string* zw = tfliteflow.getActStatus();
|
string* zw = tfliteflow.getActStatus();
|
||||||
@@ -651,7 +651,7 @@ esp_err_t handler_prevalue(httpd_req_t *req)
|
|||||||
string zw;
|
string zw;
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
|
ESP_LOGD(TAGTFLITE, "handler_prevalue: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char _query[100];
|
char _query[100];
|
||||||
@@ -661,13 +661,13 @@ esp_err_t handler_prevalue(httpd_req_t *req)
|
|||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Query: "); printf(_query); printf("\n");
|
ESP_LOGD(TAGTFLITE, "Query: %s", _query);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Value: "); printf(_size); printf("\n");
|
ESP_LOGD(TAGTFLITE, "Value: %s", _size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,7 +703,7 @@ void task_autodoFlow(void *pvParameter)
|
|||||||
{
|
{
|
||||||
int64_t fr_start, fr_delta_ms;
|
int64_t fr_start, fr_delta_ms;
|
||||||
|
|
||||||
printf("task_autodoFlow: start\r\n");
|
ESP_LOGD(TAGTFLITE, "task_autodoFlow: start");
|
||||||
doInit();
|
doInit();
|
||||||
gpio_handler_init();
|
gpio_handler_init();
|
||||||
|
|
||||||
@@ -718,24 +718,24 @@ void task_autodoFlow(void *pvParameter)
|
|||||||
{
|
{
|
||||||
std::string _zw = "task_autodoFlow - next round - Round #" + std::to_string(++countRounds);
|
std::string _zw = "task_autodoFlow - next round - Round #" + std::to_string(++countRounds);
|
||||||
LogFile.WriteToFile(_zw);
|
LogFile.WriteToFile(_zw);
|
||||||
printf("Autoflow: start\n");
|
ESP_LOGD(TAGTFLITE, "Autoflow: start");
|
||||||
fr_start = esp_timer_get_time();
|
fr_start = esp_timer_get_time();
|
||||||
|
|
||||||
if (flowisrunning)
|
if (flowisrunning)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Autoflow: doFlow is already running!\n");
|
ESP_LOGD(TAGTFLITE, "Autoflow: doFlow is already running!");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Autoflow: doFlow is started\n");
|
ESP_LOGD(TAGTFLITE, "Autoflow: doFlow is started");
|
||||||
#endif
|
#endif
|
||||||
flowisrunning = true;
|
flowisrunning = true;
|
||||||
doflow();
|
doflow();
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Remove older log files\n");
|
ESP_LOGD(TAGTFLITE, "Remove older log files");
|
||||||
#endif
|
#endif
|
||||||
LogFile.RemoveOld();
|
LogFile.RemoveOld();
|
||||||
}
|
}
|
||||||
@@ -747,18 +747,18 @@ void task_autodoFlow(void *pvParameter)
|
|||||||
stream << std::fixed << std::setprecision(1) << cputmp;
|
stream << std::fixed << std::setprecision(1) << cputmp;
|
||||||
string zwtemp = "CPU Temperature: " + stream.str();
|
string zwtemp = "CPU Temperature: " + stream.str();
|
||||||
LogFile.WriteToFile(zwtemp);
|
LogFile.WriteToFile(zwtemp);
|
||||||
printf("CPU Temperature: %.2f\n", cputmp);
|
ESP_LOGD(TAGTFLITE, "CPU Temperature: %.2f", cputmp);
|
||||||
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
|
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
|
||||||
if (auto_intervall > fr_delta_ms)
|
if (auto_intervall > fr_delta_ms)
|
||||||
{
|
{
|
||||||
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
|
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
|
||||||
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
|
ESP_LOGD(TAGTFLITE, "Autoflow: sleep for : %ldms", (long) xDelay);
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
||||||
xHandletask_autodoFlow = NULL;
|
xHandletask_autodoFlow = NULL;
|
||||||
printf("task_autodoFlow: end\r\n");
|
ESP_LOGD(TAGTFLITE, "task_autodoFlow: end");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFliteDoAutoStart()
|
void TFliteDoAutoStart()
|
||||||
@@ -767,17 +767,17 @@ void TFliteDoAutoStart()
|
|||||||
|
|
||||||
int _i = configMINIMAL_STACK_SIZE;
|
int _i = configMINIMAL_STACK_SIZE;
|
||||||
|
|
||||||
printf("task_autodoFlow configMINIMAL_STACK_SIZE: %d\n", _i);
|
ESP_LOGD(TAGTFLITE, "task_autodoFlow configMINIMAL_STACK_SIZE: %d", _i);
|
||||||
printf("getESPHeapInfo: %s\n", getESPHeapInfo().c_str());
|
ESP_LOGD(TAGTFLITE, "getESPHeapInfo: %s", getESPHeapInfo().c_str());
|
||||||
|
|
||||||
xReturned = xTaskCreate(&task_autodoFlow, "task_autodoFlow", configMINIMAL_STACK_SIZE * 35, NULL, tskIDLE_PRIORITY+1, &xHandletask_autodoFlow);
|
xReturned = xTaskCreate(&task_autodoFlow, "task_autodoFlow", configMINIMAL_STACK_SIZE * 35, NULL, tskIDLE_PRIORITY+1, &xHandletask_autodoFlow);
|
||||||
if( xReturned != pdPASS )
|
if( xReturned != pdPASS )
|
||||||
{
|
{
|
||||||
|
|
||||||
//Memory: 64 --> 48 --> 35 --> 25
|
//Memory: 64 --> 48 --> 35 --> 25
|
||||||
printf("ERROR task_autodoFlow konnte nicht erzeugt werden !!\r\n");
|
ESP_LOGD(TAGTFLITE, "ERROR task_autodoFlow konnte nicht erzeugt werden!");
|
||||||
}
|
}
|
||||||
printf("getESPHeapInfo: %s\n", getESPHeapInfo().c_str());
|
ESP_LOGD(TAGTFLITE, "getESPHeapInfo: %s", getESPHeapInfo().c_str());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,14 +78,14 @@ void setup_time()
|
|||||||
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
||||||
|
|
||||||
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||||
printf("timeist %s\n", zw.c_str());
|
ESP_LOGD(TAG, "timeist %s", zw.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTimeZone(std::string _tzstring)
|
void setTimeZone(std::string _tzstring)
|
||||||
{
|
{
|
||||||
setenv("TZ", _tzstring.c_str(), 1);
|
setenv("TZ", _tzstring.c_str(), 1);
|
||||||
tzset();
|
tzset();
|
||||||
printf("TimeZone set to %s\n", _tzstring.c_str());
|
ESP_LOGD(TAG, "TimeZone set to %s", _tzstring.c_str());
|
||||||
_tzstring = "Time zone set to " + _tzstring;
|
_tzstring = "Time zone set to " + _tzstring;
|
||||||
LogFile.WriteToFile(_tzstring);
|
LogFile.WriteToFile(_tzstring);
|
||||||
}
|
}
|
||||||
@@ -109,14 +109,14 @@ static void obtain_time(void)
|
|||||||
|
|
||||||
void reset_servername(std::string _servername)
|
void reset_servername(std::string _servername)
|
||||||
{
|
{
|
||||||
printf("Set SNTP-Server: %s\n", _servername.c_str());
|
ESP_LOGD(TAG, "Set SNTP-Server: %s", _servername.c_str());
|
||||||
sntp_stop();
|
sntp_stop();
|
||||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||||
sntp_setservername(0, _servername.c_str());
|
sntp_setservername(0, _servername.c_str());
|
||||||
sntp_init();
|
sntp_init();
|
||||||
obtain_time();
|
obtain_time();
|
||||||
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||||
printf("Time ist %s\n", zw.c_str());
|
ESP_LOGD(TAG, "Time ist %s", zw.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initialize_sntp(void)
|
static void initialize_sntp(void)
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
static const char *TAG = "read_wlanini";
|
||||||
|
|
||||||
std::vector<string> ZerlegeZeileWLAN(std::string input, std::string _delimiter = "")
|
std::vector<string> ZerlegeZeileWLAN(std::string input, std::string _delimiter = "")
|
||||||
{
|
{
|
||||||
@@ -55,7 +57,7 @@ void LoadWlanFromFile(std::string fn, char *&_ssid, char *&_password, char *&_ho
|
|||||||
fn = FormatFileName(fn);
|
fn = FormatFileName(fn);
|
||||||
|
|
||||||
pFile = OpenFileAndWait(fn.c_str(), "r");
|
pFile = OpenFileAndWait(fn.c_str(), "r");
|
||||||
printf("file loaded\n");
|
ESP_LOGD(TAG, "file loaded");
|
||||||
|
|
||||||
if (pFile == NULL)
|
if (pFile == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -66,7 +68,7 @@ void LoadWlanFromFile(std::string fn, char *&_ssid, char *&_password, char *&_ho
|
|||||||
|
|
||||||
while ((line.size() > 0) || !(feof(pFile)))
|
while ((line.size() > 0) || !(feof(pFile)))
|
||||||
{
|
{
|
||||||
// printf("%s", line.c_str());
|
// ESP_LOGD(TAG, "%s", line.c_str());
|
||||||
zerlegt = ZerlegeZeileWLAN(line, "=");
|
zerlegt = ZerlegeZeileWLAN(line, "=");
|
||||||
zerlegt[0] = trim(zerlegt[0], " ");
|
zerlegt[0] = trim(zerlegt[0], " ");
|
||||||
|
|
||||||
@@ -198,7 +200,7 @@ bool ChangeHostName(std::string fn, std::string _newhostname)
|
|||||||
fn = FormatFileName(fn);
|
fn = FormatFileName(fn);
|
||||||
pFile = OpenFileAndWait(fn.c_str(), "r");
|
pFile = OpenFileAndWait(fn.c_str(), "r");
|
||||||
|
|
||||||
printf("file loaded\n");
|
ESP_LOGD(TAG, "file loaded\n");
|
||||||
|
|
||||||
if (pFile == NULL)
|
if (pFile == NULL)
|
||||||
return false;
|
return false;
|
||||||
@@ -248,7 +250,7 @@ bool ChangeHostName(std::string fn, std::string _newhostname)
|
|||||||
|
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
|
|
||||||
printf("*** Hostname update done ***\n");
|
ESP_LOGD(TAG, "*** Hostname update done ***");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ void task_NoSDBlink(void *pvParameter)
|
|||||||
|
|
||||||
TickType_t xDelay;
|
TickType_t xDelay;
|
||||||
xDelay = 100 / portTICK_PERIOD_MS;
|
xDelay = 100 / portTICK_PERIOD_MS;
|
||||||
printf("SD-Card could not be inialized - STOP THE PROGRAMM HERE\n");
|
ESP_LOGD(TAGMAIN, "SD-Card could not be inialized - STOP THE PROGRAMM HERE");
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -146,15 +146,15 @@ extern "C" void app_main(void)
|
|||||||
string versionFormated = "Branch: '" + std::string(GIT_BRANCH) + "', Tag: '" + std::string(GIT_TAG) + \
|
string versionFormated = "Branch: '" + std::string(GIT_BRANCH) + "', Tag: '" + std::string(GIT_TAG) + \
|
||||||
"', Revision: " + std::string(GIT_REV) +", Date/Time: " + std::string(BUILD_TIME);
|
"', Revision: " + std::string(GIT_REV) +", Date/Time: " + std::string(BUILD_TIME);
|
||||||
|
|
||||||
printf("=============================================================================================\n");
|
ESP_LOGD(TAGMAIN, "=============================================================================================");
|
||||||
printf("%s\n", versionFormated.c_str());
|
ESP_LOGD(TAGMAIN, "%s", versionFormated.c_str());
|
||||||
printf("=============================================================================================\n");
|
ESP_LOGD(TAGMAIN, "=============================================================================================");
|
||||||
|
|
||||||
PowerResetCamera();
|
PowerResetCamera();
|
||||||
esp_err_t cam = Camera.InitCam();
|
esp_err_t cam = Camera.InitCam();
|
||||||
Camera.LightOnOff(false);
|
Camera.LightOnOff(false);
|
||||||
xDelay = 2000 / portTICK_PERIOD_MS;
|
xDelay = 2000 / portTICK_PERIOD_MS;
|
||||||
printf("After camera initialization: sleep for : %ldms\n", (long) xDelay);
|
ESP_LOGD(TAGMAIN, "After camera initialization: sleep for : %ldms", (long) xDelay);
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
|
|
||||||
|
|
||||||
@@ -171,30 +171,30 @@ extern "C" void app_main(void)
|
|||||||
|
|
||||||
if (ssid != NULL && passwd != NULL)
|
if (ssid != NULL && passwd != NULL)
|
||||||
#ifdef __HIDE_PASSWORD
|
#ifdef __HIDE_PASSWORD
|
||||||
printf("\nWLan: %s, XXXXXX\n", ssid);
|
ESP_LOGD(TAGMAIN, "WLan: %s, XXXXXX", ssid);
|
||||||
#else
|
#else
|
||||||
printf("\nWLan: %s, %s\n", ssid, passwd);
|
ESP_LOGD(TAGMAIN, "WLan: %s, %s", ssid, passwd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else
|
else
|
||||||
printf("No SSID and PASSWORD set!!!");
|
ESP_LOGD(TAGMAIN, "No SSID and PASSWORD set!!!");
|
||||||
|
|
||||||
if (hostname != NULL)
|
if (hostname != NULL)
|
||||||
printf("Hostename: %s\n", hostname);
|
ESP_LOGD(TAGMAIN, "Hostename: %s", hostname);
|
||||||
else
|
else
|
||||||
printf("Hostname not set.\n");
|
ESP_LOGD(TAGMAIN, "Hostname not set");
|
||||||
|
|
||||||
if (ip != NULL && gateway != NULL && netmask != NULL)
|
if (ip != NULL && gateway != NULL && netmask != NULL)
|
||||||
printf("Fixed IP: %s, Gateway %s, Netmask %s\n", ip, gateway, netmask);
|
ESP_LOGD(TAGMAIN, "Fixed IP: %s, Gateway %s, Netmask %s", ip, gateway, netmask);
|
||||||
if (dns != NULL)
|
if (dns != NULL)
|
||||||
printf("DNS IP: %s\n", dns);
|
ESP_LOGD(TAGMAIN, "DNS IP: %s", dns);
|
||||||
|
|
||||||
|
|
||||||
wifi_init_sta(ssid, passwd, hostname, ip, gateway, netmask, dns);
|
wifi_init_sta(ssid, passwd, hostname, ip, gateway, netmask, dns);
|
||||||
|
|
||||||
|
|
||||||
xDelay = 2000 / portTICK_PERIOD_MS;
|
xDelay = 2000 / portTICK_PERIOD_MS;
|
||||||
printf("main: sleep for : %ldms\n", (long) xDelay);
|
ESP_LOGD(TAGMAIN, "main: sleep for : %ldms", (long) xDelay);
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
setup_time();
|
setup_time();
|
||||||
setBootTime();
|
setBootTime();
|
||||||
@@ -205,14 +205,14 @@ extern "C" void app_main(void)
|
|||||||
LogFile.SwitchOnOff(false);
|
LogFile.SwitchOnOff(false);
|
||||||
|
|
||||||
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||||
printf("time %s\n", zw.c_str());
|
ESP_LOGD(TAGMAIN, "time %s", zw.c_str());
|
||||||
|
|
||||||
size_t _hsize = getESPHeapSize();
|
size_t _hsize = getESPHeapSize();
|
||||||
if (_hsize < 4000000)
|
if (_hsize < 4000000)
|
||||||
{
|
{
|
||||||
std::string _zws = "Not enough PSRAM available. Expected 4.194.304 MByte - available: " + std::to_string(_hsize);
|
std::string _zws = "Not enough PSRAM available. Expected 4.194.304 MByte - available: " + std::to_string(_hsize);
|
||||||
_zws = _zws + "\nEither not initialzed, too small (2MByte only) or not present at all. Firmware cannot start!!";
|
_zws = _zws + "\nEither not initialzed, too small (2MByte only) or not present at all. Firmware cannot start!!";
|
||||||
printf(_zws.c_str());
|
ESP_LOGD(TAGMAIN, "%s", _zws.c_str());
|
||||||
LogFile.SwitchOnOff(true);
|
LogFile.SwitchOnOff(true);
|
||||||
LogFile.WriteToFile(_zws);
|
LogFile.WriteToFile(_zws);
|
||||||
LogFile.SwitchOnOff(false);
|
LogFile.SwitchOnOff(false);
|
||||||
@@ -243,10 +243,10 @@ extern "C" void app_main(void)
|
|||||||
|
|
||||||
|
|
||||||
xDelay = 2000 / portTICK_PERIOD_MS;
|
xDelay = 2000 / portTICK_PERIOD_MS;
|
||||||
printf("main: sleep for : %ldms\n", (long) xDelay*10);
|
ESP_LOGD(TAGMAIN, "main: sleep for : %ldms", (long) xDelay*10);
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
|
|
||||||
printf("starting server\n");
|
ESP_LOGD(TAGMAIN, "starting server");
|
||||||
|
|
||||||
server = start_webserver();
|
server = start_webserver();
|
||||||
register_server_camera_uri(server);
|
register_server_camera_uri(server);
|
||||||
@@ -256,10 +256,10 @@ extern "C" void app_main(void)
|
|||||||
|
|
||||||
gpio_handler_create(server);
|
gpio_handler_create(server);
|
||||||
|
|
||||||
printf("vor reg server main\n");
|
ESP_LOGD(TAGMAIN, "vor reg server main");
|
||||||
register_server_main_uri(server, "/sdcard");
|
register_server_main_uri(server, "/sdcard");
|
||||||
|
|
||||||
printf("vor dotautostart\n");
|
ESP_LOGD(TAGMAIN, "vor dotautostart");
|
||||||
TFliteDoAutoStart();
|
TFliteDoAutoStart();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "test_flow_postrocess_helper.h"
|
#include "test_flow_postrocess_helper.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
static const char *TAG_POSTPROC_HELPER = "test_flow_postproc_helper";
|
static const char *TAG = "test_flow_postproc_helper";
|
||||||
|
|
||||||
UnderTestPost* setUpClassFlowPostprocessing(t_CNNType digType, t_CNNType anaType)
|
UnderTestPost* setUpClassFlowPostprocessing(t_CNNType digType, t_CNNType anaType)
|
||||||
{
|
{
|
||||||
@@ -38,7 +38,7 @@ std::string process_doFlow(std::vector<float> analog, std::vector<float> digits,
|
|||||||
bool checkConsistency, bool extendedResolution, int decimal_shift) {
|
bool checkConsistency, bool extendedResolution, int decimal_shift) {
|
||||||
// setup the classundertest
|
// setup the classundertest
|
||||||
UnderTestPost* _undertestPost = init_do_flow(analog, digits, digType, checkConsistency, extendedResolution, decimal_shift);
|
UnderTestPost* _undertestPost = init_do_flow(analog, digits, digType, checkConsistency, extendedResolution, decimal_shift);
|
||||||
ESP_LOGD(TAG_POSTPROC_HELPER, "SetupClassFlowPostprocessing completed.");
|
ESP_LOGD(TAG, "SetupClassFlowPostprocessing completed.");
|
||||||
|
|
||||||
string time;
|
string time;
|
||||||
// run test
|
// run test
|
||||||
@@ -83,7 +83,7 @@ UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits
|
|||||||
gen_analog->ROI.push_back(anaROI);
|
gen_analog->ROI.push_back(anaROI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ESP_LOGD(TAG_POSTPROC_HELPER, "Setting up of ROIs completed.");
|
ESP_LOGD(TAG, "Setting up of ROIs completed.");
|
||||||
|
|
||||||
_undertestPost->InitNUMBERS();
|
_undertestPost->InitNUMBERS();
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits
|
|||||||
|
|
||||||
void setPreValue(UnderTestPost* _underTestPost, double _preValue) {
|
void setPreValue(UnderTestPost* _underTestPost, double _preValue) {
|
||||||
if (_preValue>0) {
|
if (_preValue>0) {
|
||||||
ESP_LOGD(TAG_POSTPROC_HELPER, "preValue=%f", _preValue);
|
ESP_LOGD(TAG, "preValue=%f", _preValue);
|
||||||
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
||||||
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
||||||
(*NUMBERS)[_n]->PreValue = _preValue;
|
(*NUMBERS)[_n]->PreValue = _preValue;
|
||||||
@@ -106,7 +106,7 @@ void setPreValue(UnderTestPost* _underTestPost, double _preValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setAllowNegatives(UnderTestPost* _underTestPost, bool _allowNegatives) {
|
void setAllowNegatives(UnderTestPost* _underTestPost, bool _allowNegatives) {
|
||||||
ESP_LOGD(TAG_POSTPROC_HELPER, "checkConsistency=true");
|
ESP_LOGD(TAG, "checkConsistency=true");
|
||||||
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
||||||
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
||||||
(*NUMBERS)[_n]->AllowNegativeRates = _allowNegatives;
|
(*NUMBERS)[_n]->AllowNegativeRates = _allowNegatives;
|
||||||
@@ -116,7 +116,7 @@ void setAllowNegatives(UnderTestPost* _underTestPost, bool _allowNegatives) {
|
|||||||
|
|
||||||
void setConsitencyCheck(UnderTestPost* _underTestPost, bool _checkConsistency) {
|
void setConsitencyCheck(UnderTestPost* _underTestPost, bool _checkConsistency) {
|
||||||
if (_checkConsistency) {
|
if (_checkConsistency) {
|
||||||
ESP_LOGD(TAG_POSTPROC_HELPER, "checkConsistency=true");
|
ESP_LOGD(TAG, "checkConsistency=true");
|
||||||
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
||||||
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
||||||
(*NUMBERS)[_n]->checkDigitIncreaseConsistency = true;
|
(*NUMBERS)[_n]->checkDigitIncreaseConsistency = true;
|
||||||
@@ -138,7 +138,7 @@ void setDecimalShift(UnderTestPost* _underTestPost, int _decimal_shift) {
|
|||||||
if (_decimal_shift!=0) {
|
if (_decimal_shift!=0) {
|
||||||
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
||||||
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
||||||
ESP_LOGD(TAG_POSTPROC_HELPER, "Setting decimal shift on number: %d to %d", _n, _decimal_shift);
|
ESP_LOGD(TAG, "Setting decimal shift on number: %d to %d", _n, _decimal_shift);
|
||||||
(*NUMBERS)[_n]->DecimalShift = _decimal_shift;
|
(*NUMBERS)[_n]->DecimalShift = _decimal_shift;
|
||||||
(*NUMBERS)[_n]->DecimalShiftInitial = _decimal_shift;
|
(*NUMBERS)[_n]->DecimalShiftInitial = _decimal_shift;
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analog
|
|||||||
if (_analogdigitTransistionStart!=0) {
|
if (_analogdigitTransistionStart!=0) {
|
||||||
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
||||||
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
||||||
ESP_LOGD(TAG_POSTPROC_HELPER, "Setting decimal shift on number: %d to %f", _n, _analogdigitTransistionStart);
|
ESP_LOGD(TAG, "Setting decimal shift on number: %d to %f", _n, _analogdigitTransistionStart);
|
||||||
(*NUMBERS)[_n]->AnalogDigitalTransitionStart = _analogdigitTransistionStart;
|
(*NUMBERS)[_n]->AnalogDigitalTransitionStart = _analogdigitTransistionStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user