|
|
@@ -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")
|
|
|
{
|