diff --git a/code/main/server_main.cpp b/code/main/server_main.cpp index 7d24f2b0..d60b2aa1 100644 --- a/code/main/server_main.cpp +++ b/code/main/server_main.cpp @@ -14,6 +14,8 @@ #include "esp_wifi.h" #include "server_tflite.h" +#include "esp_log.h" + //#define DEBUG_DETAIL_ON @@ -38,11 +40,11 @@ esp_err_t info_get_handler(httpd_req_t *req) if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK) { - printf("Query: "); printf(_query); printf("\n"); + ESP_LOGD(TAG_SERVERMAIN, "Query: %s", _query); if (httpd_query_key_value(_query, "type", _valuechar, 30) == ESP_OK) { - printf("type is found"); printf(_valuechar); printf("\n"); + ESP_LOGD(TAG_SERVERMAIN, "type is found: %s", _valuechar); _task = std::string(_valuechar); } }; @@ -153,7 +155,7 @@ esp_err_t hello_main_handler(httpd_req_t *req) #endif char filepath[50]; - printf("uri: %s\n", req->uri); + ESP_LOGD(TAG_SERVERMAIN, "uri: %s\n", req->uri); int _pos; esp_err_t res; @@ -162,7 +164,7 @@ esp_err_t hello_main_handler(httpd_req_t *req) const char *filename = get_path_from_uri(filepath, base_path, req->uri - 1, sizeof(filepath)); - printf("1 uri: %s, filename: %s, filepath: %s\n", req->uri, filename, filepath); + ESP_LOGD(TAG_SERVERMAIN, "1 uri: %s, filename: %s, filepath: %s", req->uri, filename, filepath); if ((strcmp(req->uri, "/") == 0)) { @@ -180,13 +182,13 @@ esp_err_t hello_main_handler(httpd_req_t *req) } if (filetosend == "/sdcard/html/index.html" && isSetupModusActive()) { - printf("System is in setup mode --> index.html --> setup.html"); + ESP_LOGD(TAG_SERVERMAIN, "System is in setup mode --> index.html --> setup.html"); filetosend = "/sdcard/html/setup.html"; } - printf("Filename: %s\n", filename); + ESP_LOGD(TAG_SERVERMAIN, "Filename: %s", filename); - printf("File requested: %s\n", filetosend.c_str()); + ESP_LOGD(TAG_SERVERMAIN, "File requested: %s", filetosend.c_str()); if (!filename) { ESP_LOGE(TAG_SERVERMAIN, "Filename is too long"); @@ -216,17 +218,17 @@ esp_err_t hello_main_handler(httpd_req_t *req) esp_err_t img_tmp_handler(httpd_req_t *req) { char filepath[50]; - printf("uri: %s\n", req->uri); + ESP_LOGD(TAG_SERVERMAIN, "uri: %s", req->uri); char *base_path = (char*) req->user_ctx; std::string filetosend(base_path); const char *filename = get_path_from_uri(filepath, base_path, req->uri + sizeof("/img_tmp/") - 1, sizeof(filepath)); - printf("1 uri: %s, filename: %s, filepath: %s\n", req->uri, filename, filepath); + ESP_LOGD(TAG_SERVERMAIN, "1 uri: %s, filename: %s, filepath: %s", req->uri, filename, filepath); filetosend = filetosend + "/img_tmp/" + std::string(filename); - printf("File to upload: %s\n", filetosend.c_str()); + ESP_LOGD(TAG_SERVERMAIN, "File to upload: %s", filetosend.c_str()); esp_err_t res = send_file(req, filetosend); if (res != ESP_OK) @@ -245,17 +247,17 @@ esp_err_t img_tmp_virtual_handler(httpd_req_t *req) char filepath[50]; - printf("uri: %s\n", req->uri); + ESP_LOGD(TAG_SERVERMAIN, "uri: %s", req->uri); char *base_path = (char*) req->user_ctx; std::string filetosend(base_path); const char *filename = get_path_from_uri(filepath, base_path, req->uri + sizeof("/img_tmp/") - 1, sizeof(filepath)); - printf("1 uri: %s, filename: %s, filepath: %s\n", req->uri, filename, filepath); + ESP_LOGD(TAG_SERVERMAIN, "1 uri: %s, filename: %s, filepath: %s", req->uri, filename, filepath); filetosend = std::string(filename); - printf("File to upload: %s\n", filetosend.c_str()); + ESP_LOGD(TAG_SERVERMAIN, "File to upload: %s", filetosend.c_str()); if (filetosend == "raw.jpg") { diff --git a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp index c37e0577..01656575 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp @@ -1,5 +1,7 @@ #include "test_flow_postrocess_helper.h" +#include "esp_log.h" +static const char *TAG_POSTPROC_HELPER = "test_flow_postproc_helper"; UnderTestPost* setUpClassFlowPostprocessing(t_CNNType digType, t_CNNType anaType) { @@ -36,7 +38,7 @@ std::string process_doFlow(std::vector analog, std::vector digits, bool checkConsistency, bool extendedResolution, int decimal_shift) { // setup the classundertest UnderTestPost* _undertestPost = init_do_flow(analog, digits, digType, checkConsistency, extendedResolution, decimal_shift); - printf("SetupClassFlowPostprocessing completed.\n"); + ESP_LOGD(TAG_POSTPROC_HELPER, "SetupClassFlowPostprocessing completed."); string time; // run test @@ -81,7 +83,7 @@ UnderTestPost* init_do_flow(std::vector analog, std::vector digits gen_analog->ROI.push_back(anaROI); } } - printf("Setting up of ROIs completed.\n"); + ESP_LOGD(TAG_POSTPROC_HELPER, "Setting up of ROIs completed."); _undertestPost->InitNUMBERS(); @@ -95,7 +97,7 @@ UnderTestPost* init_do_flow(std::vector analog, std::vector digits void setPreValue(UnderTestPost* _underTestPost, double _preValue) { if (_preValue>0) { - printf("preValue=%f", _preValue); + ESP_LOGD(TAG_POSTPROC_HELPER, "preValue=%f", _preValue); std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { (*NUMBERS)[_n]->PreValue = _preValue; @@ -104,7 +106,7 @@ void setPreValue(UnderTestPost* _underTestPost, double _preValue) { } void setAllowNegatives(UnderTestPost* _underTestPost, bool _allowNegatives) { - printf("checkConsistency=true\n"); + ESP_LOGD(TAG_POSTPROC_HELPER, "checkConsistency=true"); std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { (*NUMBERS)[_n]->AllowNegativeRates = _allowNegatives; @@ -114,7 +116,7 @@ void setAllowNegatives(UnderTestPost* _underTestPost, bool _allowNegatives) { void setConsitencyCheck(UnderTestPost* _underTestPost, bool _checkConsistency) { if (_checkConsistency) { - printf("checkConsistency=true\n"); + ESP_LOGD(TAG_POSTPROC_HELPER, "checkConsistency=true"); std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { (*NUMBERS)[_n]->checkDigitIncreaseConsistency = true; @@ -136,7 +138,7 @@ void setDecimalShift(UnderTestPost* _underTestPost, int _decimal_shift) { if (_decimal_shift!=0) { std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { - printf("Setting decimal shift on number: %d to %d\n", _n, _decimal_shift); + ESP_LOGD(TAG_POSTPROC_HELPER, "Setting decimal shift on number: %d to %d", _n, _decimal_shift); (*NUMBERS)[_n]->DecimalShift = _decimal_shift; (*NUMBERS)[_n]->DecimalShiftInitial = _decimal_shift; } @@ -147,7 +149,7 @@ void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analog if (_analogdigitTransistionStart!=0) { std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { - printf("Setting decimal shift on number: %d to %f\n", _n, _analogdigitTransistionStart); + ESP_LOGD(TAG_POSTPROC_HELPER, "Setting decimal shift on number: %d to %f", _n, _analogdigitTransistionStart); (*NUMBERS)[_n]->AnalogDigitalTransitionStart = _analogdigitTransistionStart; } }